Initial wrapper commit
This commit is contained in:
parent
427ce66139
commit
d270e2b9fb
14 changed files with 5188 additions and 23 deletions
41
examples/draganddrop.nim
Normal file
41
examples/draganddrop.nim
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import staticglfw
|
||||
import opengl
|
||||
|
||||
# Init GLFW
|
||||
if init() == 0:
|
||||
raise newException(Exception, "Failed to Initialize GLFW")
|
||||
|
||||
# Open window.
|
||||
var window = createWindow(800, 600, "GLFW3 WINDOW", nil, nil)
|
||||
# Connect the GL context.
|
||||
window.makeContextCurrent()
|
||||
# This must be called to make any GL function work
|
||||
loadExtensions()
|
||||
|
||||
proc dropCallback(window: Window, count: cint, paths: cstringArray) {.cdecl.} =
|
||||
echo "dropCallback"
|
||||
for i in 0 ..< count:
|
||||
echo paths[i]
|
||||
|
||||
window.setDropCallback(dropCallback)
|
||||
|
||||
# Run while window is open.
|
||||
while windowShouldClose(window) == 0:
|
||||
|
||||
# Draw red color screen.
|
||||
glClearColor(1, 0, 0, 1)
|
||||
glClear(GL_COLOR_BUFFER_BIT)
|
||||
|
||||
# Swap buffers (this will display the red color)
|
||||
window.swapBuffers()
|
||||
|
||||
# Check for events.
|
||||
pollEvents()
|
||||
# If you get ESC key quit.
|
||||
if window.getKey(KEY_ESCAPE) == 1:
|
||||
window.setWindowShouldClose(1)
|
||||
|
||||
# Destroy the window.
|
||||
window.destroyWindow()
|
||||
# Exit GLFW.
|
||||
terminate()
|
||||
|
|
@ -1 +1,44 @@
|
|||
## Include an example on how to use your library
|
||||
import staticglfw
|
||||
import opengl
|
||||
|
||||
# Init GLFW
|
||||
if init() == 0:
|
||||
raise newException(Exception, "Failed to Initialize GLFW")
|
||||
|
||||
# Open window.
|
||||
var window = createWindow(800, 600, "GLFW3 WINDOW", nil, nil)
|
||||
# Connect the GL context.
|
||||
window.makeContextCurrent()
|
||||
# This must be called to make any GL function work
|
||||
loadExtensions()
|
||||
|
||||
let monitor = getPrimaryMonitor()
|
||||
|
||||
var count: cint
|
||||
let vids = monitor.getVideoModes(count.addr)
|
||||
echo count
|
||||
for i in 0..<count:
|
||||
echo vids[i]
|
||||
|
||||
|
||||
|
||||
# Run while window is open.
|
||||
while windowShouldClose(window) == 0:
|
||||
|
||||
# Draw red color screen.
|
||||
glClearColor(1, 0, 0, 1)
|
||||
glClear(GL_COLOR_BUFFER_BIT)
|
||||
|
||||
# Swap buffers (this will display the red color)
|
||||
window.swapBuffers()
|
||||
|
||||
# Check for events.
|
||||
pollEvents()
|
||||
# If you get ESC key quit.
|
||||
if window.getKey(KEY_ESCAPE) == 1:
|
||||
window.setWindowShouldClose(1)
|
||||
|
||||
# Destroy the window.
|
||||
window.destroyWindow()
|
||||
# Exit GLFW.
|
||||
terminate()
|
||||
|
|
|
|||
2
examples/nim.cfg
Normal file
2
examples/nim.cfg
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
--path:"../src/"
|
||||
--passL:"-lm -pthread -lpthread"
|
||||
Loading…
Add table
Add a link
Reference in a new issue