fmt: fix and simplify align of struct fields (#21995)

This commit is contained in:
yuyi 2024-08-06 01:23:39 +08:00 committed by GitHub
parent 576a0abcc7
commit ddb6685d8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
139 changed files with 553 additions and 519 deletions

View file

@ -45,9 +45,9 @@ pub:
// fail_cb fn (&u8) = unsafe { nil }
user_data voidptr // these are the user-provided callbacks with user data
init_userdata_cb fn (voidptr) = unsafe { nil }
frame_userdata_cb fn (voidptr) = unsafe { nil }
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
init_userdata_cb fn (voidptr) = unsafe { nil }
frame_userdata_cb fn (voidptr) = unsafe { nil }
cleanup_userdata_cb fn (voidptr) = unsafe { nil }
event_userdata_cb fn (&Event, voidptr) = unsafe { nil }
// fail_userdata_cb fn (&char, voidptr) = unsafe { nil }
@ -89,25 +89,25 @@ pub type Desc = C.sapp_desc
@[typedef]
pub struct C.sapp_event {
pub:
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
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
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
modifiers u32 // current modifier keys, valid in all key-, char- and mouse-events
mouse_button MouseButton // mouse button that was pressed or released, valid in MOUSE_DOWN, MOUSE_UP
mouse_x f32 // current horizontal mouse position in pixels, always valid except during mouse lock
mouse_y f32 // current vertical mouse position in pixels, always valid except during mouse lock
mouse_dx f32 // relative horizontal mouse movement since last frame, always valid
mouse_dy f32 // relative vertical mouse movement since last frame, always valid
scroll_x f32 // horizontal mouse wheel scroll distance, valid in MOUSE_SCROLL events
scroll_y f32 // vertical mouse wheel scroll distance, valid in MOUSE_SCROLL events
num_touches int // number of valid items in the touches[] array
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
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
key_repeat bool // true if this is a key-repeat event, valid in KEY_UP, KEY_DOWN and CHAR
modifiers u32 // current modifier keys, valid in all key-, char- and mouse-events
mouse_button MouseButton // mouse button that was pressed or released, valid in MOUSE_DOWN, MOUSE_UP
mouse_x f32 // current horizontal mouse position in pixels, always valid except during mouse lock
mouse_y f32 // current vertical mouse position in pixels, always valid except during mouse lock
mouse_dx f32 // relative horizontal mouse movement since last frame, always valid
mouse_dy f32 // relative vertical mouse movement since last frame, always valid
scroll_x f32 // horizontal mouse wheel scroll distance, valid in MOUSE_SCROLL events
scroll_y f32 // vertical mouse wheel scroll distance, valid in MOUSE_SCROLL events
num_touches int // number of valid items in the touches[] array
touches [max_touchpoints]TouchPoint // current touch points, valid in TOUCHES_BEGIN, TOUCHES_MOVED, TOUCHES_ENDED
window_width int // current window- and framebuffer width in pixels, always valid
window_height int // current window- and framebuffer height in pixels, always valid
framebuffer_width int // = window_width * dpi_scale
framebuffer_height int // = window_height * dpi_scale
window_width int // current window- and framebuffer width in pixels, always valid
window_height int // current window- and framebuffer height in pixels, always valid
framebuffer_width int // = window_width * dpi_scale
framebuffer_height int // = window_height * dpi_scale
}
pub type Event = C.sapp_event

View file

@ -14,8 +14,8 @@ pub:
@[typedef]
pub struct C.sfons_desc_t {
pub:
width int // initial width of font atlas texture (default: 512, must be power of 2)
height int // initial height of font atlas texture (default: 512, must be power of 2)
width int // initial width of font atlas texture (default: 512, must be power of 2)
height int // initial height of font atlas texture (default: 512, must be power of 2)
allocator C.sfons_allocator_t // optional memory allocation overrides
}

View file

@ -26,8 +26,8 @@ pub type ContextDesc = C.sgl_context_desc_t
@[typedef]
pub struct C.sgl_context_desc_t {
max_vertices int // default: 64k
max_commands int // default: 16k
max_vertices int // default: 64k
max_commands int // default: 16k
color_format gfx.PixelFormat // C.sg_pixel_format
depth_format gfx.PixelFormat // C.sg_pixel_format
sample_count int
@ -38,10 +38,10 @@ pub type Desc = C.sgl_desc_t
@[typedef]
pub struct C.sgl_desc_t {
pub:
max_vertices int // size for vertex buffer
max_commands int // size of uniform- and command-buffers
context_pool_size int // max number of contexts (including default context), default: 4
pipeline_pool_size int // size of internal pipeline pool, default: 64
max_vertices int // size for vertex buffer
max_commands int // size of uniform- and command-buffers
context_pool_size int // max number of contexts (including default context), default: 4
pipeline_pool_size int // size of internal pipeline pool, default: 64
color_format gfx.PixelFormat // C.sg_pixel_format
depth_format gfx.PixelFormat // C.sg_pixel_format
sample_count int