Skip to content

Commit

Permalink
Merge pull request #43 from treeform/mine
Browse files Browse the repository at this point in the history
Some X11 Stuff.
  • Loading branch information
treeform authored Jan 10, 2022
2 parents 720503a + 69301b2 commit 4a803ee
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 62 deletions.
69 changes: 69 additions & 0 deletions examples/property_changes.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import opengl, windy, os

let window = newWindow("Windy Properties", ivec2(1280, 800))

window.makeContextCurrent()
loadExtensions()

proc display() =
glClear(GL_COLOR_BUFFER_BIT)
# Your OpenGL display code here
window.swapBuffers()

while not window.closeRequested:
display()

sleep(100)

pollEvents()

# Window will block changing size.
window.size = ivec2(300, 400)
doAssert window.size == ivec2(300, 400)

# Not all sizes are valid, window try to go max it can.
window.size = ivec2(300, 30000)
doAssert window.size.y != 30000 # You can't get height 30000 even if you ask.
doAssert window.size != ivec2(300, 400)

# Change size back.
window.size = ivec2(300, 400)
doAssert window.size == ivec2(300, 400)

window.pos = ivec2(200, 100)
doAssert window.pos == ivec2(200, 100)

window.pos = ivec2(-9000, 100)
when defined(windows):
# On Windows it is possible to set window to invalid locations.
doAssert window.pos.x == -9000
else:
doAssert window.pos.x != -9000
doAssert window.pos != ivec2(200, 100)

window.maximized = false
doAssert not window.maximized

window.maximized = true
doAssert window.maximized

window.maximized = false
doAssert not window.maximized

window.minimized = false
doAssert not window.minimized

window.minimized = true
doAssert window.minimized

window.fullscreen = false
doAssert not window.fullscreen

window.fullscreen = true
doAssert window.fullscreen

window.fullscreen = false
doAssert not window.fullscreen

echo "SUCESS!"
quit()
Loading

0 comments on commit 4a803ee

Please sign in to comment.