mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vlib/examples: fix gl/glfw/gg examples. rename init functions
This commit is contained in:
parent
b107b4f1e5
commit
dd053d79b0
@ -22,7 +22,7 @@ mut:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
glfw.init()
|
glfw.init_glfw()
|
||||||
width := 600
|
width := 600
|
||||||
height := 300
|
height := 300
|
||||||
mut game := &Game{
|
mut game := &Game{
|
||||||
@ -43,7 +43,7 @@ fn main() {
|
|||||||
//window.onkeydown(key_down)
|
//window.onkeydown(key_down)
|
||||||
game.main_wnd = window
|
game.main_wnd = window
|
||||||
window.make_context_current()
|
window.make_context_current()
|
||||||
gg.init()
|
gg.init_gg()
|
||||||
game.gg = gg.new_context(gg.Cfg {
|
game.gg = gg.new_context(gg.Cfg {
|
||||||
width: width
|
width: width
|
||||||
height: height
|
height: height
|
||||||
|
@ -18,7 +18,7 @@ struct Context {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
os.clear()
|
os.clear()
|
||||||
glfw.init()
|
glfw.init_glfw()
|
||||||
ctx:= &Context{
|
ctx:= &Context{
|
||||||
gg: gg.new_context(gg.Cfg {
|
gg: gg.new_context(gg.Cfg {
|
||||||
width: Size
|
width: Size
|
||||||
|
@ -124,7 +124,7 @@ struct Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
glfw.init()
|
glfw.init_glfw()
|
||||||
mut game := &Game{
|
mut game := &Game{
|
||||||
gg: gg.new_context(gg.Cfg {
|
gg: gg.new_context(gg.Cfg {
|
||||||
width: WinWidth
|
width: WinWidth
|
||||||
|
@ -25,8 +25,8 @@ pub fn vec2(x, y int) Vec2 {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init_gg() {
|
||||||
glfw.init()
|
glfw.init_glfw()
|
||||||
println(gl.TEXT_VERT)
|
println(gl.TEXT_VERT)
|
||||||
gl.init_glad()
|
gl.init_glad()
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ pub fn new_context(cfg Cfg) &GG {
|
|||||||
always_on_top: cfg.always_on_top
|
always_on_top: cfg.always_on_top
|
||||||
})
|
})
|
||||||
window.make_context_current()
|
window.make_context_current()
|
||||||
init()
|
init_gg()
|
||||||
}
|
}
|
||||||
shader := gl.new_shader('simple')
|
shader := gl.new_shader('simple')
|
||||||
shader.use()
|
shader.use()
|
||||||
|
@ -86,7 +86,7 @@ pub:
|
|||||||
// type clickpub fn pub fn (window * GLFWwindow, button, action, mods int)
|
// type clickpub fn pub fn (window * GLFWwindow, button, action, mods int)
|
||||||
type clickpubfn fn (window voidptr, button, action, mods int)
|
type clickpubfn fn (window voidptr, button, action, mods int)
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init_glfw() {
|
||||||
C.glfwInit()
|
C.glfwInit()
|
||||||
C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MAJOR, 3)
|
C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MAJOR, 3)
|
||||||
C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MINOR, 3)
|
C.glfwWindowHint(C.GLFW_CONTEXT_VERSION_MINOR, 3)
|
||||||
|
Loading…
Reference in New Issue
Block a user