Difficult-Rocket/Difficult_Rocket/main.jl

40 lines
938 B
Julia
Raw Normal View History

2022-02-22 23:22:11 +08:00
#=
main:
- Julia version: 1.7.2
- Author: shenjack
- Date: 2022-02-19
=#
using GLFW
export GLFW__init__
function GLFW__init__()
# Create a window and its OpenGL context
2022-03-01 23:04:16 +08:00
window = GLFW.CreateWindow(1024, 768, "DR-GLFW test")
2022-02-22 23:22:11 +08:00
# Make the window's context current
GLFW.MakeContextCurrent(window)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 3)
2022-03-01 23:04:16 +08:00
println(GLFW.VulkanSupported())
glClear() = ccall(@eval(GLFW.GetProcAddress("glClear")), Cvoid, (Cuint,), 0x00004000)
GC.gc() # Force garbage collection so that improper reference management is more apparent via crashes
2022-02-22 23:22:11 +08:00
# Loop until the user closes the window
while !GLFW.WindowShouldClose(window)
# Render here
# Swap front and back buffers
GLFW.SwapBuffers(window)
# Poll for and process events
GLFW.PollEvents()
end
GLFW.DestroyWindow(window)
end