@@ -15,27 +15,27 @@ proc main(): void =
1515 glfwWindowHint (GLFWContextVersionMinor , 6 )
1616 glfwWindowHint (GLFWOpenglForwardCompat , GLFW_TRUE )
1717 glfwWindowHint (GLFWOpenglProfile , GLFW_OPENGL_CORE_PROFILE )
18- glfwWindowHint (GLFWResizable , GLFW_TRUE )
18+ glfwWindowHint (GLFWResizable , GLFW_FALSE )
1919 # glfwWindowHint(GLFWDecorated, GLFW_FALSE) # setWindowAttrib
2020 # glfwWindowHint(GLFWFloating, GLFW_TRUE) # setWindowAttrib
2121 # glfwWindowHint(GLFWMouseButtonPassthrough, GLFW_TRUE) # setWindowAttrib
2222
23- let w : GLFWWindow = glfwCreateWindow (window_width, window_height, " critic Engine" , nil , nil )
23+ let window : GLFWWindow = glfwCreateWindow (window_width, window_height, " critic Engine" , nil , nil )
2424
25- w.setInputMode (GLFWCursorSpecial , GLFW_CURSOR_NORMAL )
26-
27- w.makeContextCurrent
25+ window.setInputMode (GLFWCursorSpecial , GLFW_CURSOR_NORMAL )
26+ window.makeContextCurrent ()
2827
28+ # additional info
2929 echo " Vulkan supported: " & $ glfwVulkanSupported ()
3030
3131 # Opengl
3232 doAssert glInit ()
3333 echo " OpenGL " & $ glVersionMajor & " ." & $ glVersionMinor
34- # IG
34+
35+ # additional ImGUI
3536 let context = igCreateContext ()
36- doAssert igGlfwInitForOpenGL (w , true )
37+ doAssert igGlfwInitForOpenGL (window , true )
3738 doAssert igOpenGL3Init ()
38-
3939 igStyleColorsCherry ()
4040
4141 var
@@ -44,6 +44,7 @@ proc main(): void =
4444 vao,
4545 ebo: uint32
4646 ]
47+ # shader:
4748 vertex: uint32
4849 fragment: uint32
4950 program: uint32
@@ -172,23 +173,23 @@ proc main(): void =
172173 glClearColor (33 f/ 255 , 33 f/ 255 , 33 f/ 255 , 1 f)
173174 glEnable (GL_DEPTH_TEST )
174175
175- while not w .windowShouldClose:
176- if w .getKey (GLFWKey .Left ) == GLFW_PRESS :
176+ while not window .windowShouldClose:
177+ if window .getKey (GLFWKey .Left ) == GLFW_PRESS :
177178 camera.position -= camera.right * 0.1
178- if w .getKey (GLFWKey .Right ) == GLFW_PRESS :
179+ if window .getKey (GLFWKey .Right ) == GLFW_PRESS :
179180 camera.position += camera.right * 0.1
180- if w .getKey (GLFWKey .Up ) == GLFW_PRESS :
181+ if window .getKey (GLFWKey .Up ) == GLFW_PRESS :
181182 camera.position += camera.front * 0.1 f
182- if w .getKey (GLFWKey .Down ) == GLFW_PRESS :
183+ if window .getKey (GLFWKey .Down ) == GLFW_PRESS :
183184 camera.position -= camera.front * 0.1 f
184185
185- if w .getKey (GLFWKey .W) == GLFW_PRESS :
186+ if window .getKey (GLFWKey .W) == GLFW_PRESS :
186187 camera.pitch += 0.5 f
187- if w .getKey (GLFWKey .S) == GLFW_PRESS :
188+ if window .getKey (GLFWKey .S) == GLFW_PRESS :
188189 camera.pitch -= 0.5 f
189- if w .getKey (GLFWKey .A) == GLFW_PRESS :
190+ if window .getKey (GLFWKey .A) == GLFW_PRESS :
190191 camera.yaw -= 0.5 f
191- if w .getKey (GLFWKey .D) == GLFW_PRESS :
192+ if window .getKey (GLFWKey .D) == GLFW_PRESS :
192193 camera.yaw += 0.5 f
193194 projectionMat = perspective (camera.zoom, window_width/ window_height, 0.1 f, 100.0 f)
194195 viewMat = camera.getViewMatrix ()
@@ -215,10 +216,10 @@ proc main(): void =
215216
216217 glBindVertexArray (0 )
217218
218- w .swapBuffers
219+ window .swapBuffers
219220 glfwPollEvents ()
220221
221- w .destroyWindow
222+ window .destroyWindow
222223 glfwTerminate ()
223224 glDeleteVertexArrays (1 , mesh.vao.addr )
224225 glDeleteBuffers (1 , mesh.vbo.addr )
0 commit comments