mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
all: replace struct field name '@type' with 'type' (#22485)
This commit is contained in:
parent
9788ae1f3e
commit
79786732ef
@ -163,7 +163,7 @@ enum TileFormat {
|
|||||||
exponent
|
exponent
|
||||||
shifts
|
shifts
|
||||||
none
|
none
|
||||||
end_ // To know when to wrap around
|
end // To know when to wrap around
|
||||||
}
|
}
|
||||||
|
|
||||||
enum GameState {
|
enum GameState {
|
||||||
@ -672,7 +672,7 @@ fn (app &App) draw_tiles() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
.none {} // Don't draw any text here, colors only
|
.none {} // Don't draw any text here, colors only
|
||||||
.end_ {} // Should never get here
|
.end {} // Should never get here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ fn (mut app App) next_theme() {
|
|||||||
@[inline]
|
@[inline]
|
||||||
fn (mut app App) next_tile_format() {
|
fn (mut app App) next_tile_format() {
|
||||||
app.tile_format = unsafe { TileFormat(int(app.tile_format) + 1) }
|
app.tile_format = unsafe { TileFormat(int(app.tile_format) + 1) }
|
||||||
if app.tile_format == .end_ {
|
if app.tile_format == .end {
|
||||||
app.tile_format = .normal
|
app.tile_format = .normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ fn init_cube_glsl(mut app App) {
|
|||||||
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
||||||
}
|
}
|
||||||
|
|
||||||
vert_buffer_desc.@type = .vertexbuffer
|
vert_buffer_desc.type = .vertexbuffer
|
||||||
// vert_buffer_desc.usage = .immutable
|
// vert_buffer_desc.usage = .immutable
|
||||||
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ fn init_cube_glsl(mut app App) {
|
|||||||
size: usize(indices.len * int(sizeof(u16)))
|
size: usize(indices.len * int(sizeof(u16)))
|
||||||
}
|
}
|
||||||
|
|
||||||
index_buffer_desc.@type = .indexbuffer
|
index_buffer_desc.type = .indexbuffer
|
||||||
ibuf := gfx.make_buffer(&index_buffer_desc)
|
ibuf := gfx.make_buffer(&index_buffer_desc)
|
||||||
|
|
||||||
// create shader
|
// create shader
|
||||||
|
@ -175,7 +175,7 @@ fn init_cube_glsl(mut app App) {
|
|||||||
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
||||||
}
|
}
|
||||||
|
|
||||||
vert_buffer_desc.@type = .vertexbuffer
|
vert_buffer_desc.type = .vertexbuffer
|
||||||
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
||||||
|
|
||||||
// create an index buffer for the cube
|
// create an index buffer for the cube
|
||||||
@ -201,7 +201,7 @@ fn init_cube_glsl(mut app App) {
|
|||||||
size: usize(indices.len * int(sizeof(u16)))
|
size: usize(indices.len * int(sizeof(u16)))
|
||||||
}
|
}
|
||||||
|
|
||||||
index_buffer_desc.@type = .indexbuffer
|
index_buffer_desc.type = .indexbuffer
|
||||||
ibuf := gfx.make_buffer(&index_buffer_desc)
|
ibuf := gfx.make_buffer(&index_buffer_desc)
|
||||||
|
|
||||||
// create shader
|
// create shader
|
||||||
|
@ -115,7 +115,7 @@ fn (mut app App) init_glsl_shader(shader_name string, shader_desc &gfx.ShaderDes
|
|||||||
ptr: vertices.data
|
ptr: vertices.data
|
||||||
size: vert_buffer_desc.size
|
size: vert_buffer_desc.size
|
||||||
}
|
}
|
||||||
vert_buffer_desc.@type = .vertexbuffer
|
vert_buffer_desc.type = .vertexbuffer
|
||||||
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
||||||
|
|
||||||
mut index_buffer_desc := gfx.BufferDesc{}
|
mut index_buffer_desc := gfx.BufferDesc{}
|
||||||
@ -126,7 +126,7 @@ fn (mut app App) init_glsl_shader(shader_name string, shader_desc &gfx.ShaderDes
|
|||||||
ptr: indices.data
|
ptr: indices.data
|
||||||
size: index_buffer_desc.size
|
size: index_buffer_desc.size
|
||||||
}
|
}
|
||||||
index_buffer_desc.@type = .indexbuffer
|
index_buffer_desc.type = .indexbuffer
|
||||||
ibuf := gfx.make_buffer(&index_buffer_desc)
|
ibuf := gfx.make_buffer(&index_buffer_desc)
|
||||||
|
|
||||||
// create shader
|
// create shader
|
||||||
|
@ -186,7 +186,7 @@ fn init_cube_glsl_i(mut app App) {
|
|||||||
ptr: vertices.data
|
ptr: vertices.data
|
||||||
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
size: usize(vertices.len * int(sizeof(Vertex_t)))
|
||||||
}
|
}
|
||||||
vert_buffer_desc.@type = .vertexbuffer
|
vert_buffer_desc.type = .vertexbuffer
|
||||||
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
||||||
|
|
||||||
// create an instance buffer for the cube
|
// create an instance buffer for the cube
|
||||||
@ -196,7 +196,7 @@ fn init_cube_glsl_i(mut app App) {
|
|||||||
unsafe { vmemset(&inst_buffer_desc, 0, int(sizeof(inst_buffer_desc))) }
|
unsafe { vmemset(&inst_buffer_desc, 0, int(sizeof(inst_buffer_desc))) }
|
||||||
|
|
||||||
inst_buffer_desc.size = usize(num_inst * int(sizeof(m4.Vec4)))
|
inst_buffer_desc.size = usize(num_inst * int(sizeof(m4.Vec4)))
|
||||||
inst_buffer_desc.@type = .vertexbuffer
|
inst_buffer_desc.type = .vertexbuffer
|
||||||
inst_buffer_desc.usage = .stream
|
inst_buffer_desc.usage = .stream
|
||||||
inst_buf := gfx.make_buffer(&inst_buffer_desc)
|
inst_buf := gfx.make_buffer(&inst_buffer_desc)
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ fn init_cube_glsl_i(mut app App) {
|
|||||||
ptr: indices.data
|
ptr: indices.data
|
||||||
size: usize(indices.len * int(sizeof(u16)))
|
size: usize(indices.len * int(sizeof(u16)))
|
||||||
}
|
}
|
||||||
index_buffer_desc.@type = .indexbuffer
|
index_buffer_desc.type = .indexbuffer
|
||||||
ibuf := gfx.make_buffer(&index_buffer_desc)
|
ibuf := gfx.make_buffer(&index_buffer_desc)
|
||||||
|
|
||||||
// create shader
|
// create shader
|
||||||
|
@ -86,7 +86,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
|
|||||||
size: usize(obj_buf.vbuf.len * int(sizeof(Vertex_pnct)))
|
size: usize(obj_buf.vbuf.len * int(sizeof(Vertex_pnct)))
|
||||||
}
|
}
|
||||||
|
|
||||||
vert_buffer_desc.@type = .vertexbuffer
|
vert_buffer_desc.type = .vertexbuffer
|
||||||
vert_buffer_desc.label = 'vertbuf_part_${in_part:03}'.str
|
vert_buffer_desc.label = 'vertbuf_part_${in_part:03}'.str
|
||||||
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
vbuf := gfx.make_buffer(&vert_buffer_desc)
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ pub fn (mut obj_part ObjPart) create_pipeline(in_part []int, shader gfx.Shader,
|
|||||||
size: usize(obj_buf.ibuf.len * int(sizeof(u32)))
|
size: usize(obj_buf.ibuf.len * int(sizeof(u32)))
|
||||||
}
|
}
|
||||||
|
|
||||||
index_buffer_desc.@type = .indexbuffer
|
index_buffer_desc.type = .indexbuffer
|
||||||
index_buffer_desc.label = 'indbuf_part_${in_part:03}'.str
|
index_buffer_desc.label = 'indbuf_part_${in_part:03}'.str
|
||||||
ibuf := gfx.make_buffer(&index_buffer_desc)
|
ibuf := gfx.make_buffer(&index_buffer_desc)
|
||||||
|
|
||||||
|
@ -113,26 +113,26 @@ fn frame(mut app App) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn event(ev &sapp.Event, mut app App) {
|
fn event(ev &sapp.Event, mut app App) {
|
||||||
if ev.@type == .mouse_move {
|
if ev.type == .mouse_move {
|
||||||
app.ps.explode(ev.mouse_x, ev.mouse_y)
|
app.ps.explode(ev.mouse_x, ev.mouse_y)
|
||||||
}
|
}
|
||||||
if ev.@type == .mouse_up || ev.@type == .mouse_down {
|
if ev.type == .mouse_up || ev.type == .mouse_down {
|
||||||
if ev.mouse_button == .left {
|
if ev.mouse_button == .left {
|
||||||
is_pressed := ev.@type == .mouse_down
|
is_pressed := ev.type == .mouse_down
|
||||||
if is_pressed {
|
if is_pressed {
|
||||||
app.ps.explode(ev.mouse_x, ev.mouse_y)
|
app.ps.explode(ev.mouse_x, ev.mouse_y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ev.@type == .key_up || ev.@type == .key_down {
|
if ev.type == .key_up || ev.type == .key_down {
|
||||||
if ev.key_code == .r {
|
if ev.key_code == .r {
|
||||||
is_pressed := ev.@type == .key_down
|
is_pressed := ev.type == .key_down
|
||||||
if is_pressed {
|
if is_pressed {
|
||||||
app.ps.reset()
|
app.ps.reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ev.@type == .touches_began || ev.@type == .touches_moved {
|
if ev.type == .touches_began || ev.type == .touches_moved {
|
||||||
if ev.num_touches > 0 {
|
if ev.num_touches > 0 {
|
||||||
touch_point := ev.touches[0]
|
touch_point := ev.touches[0]
|
||||||
app.ps.explode(touch_point.pos_x, touch_point.pos_y)
|
app.ps.explode(touch_point.pos_x, touch_point.pos_y)
|
||||||
|
@ -89,7 +89,7 @@ mut:
|
|||||||
@[typedef]
|
@[typedef]
|
||||||
pub struct C.XSelectionEvent {
|
pub struct C.XSelectionEvent {
|
||||||
mut:
|
mut:
|
||||||
@type int
|
type int
|
||||||
display &C.Display = unsafe { nil } // Display the event was read from
|
display &C.Display = unsafe { nil } // Display the event was read from
|
||||||
requestor Window
|
requestor Window
|
||||||
selection Atom
|
selection Atom
|
||||||
@ -114,7 +114,7 @@ mut:
|
|||||||
@[typedef]
|
@[typedef]
|
||||||
union C.XEvent {
|
union C.XEvent {
|
||||||
mut:
|
mut:
|
||||||
@type int
|
type int
|
||||||
xdestroywindow C.XDestroyWindowEvent
|
xdestroywindow C.XDestroyWindowEvent
|
||||||
xselectionclear C.XSelectionClearEvent
|
xselectionclear C.XSelectionClearEvent
|
||||||
xselectionrequest C.XSelectionRequestEvent
|
xselectionrequest C.XSelectionRequestEvent
|
||||||
@ -298,11 +298,11 @@ fn (mut cb Clipboard) start_listener() {
|
|||||||
for {
|
for {
|
||||||
time.sleep(1 * time.millisecond)
|
time.sleep(1 * time.millisecond)
|
||||||
C.XNextEvent(cb.display, &event)
|
C.XNextEvent(cb.display, &event)
|
||||||
if unsafe { event.@type == 0 } {
|
if unsafe { event.type == 0 } {
|
||||||
println('error')
|
println('error')
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
match unsafe { event.@type } {
|
match unsafe { event.type } {
|
||||||
C.DestroyNotify {
|
C.DestroyNotify {
|
||||||
if unsafe { event.xdestroywindow.window == cb.window } {
|
if unsafe { event.xdestroywindow.window == cb.window } {
|
||||||
// we are done
|
// we are done
|
||||||
@ -327,7 +327,7 @@ fn (mut cb Clipboard) start_listener() {
|
|||||||
xsre = unsafe { &event.xselectionrequest }
|
xsre = unsafe { &event.xselectionrequest }
|
||||||
|
|
||||||
mut xse := C.XSelectionEvent{
|
mut xse := C.XSelectionEvent{
|
||||||
@type: C.SelectionNotify // 31
|
type: C.SelectionNotify // 31
|
||||||
display: xsre.display
|
display: xsre.display
|
||||||
requestor: xsre.requestor
|
requestor: xsre.requestor
|
||||||
selection: xsre.selection
|
selection: xsre.selection
|
||||||
|
@ -29,7 +29,7 @@ pub struct C.MYSQL_FIELD {
|
|||||||
flags u32 // Bit-flags that describe the field
|
flags u32 // Bit-flags that describe the field
|
||||||
decimals u32 // Number of decimals in field
|
decimals u32 // Number of decimals in field
|
||||||
charsetnr u32 // Character set
|
charsetnr u32 // Character set
|
||||||
@type int // Type of field. See enums.v for types
|
type int // Type of field. See enums.v for types
|
||||||
}
|
}
|
||||||
|
|
||||||
// C.mysql_init allocates or initializes a MYSQL object suitable for `mysql_real_connect()`.
|
// C.mysql_init allocates or initializes a MYSQL object suitable for `mysql_real_connect()`.
|
||||||
|
@ -26,7 +26,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
|||||||
// Allocate memory for each column.
|
// Allocate memory for each column.
|
||||||
for i in 0 .. num_fields {
|
for i in 0 .. num_fields {
|
||||||
field := unsafe { fields[i] }
|
field := unsafe { fields[i] }
|
||||||
match unsafe { FieldType(field.@type) } {
|
match unsafe { FieldType(field.type) } {
|
||||||
.type_tiny {
|
.type_tiny {
|
||||||
data_pointers << unsafe { malloc(1) }
|
data_pointers << unsafe { malloc(1) }
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
|||||||
data_pointers << &u8(0)
|
data_pointers << &u8(0)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return error('\'${unsafe { FieldType(field.@type) }}\' is not yet implemented. Please create a new issue at https://github.com/vlang/v/issues/new')
|
return error('\'${unsafe { FieldType(field.type) }}\' is not yet implemented. Please create a new issue at https://github.com/vlang/v/issues/new')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
|||||||
|
|
||||||
for i, mut mysql_bind in stmt.res {
|
for i, mut mysql_bind in stmt.res {
|
||||||
field := unsafe { fields[i] }
|
field := unsafe { fields[i] }
|
||||||
field_type := unsafe { FieldType(field.@type) }
|
field_type := unsafe { FieldType(field.type) }
|
||||||
field_types << field_type
|
field_types << field_type
|
||||||
|
|
||||||
match types[i] {
|
match types[i] {
|
||||||
@ -87,7 +87,7 @@ pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.Qu
|
|||||||
}
|
}
|
||||||
.type_string, .type_blob {}
|
.type_string, .type_blob {}
|
||||||
else {
|
else {
|
||||||
return error('Unknown type ${field.@type}')
|
return error('Unknown type ${field.type}')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ pub struct Field {
|
|||||||
flags u32
|
flags u32
|
||||||
decimals u32
|
decimals u32
|
||||||
charsetnr u32
|
charsetnr u32
|
||||||
type_ FieldType
|
type FieldType
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch_row fetches the next row from a result.
|
// fetch_row fetches the next row from a result.
|
||||||
@ -112,7 +112,7 @@ pub fn (r Result) fields() []Field {
|
|||||||
flags: orig_fields.flags
|
flags: orig_fields.flags
|
||||||
decimals: orig_fields.decimals
|
decimals: orig_fields.decimals
|
||||||
charsetnr: orig_fields.charsetnr
|
charsetnr: orig_fields.charsetnr
|
||||||
type_: FieldType(orig_fields.@type)
|
type: FieldType(orig_fields.type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ pub fn (f Field) str() string {
|
|||||||
flags: ${f.flags}
|
flags: ${f.flags}
|
||||||
decimals: ${f.decimals}
|
decimals: ${f.decimals}
|
||||||
charsetnr: ${f.charsetnr}
|
charsetnr: ${f.charsetnr}
|
||||||
type: ${f.type_.str()}
|
type: ${f.type.str()}
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ pub fn (mut stmt Stmt) bind(typ int, buffer voidptr, buf_len u32) {
|
|||||||
pub fn (mut stmt Stmt) bind_res(fields &C.MYSQL_FIELD, dataptr []&u8, lengths []u32, num_fields int) {
|
pub fn (mut stmt Stmt) bind_res(fields &C.MYSQL_FIELD, dataptr []&u8, lengths []u32, num_fields int) {
|
||||||
for i in 0 .. num_fields {
|
for i in 0 .. num_fields {
|
||||||
stmt.res << C.MYSQL_BIND{
|
stmt.res << C.MYSQL_BIND{
|
||||||
buffer_type: unsafe { fields[i].@type }
|
buffer_type: unsafe { fields[i].type }
|
||||||
buffer: dataptr[i]
|
buffer: dataptr[i]
|
||||||
length: &lengths[i]
|
length: &lengths[i]
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ pub:
|
|||||||
prev &C.cJSON
|
prev &C.cJSON
|
||||||
child &C.cJSON // An array or object item will have a child pointer pointing to a chain of the items in the array/object
|
child &C.cJSON // An array or object item will have a child pointer pointing to a chain of the items in the array/object
|
||||||
|
|
||||||
@type int // The type of the item, as above
|
type int // The type of the item, as above
|
||||||
|
|
||||||
valueint int // writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead
|
valueint int // writing to valueint is DEPRECATED, use cJSON_SetNumberValue instead
|
||||||
valuedouble f64 // The item's number, if type==cJSON_Number
|
valuedouble f64 // The item's number, if type==cJSON_Number
|
||||||
|
@ -135,11 +135,11 @@ pub fn (a Addr) len() u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve_addrs converts the given `addr`, `family` and `@type` to a list of addresses
|
// resolve_addrs converts the given `addr`, `family` and `typ` to a list of addresses
|
||||||
pub fn resolve_addrs(addr string, family AddrFamily, @type SocketType) ![]Addr {
|
pub fn resolve_addrs(addr string, family AddrFamily, typ SocketType) ![]Addr {
|
||||||
match family {
|
match family {
|
||||||
.ip, .ip6, .unspec {
|
.ip, .ip6, .unspec {
|
||||||
return resolve_ipaddrs(addr, family, @type)
|
return resolve_ipaddrs(addr, family, typ)
|
||||||
}
|
}
|
||||||
.unix {
|
.unix {
|
||||||
resolved := Unix{}
|
resolved := Unix{}
|
||||||
@ -165,8 +165,8 @@ pub fn resolve_addrs(addr string, family AddrFamily, @type SocketType) ![]Addr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve_addrs converts the given `addr` and `@type` to a list of addresses
|
// resolve_addrs converts the given `addr` and `typ` to a list of addresses
|
||||||
pub fn resolve_addrs_fuzzy(addr string, @type SocketType) ![]Addr {
|
pub fn resolve_addrs_fuzzy(addr string, typ SocketType) ![]Addr {
|
||||||
if addr.len == 0 {
|
if addr.len == 0 {
|
||||||
return error('none')
|
return error('none')
|
||||||
}
|
}
|
||||||
@ -177,10 +177,10 @@ pub fn resolve_addrs_fuzzy(addr string, @type SocketType) ![]Addr {
|
|||||||
if addr.contains(':') {
|
if addr.contains(':') {
|
||||||
// Colon is a reserved character in unix paths
|
// Colon is a reserved character in unix paths
|
||||||
// so this must be an ip address
|
// so this must be an ip address
|
||||||
return resolve_addrs(addr, .unspec, @type)
|
return resolve_addrs(addr, .unspec, typ)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resolve_addrs(addr, .unix, @type)
|
return resolve_addrs(addr, .unix, typ)
|
||||||
}
|
}
|
||||||
|
|
||||||
// resolve_ipaddrs converts the given `addr`, `family` and `typ` to a list of addresses
|
// resolve_ipaddrs converts the given `addr`, `family` and `typ` to a list of addresses
|
||||||
|
@ -220,17 +220,17 @@ pub fn (mut desc C.sg_shader_desc) set_frag_uniform_block_size(block_index int,
|
|||||||
return desc
|
return desc
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut desc C.sg_shader_desc) set_vert_uniform(block_index int, uniform_index int, name string, @type UniformType,
|
pub fn (mut desc C.sg_shader_desc) set_vert_uniform(block_index int, uniform_index int, name string, typ UniformType,
|
||||||
array_count int) &ShaderDesc {
|
array_count int) &ShaderDesc {
|
||||||
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
||||||
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].@type = @type
|
desc.vs.uniform_blocks[block_index].uniforms[uniform_index].type = typ
|
||||||
return desc
|
return desc
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn (mut desc C.sg_shader_desc) set_frag_uniform(block_index int, uniform_index int, name string, @type UniformType,
|
pub fn (mut desc C.sg_shader_desc) set_frag_uniform(block_index int, uniform_index int, name string, typ UniformType,
|
||||||
array_count int) &ShaderDesc {
|
array_count int) &ShaderDesc {
|
||||||
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].name = &char(name.str)
|
||||||
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].@type = @type
|
desc.fs.uniform_blocks[block_index].uniforms[uniform_index].type = typ
|
||||||
return desc
|
return desc
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ pub type ShaderUniformBlockDesc = C.sg_shader_uniform_block_desc
|
|||||||
pub struct C.sg_shader_uniform_desc {
|
pub struct C.sg_shader_uniform_desc {
|
||||||
pub mut:
|
pub mut:
|
||||||
name &char
|
name &char
|
||||||
@type UniformType
|
type UniformType
|
||||||
array_count int
|
array_count int
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -636,7 +636,7 @@ pub type Pass = C.sg_pass
|
|||||||
pub struct C.sg_buffer_desc {
|
pub struct C.sg_buffer_desc {
|
||||||
pub mut:
|
pub mut:
|
||||||
size usize
|
size usize
|
||||||
@type BufferType
|
type BufferType
|
||||||
usage Usage
|
usage Usage
|
||||||
data Range
|
data Range
|
||||||
label &char
|
label &char
|
||||||
@ -682,7 +682,7 @@ pub fn (mut b Buffer) free() {
|
|||||||
|
|
||||||
pub struct C.sg_image_desc {
|
pub struct C.sg_image_desc {
|
||||||
pub mut:
|
pub mut:
|
||||||
@type ImageType
|
type ImageType
|
||||||
render_target bool
|
render_target bool
|
||||||
width int
|
width int
|
||||||
height int
|
height int
|
||||||
|
@ -90,7 +90,7 @@ pub type Desc = C.sapp_desc
|
|||||||
pub struct C.sapp_event {
|
pub struct C.sapp_event {
|
||||||
pub:
|
pub:
|
||||||
frame_count u64 // current frame counter, always valid, useful for checking if two events were issued in the same frame
|
frame_count u64 // current frame counter, always valid, useful for checking if two events were issued in the same frame
|
||||||
@type EventType // the event type, always valid
|
type EventType // the event type, always valid
|
||||||
key_code KeyCode // the virtual key code, only valid in KEY_UP, KEY_DOWN
|
key_code KeyCode // the virtual key code, only valid in KEY_UP, KEY_DOWN
|
||||||
char_code u32 // the UTF-32 character code, only valid in CHAR events
|
char_code u32 // the UTF-32 character code, only valid in CHAR events
|
||||||
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
|
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
|
||||||
@ -113,7 +113,7 @@ pub:
|
|||||||
pub type Event = C.sapp_event
|
pub type Event = C.sapp_event
|
||||||
|
|
||||||
pub fn (e &C.sapp_event) str() string {
|
pub fn (e &C.sapp_event) str() string {
|
||||||
return 'evt: frame_count=${e.frame_count}, type=${e.@type}'
|
return 'evt: frame_count=${e.frame_count}, type=${e.type}'
|
||||||
}
|
}
|
||||||
|
|
||||||
@[typedef]
|
@[typedef]
|
||||||
|
@ -785,7 +785,7 @@ fn (mut c Checker) comptime_if_cond(mut cond ast.Expr, pos token.Pos) ComptimeBr
|
|||||||
.skip
|
.skip
|
||||||
}
|
}
|
||||||
} else if cond.left in [ast.Ident, ast.SelectorExpr, ast.TypeNode] {
|
} else if cond.left in [ast.Ident, ast.SelectorExpr, ast.TypeNode] {
|
||||||
// `$if method.@type is string`
|
// `$if method.type is string`
|
||||||
c.expr(mut cond.left)
|
c.expr(mut cond.left)
|
||||||
if cond.left is ast.SelectorExpr
|
if cond.left is ast.SelectorExpr
|
||||||
&& c.comptime.is_comptime_selector_type(cond.left)
|
&& c.comptime.is_comptime_selector_type(cond.left)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user