1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg: minor fixes

This commit is contained in:
Alexander Medvednikov
2020-06-04 19:57:13 +02:00
parent cf9498ef6b
commit fb7ca56d87
6 changed files with 14 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import sokol
import sokol.sapp
import sokol.sgl
import sokol.gfx
import gg.ft
type FNvoidptr1 fn(voidptr)
type FNvoidptr2 fn(voidptr,voidptr)
@@ -26,6 +27,7 @@ pub:
create_window bool
// window_user_ptr voidptr
window_title string
borderless_window bool
always_on_top bool
scale f32 = 1.0
bg_color gx.Color
@@ -34,7 +36,8 @@ pub:
event_fn FNvoidptr2 = voidptr(0)
cleanup_fn FNvoidptr1 = voidptr(0)
fail_fn FNFail = voidptr(0)
wait_events bool = false // set this to true for UIs, to save power
wait_events bool // set this to true for UIs, to save power
font_path string
}
pub struct GG {
@@ -47,6 +50,8 @@ pub mut:
config Config
}
pub struct Size { pub: width int height int }
fn gg_init_sokol_window(user_data voidptr) {
mut g := &GG(user_data)
desc := C.sg_desc{
@@ -186,6 +191,7 @@ pub fn (gg &GG) end() {
gfx.end_pass()
gfx.commit()
if gg.config.wait_events {
//println('gg: waiting')
wait_events()
}
}

View File

@@ -2,13 +2,13 @@ module sapp
pub struct C.sapp_desc {
pub:
init_cb fn() /* these are the user-provided callbacks without user data */
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(byteptr)
user_data voidptr /* these are the user-provided callbacks with user data */
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)