vlib/examples: fix gl/glfw/gg examples. rename init functions

pull/2301/head
joe-conigliaro 2019-10-12 14:03:15 +11:00 committed by Alexander Medvednikov
parent b107b4f1e5
commit dd053d79b0
5 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -124,7 +124,7 @@ struct Game {
}
fn main() {
glfw.init()
glfw.init_glfw()
mut game := &Game{
gg: gg.new_context(gg.Cfg {
width: WinWidth

View File

@ -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()

View File

@ -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)