diff --git a/compiler/main.v b/compiler/main.v index 6b862e3157..638405fea2 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -400,7 +400,7 @@ void reload_so() { last = now; load_so("$so_name"); } - time__sleep_ms(500); + time__sleep_ms(400); } } ' ) diff --git a/examples/hot_code_reloading/bounce.v b/examples/hot_code_reloading/bounce.v index 9659348baf..9dde61f54d 100644 --- a/examples/hot_code_reloading/bounce.v +++ b/examples/hot_code_reloading/bounce.v @@ -27,17 +27,18 @@ fn main() { height := 300 mut game := &Game{ vg: 0 - dx: 3 - dy: 3 + dx: 1 + dy: 1 height: height width: width } mut window := glfw.create_window(glfw.WinCfg { - width: width, - height: height, - borderless: false, + width: width + height: height + borderless: false title: 'Hot code reloading demo' ptr: game + always_on_top: true }) //window.onkeydown(key_down) game.main_wnd = window @@ -60,13 +61,14 @@ fn main() { } } + const ( W = 50 ) [live] fn (ctx &Game) draw() { - ctx.vg.draw_rect(ctx.x, ctx.y, W, W, gx.rgb(0, 0, 255)) + ctx.vg.draw_rect(ctx.x, ctx.y, W, W, gx.rgb(255, 0, 0)) } fn (ctx mut Game) run() { @@ -80,9 +82,27 @@ fn (ctx mut Game) run() { ctx.dx = - ctx.dx } // Refresh - time.sleep_ms(30) + time.sleep_ms(17) glfw.post_empty_event() } } + + + + + + + + + + + + + + + + +//sdfsd + diff --git a/vlib/glfw/glfw.v b/vlib/glfw/glfw.v index af6cd10a05..cc46e3bb4d 100644 --- a/vlib/glfw/glfw.v +++ b/vlib/glfw/glfw.v @@ -26,6 +26,7 @@ const ( import const ( GLFW_RESIZABLE GLFW_DECORATED + GLFW_FLOATING ) import const ( @@ -102,6 +103,7 @@ struct WinCfg { is_modal int is_browser bool url string + always_on_top bool } // data *C.GLFWwindow @@ -161,6 +163,10 @@ pub fn create_window(c WinCfg) *Window { window_hint(GLFW_RESIZABLE, 0) window_hint(GLFW_DECORATED, 0) } + if c.always_on_top { + window_hint(GLFW_FLOATING, 1) + +} cwindow := C.glfwCreateWindow(c.width, c.height, c.title.str, 0, 0) # if (!cwindow) // if cwindow == 0