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:
parent
cf9498ef6b
commit
fb7ca56d87
@ -88,9 +88,7 @@ pub fn (mut ts TestSession) test() {
|
||||
}
|
||||
ts.files = remaining_files
|
||||
ts.benchmark.set_total_expected_steps(remaining_files.len)
|
||||
// QTODO
|
||||
//mut pool_of_test_runners := sync.new_pool_processor({
|
||||
mut pool_of_test_runners := sync.new_pool_processor(sync.PoolProcessorConfig{
|
||||
mut pool_of_test_runners := sync.new_pool_processor({
|
||||
callback: worker_trunner
|
||||
})
|
||||
// for handling messages across threads
|
||||
|
@ -185,6 +185,7 @@ fn main() {
|
||||
frame_fn: frame
|
||||
event_fn: on_event
|
||||
scale: 2
|
||||
//wait_events: true
|
||||
)
|
||||
game.init_game()
|
||||
go game.run() // Run the game loop in a new thread
|
||||
@ -396,6 +397,7 @@ fn parse_binary_tetro(t_ int) []Block {
|
||||
}
|
||||
|
||||
fn on_event(e &sapp.Event, mut game Game) {
|
||||
//println('code=$e.char_code')
|
||||
if e.typ == .key_down {
|
||||
game.key_down(e.key_code)
|
||||
}
|
||||
|
2
thirdparty/sokol/sokol_app.h
vendored
2
thirdparty/sokol/sokol_app.h
vendored
@ -1337,7 +1337,7 @@ _SOKOL_PRIVATE void _sapp_macos_init_keytable(void) {
|
||||
}
|
||||
|
||||
_SOKOL_PRIVATE void _sapp_run(const sapp_desc* desc) {
|
||||
puts("RUN");
|
||||
//puts("Sokol run()");
|
||||
_sapp_init_state(desc);
|
||||
_sapp_macos_init_keytable();
|
||||
[NSApplication sharedApplication];
|
||||
|
2
thirdparty/sokol/sokol_gfx.h
vendored
2
thirdparty/sokol/sokol_gfx.h
vendored
@ -8477,7 +8477,7 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) {
|
||||
|
||||
/*-- main Metal backend state and functions ----------------------------------*/
|
||||
_SOKOL_PRIVATE void _sg_setup_backend(const sg_desc* desc) {
|
||||
puts("METAL");
|
||||
puts("Sokol backend: Metal");
|
||||
/* assume already zero-initialized */
|
||||
SOKOL_ASSERT(desc);
|
||||
SOKOL_ASSERT(desc->mtl_device);
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user