mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sokol: make examples compile
This commit is contained in:
@ -415,12 +415,14 @@ pub mut:
|
||||
val [4]f32
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn (action mut C.sg_color_attachment_action) set_color_values(r, g, b, a f32) {
|
||||
action.val[0] = r
|
||||
action.val[1] = g
|
||||
action.val[2] = b
|
||||
action.val[3] = a
|
||||
}
|
||||
*/
|
||||
|
||||
pub struct C.sg_depth_attachment_action {
|
||||
pub mut:
|
||||
|
@ -4,7 +4,11 @@ pub fn create_clear_pass(r, g, b, a f32) C.sg_pass_action {
|
||||
mut color_action := C.sg_color_attachment_action {
|
||||
action: C.SG_ACTION_CLEAR
|
||||
}
|
||||
color_action.set_color_values(r, g, b, a)
|
||||
//color_action.set_color_values(r, g, b, a)
|
||||
color_action.val[0] = r
|
||||
color_action.val[1] = g
|
||||
color_action.val[2] = b
|
||||
color_action.val[3] = a
|
||||
|
||||
mut pass_action := C.sg_pass_action{}
|
||||
pass_action.colors[0] = color_action
|
||||
|
@ -654,7 +654,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
||||
g.includes.writeln('#$it.val')
|
||||
}
|
||||
if typ == 'define' {
|
||||
g.definitions.writeln('#$it.val')
|
||||
g.includes.writeln('#$it.val')
|
||||
}
|
||||
}
|
||||
ast.Import {}
|
||||
@ -967,6 +967,12 @@ fn (mut g Gen) gen_assign_stmt(assign_stmt ast.AssignStmt) {
|
||||
right_sym := g.table.get_type_symbol(assign_stmt.right_types[i])
|
||||
mut is_fixed_array_init := false
|
||||
mut has_val := false
|
||||
/*
|
||||
if val is ast.ArrayInit {
|
||||
is_fixed_array_init = val.is_fixed
|
||||
has_val = val.has_val
|
||||
}
|
||||
*/
|
||||
match val {
|
||||
ast.ArrayInit {
|
||||
is_fixed_array_init = it.is_fixed
|
||||
@ -2444,6 +2450,9 @@ fn (mut g Gen) write_types(types []table.TypeSymbol) {
|
||||
mut fixed := styp[12..]
|
||||
len := styp.after('_')
|
||||
fixed = fixed[..fixed.len - len.len - 1]
|
||||
if fixed.starts_with('C__') {
|
||||
fixed = fixed[3..]
|
||||
}
|
||||
g.definitions.writeln('typedef $fixed $styp [$len];')
|
||||
// }
|
||||
}
|
||||
|
@ -292,8 +292,10 @@ fn (mut g Gen) method_call(node ast.CallExpr) {
|
||||
if node.left_type == 0 {
|
||||
verror('method receiver type is 0, this means there are some uchecked exprs')
|
||||
}
|
||||
mut receiver_type_name := g.cc_type(node.receiver_type)
|
||||
// mut receiver_type_name := g.cc_type(node.receiver_type)
|
||||
//mut receiver_type_name := g.typ(node.receiver_type)
|
||||
typ_sym := g.table.get_type_symbol(node.receiver_type)
|
||||
mut receiver_type_name := typ_sym.name.replace('.', '__')
|
||||
if typ_sym.kind == .interface_ {
|
||||
// Speaker_name_table[s._interface_idx].speak(s._object)
|
||||
g.write('${c_name(receiver_type_name)}_name_table[')
|
||||
|
Reference in New Issue
Block a user