From dd053d79b01e4be5018d49ce5f09f0a136b989f2 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sat, 12 Oct 2019 14:03:15 +1100 Subject: [PATCH] vlib/examples: fix gl/glfw/gg examples. rename init functions --- examples/hot_reload/bounce.v | 4 ++-- examples/hot_reload/graph.v | 2 +- examples/tetris/tetris.v | 2 +- vlib/gg/gg.v | 6 +++--- vlib/glfw/glfw.v | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/hot_reload/bounce.v b/examples/hot_reload/bounce.v index be1341fff5..6e74cdf3ed 100644 --- a/examples/hot_reload/bounce.v +++ b/examples/hot_reload/bounce.v @@ -22,7 +22,7 @@ mut: } fn main() { - glfw.init() + glfw.init_glfw() width := 600 height := 300 mut game := &Game{ @@ -43,7 +43,7 @@ fn main() { //window.onkeydown(key_down) game.main_wnd = window window.make_context_current() - gg.init() + gg.init_gg() game.gg = gg.new_context(gg.Cfg { width: width height: height diff --git a/examples/hot_reload/graph.v b/examples/hot_reload/graph.v index 8acc3019b5..7a4861ad49 100644 --- a/examples/hot_reload/graph.v +++ b/examples/hot_reload/graph.v @@ -18,7 +18,7 @@ struct Context { fn main() { os.clear() - glfw.init() + glfw.init_glfw() ctx:= &Context{ gg: gg.new_context(gg.Cfg { width: Size diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index be16c25825..d1717e7daa 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -124,7 +124,7 @@ struct Game { } fn main() { - glfw.init() + glfw.init_glfw() mut game := &Game{ gg: gg.new_context(gg.Cfg { width: WinWidth diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index 42246d7d05..8f5be04c49 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -25,8 +25,8 @@ pub fn vec2(x, y int) Vec2 { return res } -pub fn init() { - glfw.init() +pub fn init_gg() { + glfw.init_glfw() println(gl.TEXT_VERT) gl.init_glad() } @@ -78,7 +78,7 @@ pub fn new_context(cfg Cfg) &GG { always_on_top: cfg.always_on_top }) window.make_context_current() - init() + init_gg() } shader := gl.new_shader('simple') shader.use() diff --git a/vlib/glfw/glfw.v b/vlib/glfw/glfw.v index 2c0c43561d..3e104dd3aa 100644 --- a/vlib/glfw/glfw.v +++ b/vlib/glfw/glfw.v @@ -86,7 +86,7 @@ pub: // type clickpub fn pub fn (window * GLFWwindow, button, action, mods int) type clickpubfn fn (window voidptr, button, action, mods int) -pub fn init() { +pub fn init_glfw() { C.glfwInit() C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MAJOR, 3) C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MINOR, 3)