mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: make v test-cleancode
test everything by default (#10050)
This commit is contained in:
@@ -1,165 +1,165 @@
|
||||
module sapp
|
||||
|
||||
pub enum EventType {
|
||||
invalid
|
||||
key_down
|
||||
key_up
|
||||
char
|
||||
mouse_down
|
||||
mouse_up
|
||||
mouse_scroll
|
||||
mouse_move
|
||||
mouse_enter
|
||||
mouse_leave
|
||||
touches_began
|
||||
touches_moved
|
||||
touches_ended
|
||||
touches_cancelled
|
||||
resized
|
||||
iconified
|
||||
restored
|
||||
suspended
|
||||
resumed
|
||||
update_cursor
|
||||
quit_requested
|
||||
clipboard_pasted
|
||||
num
|
||||
invalid
|
||||
key_down
|
||||
key_up
|
||||
char
|
||||
mouse_down
|
||||
mouse_up
|
||||
mouse_scroll
|
||||
mouse_move
|
||||
mouse_enter
|
||||
mouse_leave
|
||||
touches_began
|
||||
touches_moved
|
||||
touches_ended
|
||||
touches_cancelled
|
||||
resized
|
||||
iconified
|
||||
restored
|
||||
suspended
|
||||
resumed
|
||||
update_cursor
|
||||
quit_requested
|
||||
clipboard_pasted
|
||||
num
|
||||
}
|
||||
|
||||
pub enum MouseButton {
|
||||
invalid = -1
|
||||
left = 0
|
||||
right = 1
|
||||
middle = 2
|
||||
invalid = -1
|
||||
left = 0
|
||||
right = 1
|
||||
middle = 2
|
||||
}
|
||||
|
||||
pub enum Modifier {
|
||||
shift = 1 //(1<<0)
|
||||
ctrl = 2 //(1<<1)
|
||||
alt = 4 //(1<<2)
|
||||
super = 8 //(1<<3)
|
||||
shift = 1 //(1<<0)
|
||||
ctrl = 2 //(1<<1)
|
||||
alt = 4 //(1<<2)
|
||||
super = 8 //(1<<3)
|
||||
}
|
||||
|
||||
pub enum KeyCode {
|
||||
invalid = 0
|
||||
space = 32
|
||||
apostrophe = 39 /* ' */
|
||||
comma = 44 /* , */
|
||||
minus = 45 /* - */
|
||||
period = 46 /* . */
|
||||
slash = 47 /* / */
|
||||
_0 = 48
|
||||
_1 = 49
|
||||
_2 = 50
|
||||
_3 = 51
|
||||
_4 = 52
|
||||
_5 = 53
|
||||
_6 = 54
|
||||
_7 = 55
|
||||
_8 = 56
|
||||
_9 = 57
|
||||
semicolon = 59 /* ; */
|
||||
equal = 61 /* = */
|
||||
a = 65
|
||||
b = 66
|
||||
c = 67
|
||||
d = 68
|
||||
e = 69
|
||||
f = 70
|
||||
g = 71
|
||||
h = 72
|
||||
i = 73
|
||||
j = 74
|
||||
k = 75
|
||||
l = 76
|
||||
m = 77
|
||||
n = 78
|
||||
o = 79
|
||||
p = 80
|
||||
q = 81
|
||||
r = 82
|
||||
s = 83
|
||||
t = 84
|
||||
u = 85
|
||||
v = 86
|
||||
w = 87
|
||||
x = 88
|
||||
y = 89
|
||||
z = 90
|
||||
left_bracket = 91 /* [ */
|
||||
backslash = 92 /* \ */
|
||||
right_bracket = 93 /* ] */
|
||||
grave_accent = 96 /* ` */
|
||||
world_1 = 161 /* non-us #1 */
|
||||
world_2 = 162 /* non-us #2 */
|
||||
escape = 256
|
||||
enter = 257
|
||||
tab = 258
|
||||
backspace = 259
|
||||
insert = 260
|
||||
delete = 261
|
||||
right = 262
|
||||
left = 263
|
||||
down = 264
|
||||
up = 265
|
||||
page_up = 266
|
||||
page_down = 267
|
||||
home = 268
|
||||
end = 269
|
||||
caps_lock = 280
|
||||
scroll_lock = 281
|
||||
num_lock = 282
|
||||
print_screen = 283
|
||||
pause = 284
|
||||
f1 = 290
|
||||
f2 = 291
|
||||
f3 = 292
|
||||
f4 = 293
|
||||
f5 = 294
|
||||
f6 = 295
|
||||
f7 = 296
|
||||
f8 = 297
|
||||
f9 = 298
|
||||
f10 = 299
|
||||
f11 = 300
|
||||
f12 = 301
|
||||
f13 = 302
|
||||
f14 = 303
|
||||
f15 = 304
|
||||
f16 = 305
|
||||
f17 = 306
|
||||
f18 = 307
|
||||
f19 = 308
|
||||
f20 = 309
|
||||
f21 = 310
|
||||
f22 = 311
|
||||
f23 = 312
|
||||
f24 = 313
|
||||
f25 = 314
|
||||
kp_0 = 320
|
||||
kp_1 = 321
|
||||
kp_2 = 322
|
||||
kp_3 = 323
|
||||
kp_4 = 324
|
||||
kp_5 = 325
|
||||
kp_6 = 326
|
||||
kp_7 = 327
|
||||
kp_8 = 328
|
||||
kp_9 = 329
|
||||
kp_decimal = 330
|
||||
kp_divide = 331
|
||||
kp_multiply = 332
|
||||
kp_subtract = 333
|
||||
kp_add = 334
|
||||
kp_enter = 335
|
||||
kp_equal = 336
|
||||
left_shift = 340
|
||||
left_control = 341
|
||||
left_alt = 342
|
||||
left_super = 343
|
||||
right_shift = 344
|
||||
right_control = 345
|
||||
right_alt = 346
|
||||
right_super = 347
|
||||
menu = 348
|
||||
invalid = 0
|
||||
space = 32
|
||||
apostrophe = 39 //'
|
||||
comma = 44 //,
|
||||
minus = 45 //-
|
||||
period = 46 //.
|
||||
slash = 47 ///
|
||||
_0 = 48
|
||||
_1 = 49
|
||||
_2 = 50
|
||||
_3 = 51
|
||||
_4 = 52
|
||||
_5 = 53
|
||||
_6 = 54
|
||||
_7 = 55
|
||||
_8 = 56
|
||||
_9 = 57
|
||||
semicolon = 59 //;
|
||||
equal = 61 //=
|
||||
a = 65
|
||||
b = 66
|
||||
c = 67
|
||||
d = 68
|
||||
e = 69
|
||||
f = 70
|
||||
g = 71
|
||||
h = 72
|
||||
i = 73
|
||||
j = 74
|
||||
k = 75
|
||||
l = 76
|
||||
m = 77
|
||||
n = 78
|
||||
o = 79
|
||||
p = 80
|
||||
q = 81
|
||||
r = 82
|
||||
s = 83
|
||||
t = 84
|
||||
u = 85
|
||||
v = 86
|
||||
w = 87
|
||||
x = 88
|
||||
y = 89
|
||||
z = 90
|
||||
left_bracket = 91 //[
|
||||
backslash = 92 //\
|
||||
right_bracket = 93 //]
|
||||
grave_accent = 96 //`
|
||||
world_1 = 161 // non-us #1
|
||||
world_2 = 162 // non-us #2
|
||||
escape = 256
|
||||
enter = 257
|
||||
tab = 258
|
||||
backspace = 259
|
||||
insert = 260
|
||||
delete = 261
|
||||
right = 262
|
||||
left = 263
|
||||
down = 264
|
||||
up = 265
|
||||
page_up = 266
|
||||
page_down = 267
|
||||
home = 268
|
||||
end = 269
|
||||
caps_lock = 280
|
||||
scroll_lock = 281
|
||||
num_lock = 282
|
||||
print_screen = 283
|
||||
pause = 284
|
||||
f1 = 290
|
||||
f2 = 291
|
||||
f3 = 292
|
||||
f4 = 293
|
||||
f5 = 294
|
||||
f6 = 295
|
||||
f7 = 296
|
||||
f8 = 297
|
||||
f9 = 298
|
||||
f10 = 299
|
||||
f11 = 300
|
||||
f12 = 301
|
||||
f13 = 302
|
||||
f14 = 303
|
||||
f15 = 304
|
||||
f16 = 305
|
||||
f17 = 306
|
||||
f18 = 307
|
||||
f19 = 308
|
||||
f20 = 309
|
||||
f21 = 310
|
||||
f22 = 311
|
||||
f23 = 312
|
||||
f24 = 313
|
||||
f25 = 314
|
||||
kp_0 = 320
|
||||
kp_1 = 321
|
||||
kp_2 = 322
|
||||
kp_3 = 323
|
||||
kp_4 = 324
|
||||
kp_5 = 325
|
||||
kp_6 = 326
|
||||
kp_7 = 327
|
||||
kp_8 = 328
|
||||
kp_9 = 329
|
||||
kp_decimal = 330
|
||||
kp_divide = 331
|
||||
kp_multiply = 332
|
||||
kp_subtract = 333
|
||||
kp_add = 334
|
||||
kp_enter = 335
|
||||
kp_equal = 336
|
||||
left_shift = 340
|
||||
left_control = 341
|
||||
left_alt = 342
|
||||
left_super = 343
|
||||
right_shift = 344
|
||||
right_control = 345
|
||||
right_alt = 346
|
||||
right_super = 347
|
||||
menu = 348
|
||||
}
|
||||
|
@@ -7,7 +7,9 @@ pub const (
|
||||
)
|
||||
|
||||
// Android needs a global reference to `g_desc`
|
||||
__global ( g_desc C.sapp_desc )
|
||||
__global (
|
||||
g_desc C.sapp_desc
|
||||
)
|
||||
|
||||
pub fn create_desc() C.sg_desc {
|
||||
metal_desc := C.sg_metal_context_desc{
|
||||
|
@@ -1,73 +1,99 @@
|
||||
module sapp
|
||||
|
||||
/* returns true after sokol-app has been initialized */
|
||||
// returns true after sokol-app has been initialized
|
||||
fn C.sapp_isvalid() bool
|
||||
/* returns the current framebuffer width in pixels */
|
||||
|
||||
// returns the current framebuffer width in pixels
|
||||
fn C.sapp_width() int
|
||||
fn C.sapp_widthf() f32
|
||||
/* returns the current framebuffer height in pixels */
|
||||
|
||||
// returns the current framebuffer height in pixels
|
||||
fn C.sapp_height() int
|
||||
fn C.sapp_heightf() f32
|
||||
/* returns true when high_dpi was requested and actually running in a high-dpi scenario */
|
||||
fn C.sapp_high_dpi() bool
|
||||
/* returns the dpi scaling factor (window pixels to framebuffer pixels) */
|
||||
fn C.sapp_dpi_scale() f32
|
||||
/* show or hide the mobile device onscreen keyboard */
|
||||
fn C.sapp_show_keyboard(visible bool)
|
||||
/* return true if the mobile device onscreen keyboard is currently shown */
|
||||
fn C.sapp_keyboard_shown() bool
|
||||
/* show or hide the mouse cursor */
|
||||
fn C.sapp_show_mouse(visible bool)
|
||||
/* show or hide the mouse cursor */
|
||||
fn C.sapp_mouse_shown() bool
|
||||
/* return the userdata pointer optionally provided in sapp_desc */
|
||||
fn C.sapp_userdata() voidptr
|
||||
/* return a copy of the sapp_desc structure */
|
||||
fn C.sapp_query_desc() C.sapp_desc
|
||||
/* initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED) */
|
||||
fn C.sapp_request_quit()
|
||||
/* cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received) */
|
||||
fn C.sapp_cancel_quit()
|
||||
/* intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED) */
|
||||
fn C.sapp_quit()
|
||||
/* call from inside event callback to consume the current event (don't forward to platform) */
|
||||
fn C.sapp_consume_event()
|
||||
/* get the current frame counter (for comparison with sapp_event.frame_count) */
|
||||
fn C.sapp_frame_count() u64
|
||||
/* write string into clipboard */
|
||||
fn C.sapp_set_clipboard_string(str byteptr)
|
||||
/* read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED) */
|
||||
fn C.sapp_get_clipboard_string() byteptr
|
||||
|
||||
/* special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub) */
|
||||
// returns true when high_dpi was requested and actually running in a high-dpi scenario
|
||||
fn C.sapp_high_dpi() bool
|
||||
|
||||
// returns the dpi scaling factor (window pixels to framebuffer pixels)
|
||||
fn C.sapp_dpi_scale() f32
|
||||
|
||||
// show or hide the mobile device onscreen keyboard
|
||||
fn C.sapp_show_keyboard(visible bool)
|
||||
|
||||
// return true if the mobile device onscreen keyboard is currently shown
|
||||
fn C.sapp_keyboard_shown() bool
|
||||
|
||||
// show or hide the mouse cursor
|
||||
fn C.sapp_show_mouse(visible bool)
|
||||
|
||||
// show or hide the mouse cursor
|
||||
fn C.sapp_mouse_shown() bool
|
||||
|
||||
// return the userdata pointer optionally provided in sapp_desc
|
||||
fn C.sapp_userdata() voidptr
|
||||
|
||||
// return a copy of the sapp_desc structure
|
||||
fn C.sapp_query_desc() C.sapp_desc
|
||||
|
||||
// initiate a "soft quit" (sends SAPP_EVENTTYPE_QUIT_REQUESTED)
|
||||
fn C.sapp_request_quit()
|
||||
|
||||
// cancel a pending quit (when SAPP_EVENTTYPE_QUIT_REQUESTED has been received)
|
||||
fn C.sapp_cancel_quit()
|
||||
|
||||
// intiate a "hard quit" (quit application without sending SAPP_EVENTTYPE_QUIT_REQUSTED)
|
||||
fn C.sapp_quit()
|
||||
|
||||
// call from inside event callback to consume the current event (don't forward to platform)
|
||||
fn C.sapp_consume_event()
|
||||
|
||||
// get the current frame counter (for comparison with sapp_event.frame_count)
|
||||
fn C.sapp_frame_count() u64
|
||||
|
||||
// write string into clipboard
|
||||
fn C.sapp_set_clipboard_string(str &byte)
|
||||
|
||||
// read string from clipboard (usually during SAPP_EVENTTYPE_CLIPBOARD_PASTED)
|
||||
fn C.sapp_get_clipboard_string() &byte
|
||||
|
||||
// special run-function for SOKOL_NO_ENTRY (in standard mode this is an empty stub)
|
||||
fn C.sapp_run(desc &C.sapp_desc) int
|
||||
|
||||
/* GL: return true when GLES2 fallback is active (to detect fallback from GLES3) */
|
||||
// GL: return true when GLES2 fallback is active (to detect fallback from GLES3)
|
||||
fn C.sapp_gles2() bool
|
||||
|
||||
/* HTML5: enable or disable the hardwired "Leave Site?" dialog box */
|
||||
// HTML5: enable or disable the hardwired "Leave Site?" dialog box
|
||||
fn C.sapp_html5_ask_leave_site(ask bool)
|
||||
|
||||
/* Metal: get ARC-bridged pointer to Metal device object */
|
||||
// Metal: get ARC-bridged pointer to Metal device object
|
||||
fn C.sapp_metal_get_device() voidptr
|
||||
/* Metal: get ARC-bridged pointer to this frame's renderpass descriptor */
|
||||
|
||||
// Metal: get ARC-bridged pointer to this frame's renderpass descriptor
|
||||
fn C.sapp_metal_get_renderpass_descriptor() voidptr
|
||||
/* Metal: get ARC-bridged pointer to current drawable */
|
||||
|
||||
// Metal: get ARC-bridged pointer to current drawable
|
||||
fn C.sapp_metal_get_drawable() voidptr
|
||||
/* macOS: get ARC-bridged pointer to macOS NSWindow */
|
||||
|
||||
// macOS: get ARC-bridged pointer to macOS NSWindow
|
||||
fn C.sapp_macos_get_window() voidptr
|
||||
/* iOS: get ARC-bridged pointer to iOS UIWindow */
|
||||
|
||||
// iOS: get ARC-bridged pointer to iOS UIWindow
|
||||
fn C.sapp_ios_get_window() voidptr
|
||||
|
||||
/* D3D11: get pointer to ID3D11Device object */
|
||||
// D3D11: get pointer to ID3D11Device object
|
||||
fn C.sapp_d3d11_get_device() voidptr
|
||||
/* D3D11: get pointer to ID3D11DeviceContext object */
|
||||
|
||||
// D3D11: get pointer to ID3D11DeviceContext object
|
||||
fn C.sapp_d3d11_get_device_context() voidptr
|
||||
/* D3D11: get pointer to ID3D11RenderTargetView object */
|
||||
|
||||
// D3D11: get pointer to ID3D11RenderTargetView object
|
||||
fn C.sapp_d3d11_get_render_target_view() voidptr
|
||||
/* D3D11: get pointer to ID3D11DepthStencilView */
|
||||
|
||||
// D3D11: get pointer to ID3D11DepthStencilView
|
||||
fn C.sapp_d3d11_get_depth_stencil_view() voidptr
|
||||
/* Win32: get the HWND window handle */
|
||||
|
||||
// Win32: get the HWND window handle
|
||||
fn C.sapp_win32_get_hwnd() voidptr
|
||||
/* Android: get native activity handle */
|
||||
|
||||
// Android: get native activity handle
|
||||
fn C.sapp_android_get_native_activity() voidptr
|
||||
|
@@ -2,46 +2,46 @@ module sapp
|
||||
|
||||
pub struct C.sapp_desc {
|
||||
pub:
|
||||
init_cb fn () // these are the user-provided callbacks without user data
|
||||
frame_cb fn ()
|
||||
cleanup_cb fn ()
|
||||
event_cb fn (&C.sapp_event) //&sapp_event)
|
||||
fail_cb fn (&byte)
|
||||
init_cb fn () // these are the user-provided callbacks without user data
|
||||
frame_cb fn ()
|
||||
cleanup_cb fn ()
|
||||
event_cb fn (&C.sapp_event) //&sapp_event)
|
||||
fail_cb fn (&byte)
|
||||
|
||||
user_data voidptr // these are the user-provided callbacks with user data
|
||||
init_userdata_cb fn (voidptr)
|
||||
frame_userdata_cb fn (voidptr)
|
||||
cleanup_userdata_cb fn (voidptr)
|
||||
event_userdata_cb fn (&C.sapp_event, voidptr)
|
||||
fail_userdata_cb fn (&char, voidptr)
|
||||
user_data voidptr // these are the user-provided callbacks with user data
|
||||
init_userdata_cb fn (voidptr)
|
||||
frame_userdata_cb fn (voidptr)
|
||||
cleanup_userdata_cb fn (voidptr)
|
||||
event_userdata_cb fn (&C.sapp_event, voidptr)
|
||||
fail_userdata_cb fn (&char, voidptr)
|
||||
|
||||
width int // the preferred width of the window / canvas
|
||||
height int // the preferred height of the window / canvas
|
||||
sample_count int // MSAA sample count
|
||||
swap_interval int // the preferred swap interval (ignored on some platforms)
|
||||
high_dpi bool // whether the rendering canvas is full-resolution on HighDPI displays
|
||||
fullscreen bool // whether the window should be created in fullscreen mode
|
||||
alpha bool // whether the framebuffer should have an alpha channel (ignored on some platforms)
|
||||
window_title &char // the window title as UTF-8 encoded string
|
||||
user_cursor bool // if true, user is expected to manage cursor image in SAPP_EVENTTYPE_UPDATE_CURSOR
|
||||
enable_clipboard bool // enable clipboard access, default is false
|
||||
clipboard_size int // max size of clipboard content in bytes
|
||||
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
|
||||
max_dropped_files int // max number of dropped files to process (default: 1)
|
||||
max_dropped_file_path_length int // max length in bytes of a dropped UTF-8 file path (default: 2048)
|
||||
/* backend-specific options */
|
||||
width int // the preferred width of the window / canvas
|
||||
height int // the preferred height of the window / canvas
|
||||
sample_count int // MSAA sample count
|
||||
swap_interval int // the preferred swap interval (ignored on some platforms)
|
||||
high_dpi bool // whether the rendering canvas is full-resolution on HighDPI displays
|
||||
fullscreen bool // whether the window should be created in fullscreen mode
|
||||
alpha bool // whether the framebuffer should have an alpha channel (ignored on some platforms)
|
||||
window_title &char // the window title as UTF-8 encoded string
|
||||
user_cursor bool // if true, user is expected to manage cursor image in SAPP_EVENTTYPE_UPDATE_CURSOR
|
||||
enable_clipboard bool // enable clipboard access, default is false
|
||||
clipboard_size int // max size of clipboard content in bytes
|
||||
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
|
||||
max_dropped_files int // max number of dropped files to process (default: 1)
|
||||
max_dropped_file_path_length int // max length in bytes of a dropped UTF-8 file path (default: 2048)
|
||||
// backend-specific options
|
||||
gl_force_gles2 bool // if true, setup GLES2/WebGL even if GLES3/WebGL2 is available
|
||||
win32_console_utf8 bool // if true, set the output console codepage to UTF-8
|
||||
win32_console_create bool // if true, attach stdout/stderr to a new console window
|
||||
win32_console_attach bool // if true, attach stdout/stderr to parent process
|
||||
win32_console_create bool // if true, attach stdout/stderr to a new console window
|
||||
win32_console_attach bool // if true, attach stdout/stderr to parent process
|
||||
html5_canvas_name &char // the name (id) of the HTML5 canvas element, default is "canvas"
|
||||
html5_canvas_resize bool // if true, the HTML5 canvas size is set to sapp_desc.width/height, otherwise canvas size is tracked
|
||||
html5_preserve_drawing_buffer bool // HTML5 only: whether to preserve default framebuffer content between frames
|
||||
html5_premultiplied_alpha bool // HTML5 only: whether the rendered pixels use premultiplied alpha convention
|
||||
html5_ask_leave_site bool // initial state of the internal html5_ask_leave_site flag (see sapp_html5_ask_leave_site())
|
||||
ios_keyboard_resizes_canvas bool // if true, showing the iOS keyboard shrinks the canvas
|
||||
/* V patches */
|
||||
__v_native_render bool // V patch to allow for native rendering
|
||||
// V patches
|
||||
__v_native_render bool // V patch to allow for native rendering
|
||||
}
|
||||
|
||||
pub struct Event {
|
||||
|
Reference in New Issue
Block a user