Skip to content

Commit 8fec4ce

Browse files
committed
gg: add more documentation comments for gg.Config (the parameters of gg.start and gg.new_context)
1 parent cadec97 commit 8fec4ce

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

vlib/gg/gg.c.v

+34-34
Original file line numberDiff line numberDiff line change
@@ -49,63 +49,63 @@ pub mut:
4949

5050
pub struct Config {
5151
pub:
52-
width int
53-
height int
54-
retina bool
55-
resizable bool
56-
user_data voidptr
57-
font_size int
58-
create_window bool
52+
width int // desired start width of the window
53+
height int // desired start height of the window
54+
retina bool // TODO: implement or deprecate
55+
resizable bool // TODO: implement or deprecate
56+
user_data voidptr // a custom pointer to the application data/instance
57+
font_size int // TODO: implement or deprecate
58+
create_window bool // TODO: implement or deprecate
5959
// window_user_ptr voidptr
60-
window_title string
60+
window_title string // the desired title of the window
6161
html5_canvas_name string = 'canvas'
62-
borderless_window bool
63-
always_on_top bool
64-
bg_color gx.Color
65-
init_fn FNCb = unsafe { nil }
66-
frame_fn FNCb = unsafe { nil }
62+
borderless_window bool // TODO: implement or deprecate
63+
always_on_top bool // TODO: implement or deprecate
64+
bg_color gx.Color // The background color of the window. By default, the first thing gg does in ctx.begin(), is clear the whole buffer with that color.
65+
init_fn FNCb = unsafe { nil } // Called once, after Sokol has finished its setup. Some gg and Sokol functions have to be called *in this* callback, or after this callback, but not before
66+
frame_fn FNCb = unsafe { nil } // Called once per frame, usually 60 times a second (depends on swap_interval). See also https://dri.freedesktop.org/wiki/ConfigurationOptions/#synchronizationwithverticalrefreshswapintervals
6767
native_frame_fn FNCb = unsafe { nil }
68-
cleanup_fn FNCb = unsafe { nil }
69-
fail_fn FNFail = unsafe { nil }
68+
cleanup_fn FNCb = unsafe { nil } // Called once, after Sokol determines that the application is finished/closed. Put your app specific cleanup/free actions here.
69+
fail_fn FNFail = unsafe { nil } // Called once per Sokol error/log message. TODO: currently it does nothing with latest Sokol, reimplement using Sokol's new sapp_logger APIs.
7070
//
71-
event_fn FNEvent = unsafe { nil }
72-
on_event FNEvent2 = unsafe { nil }
73-
quit_fn FNEvent = unsafe { nil }
71+
event_fn FNEvent = unsafe { nil } // Called once per each user initiated event, received by Sokol/GG.
72+
on_event FNEvent2 = unsafe { nil } // Called once per each user initiated event, received by Sokol/GG. Same as event_fn, just the parameter order is different. TODO: deprecate this, in favor of event_fn
73+
quit_fn FNEvent = unsafe { nil } // Called when the user closes the app window.
7474
//
75-
keydown_fn FNKeyDown = unsafe { nil }
76-
keyup_fn FNKeyUp = unsafe { nil }
77-
char_fn FNChar = unsafe { nil }
75+
keydown_fn FNKeyDown = unsafe { nil } // Called once per key press, no matter how long the key is held down. Note that here you can access the scan code/physical key, but not the logical character.
76+
keyup_fn FNKeyUp = unsafe { nil } // Called once per key press, when the key is released.
77+
char_fn FNChar = unsafe { nil } // Called once per character (after the key is pressed down, and then released). Note that you can access the character/utf8 rune here, not just the scan code.
7878
//
79-
move_fn FNMove = unsafe { nil }
80-
click_fn FNClick = unsafe { nil }
81-
unclick_fn FNUnClick = unsafe { nil }
82-
leave_fn FNEvent = unsafe { nil }
83-
enter_fn FNEvent = unsafe { nil }
84-
resized_fn FNEvent = unsafe { nil }
85-
scroll_fn FNEvent = unsafe { nil }
79+
move_fn FNMove = unsafe { nil } // Called while the mouse/touch point is moving.
80+
click_fn FNClick = unsafe { nil } // Called once when the mouse/touch button is clicked.
81+
unclick_fn FNUnClick = unsafe { nil } // Called once when the mouse/touch button is released.
82+
leave_fn FNEvent = unsafe { nil } // Called once when the mouse/touch point leaves the window.
83+
enter_fn FNEvent = unsafe { nil } // Called once when the mouse/touch point enters again the window.
84+
resized_fn FNEvent = unsafe { nil } // Called once when the window has changed its size.
85+
scroll_fn FNEvent = unsafe { nil } // Called while the user is scrolling. The direction of scrolling is indicated by either 1 or -1.
8686
// wait_events bool // set this to true for UIs, to save power
87-
fullscreen bool
87+
fullscreen bool // set this to true, if you want your window to start in fullscreen mode (suitable for games/demos/screensavers)
8888
scale f32 = 1.0
89-
sample_count int
89+
sample_count int // bigger values usually have performance impact, but can produce smoother/antialiased lines, if you draw lines or polygons (2 is usually good enough)
9090
swap_interval int = 1 // 1 = 60fps, 2 = 30fps etc. The preferred swap interval (ignored on some platforms)
9191
// ved needs this
9292
// init_text bool
9393
font_path string
9494
custom_bold_font_path string
95-
ui_mode bool // refreshes only on events to save CPU usage
95+
ui_mode bool // refreshes only on events to save CPU usage
9696
// font bytes for embedding
9797
font_bytes_normal []u8
9898
font_bytes_bold []u8
9999
font_bytes_mono []u8
100100
font_bytes_italic []u8
101-
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
101+
native_rendering bool // Cocoa on macOS/iOS, GDI+ on Windows
102102
// drag&drop
103103
enable_dragndrop bool // enable file dropping (drag'n'drop), default is false
104104
max_dropped_files int = 1 // max number of dropped files to process (default: 1)
105105
max_dropped_file_path_length int = 2048 // max length in bytes of a dropped UTF-8 file path (default: 2048)
106106
//
107-
min_width int
108-
min_height int
107+
min_width int // desired minimum width of the window
108+
min_height int // desired minimum height of the window
109109
}
110110

111111
@[heap]

0 commit comments

Comments
 (0)