gg: fn (data voidptr, e &Event) for events, allows methods

This commit is contained in:
Alexander Medvednikov 2023-11-25 01:19:39 +03:00
parent fc69b2fdb1
commit 399af6768d
3 changed files with 9 additions and 4 deletions

View File

@ -417,8 +417,8 @@ Run
v -d use_openssl -o blog -prod . && strip ./blog
```
This will result in a ~400KB binary. `-d use_openssl` tells vweb to link to OpenSSL. Without this flag mbedtls will be embedded, and the
binary size will increase to ~700KB.
This will result in a ~400KB binary. `-d use_openssl` tells vweb to link to OpenSSL.
Without this flag mbedtls will be embedded, and the binary size will increase to ~700KB.
### To be continued...

View File

@ -70,8 +70,9 @@ pub:
cleanup_fn FNCb = unsafe { nil }
fail_fn FNFail = unsafe { nil }
//
event_fn FNEvent = unsafe { nil }
quit_fn FNEvent = unsafe { nil }
event_fn FNEvent = unsafe { nil }
on_event FNEvent2 = unsafe { nil }
quit_fn FNEvent = unsafe { nil }
//
keydown_fn FNKeyDown = unsafe { nil }
keyup_fn FNKeyUp = unsafe { nil }
@ -353,6 +354,8 @@ fn gg_event_fn(ce voidptr, user_data voidptr) {
}
if ctx.config.event_fn != unsafe { nil } {
ctx.config.event_fn(e, ctx.config.user_data)
} else if ctx.config.on_event != unsafe { nil } {
ctx.config.on_event(ctx.config.user_data, e)
}
match e.typ {
.mouse_move {

View File

@ -9,6 +9,8 @@ pub type FNCb = fn (data voidptr)
pub type FNEvent = fn (e &Event, data voidptr)
pub type FNEvent2 = fn (data voidptr, e &Event)
pub type FNFail = fn (msg string, data voidptr)
pub type FNKeyDown = fn (c KeyCode, m Modifier, data voidptr)