-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update FensterB with new mouse function
- Loading branch information
1 parent
b4e0504
commit 4aa98d0
Showing
4 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import fenstim | ||
|
||
var | ||
app = init(Fenster, "Mouse Buttons test", 800, 600) | ||
lastMouseX, lastMouseY = -1 | ||
lastClickStates: array[5, int] | ||
lastHoldStates: array[3, int] | ||
|
||
while app.loop and app.keys[27] == 0: | ||
let (mouseX, mouseY, clickStates, holdStates) = app.mouse | ||
|
||
let positionChanged = [mouseX, mouseY] != [lastMouseX, lastMouseY] | ||
let clickChanged = clickStates != lastClickStates | ||
let holdChanged = holdStates != lastHoldStates | ||
|
||
if positionChanged or clickChanged or holdChanged: | ||
echo "Mouse position: (", mouseX, ", ", mouseY, ")" | ||
echo "Click states: ", clickStates | ||
echo "Hold states: ", holdStates | ||
|
||
echo "--------------------" | ||
|
||
lastMouseX = mouseX | ||
lastMouseY = mouseY | ||
lastClickStates = clickStates | ||
lastHoldStates = holdStates | ||
|
||
app.close |
Submodule fensterb
updated
12 files
+4 −1 | README.md | |
+0 −101 | examples/input-c/main.c | |
+0 −15 | examples/minimal-c/Makefile | |
+0 −57 | examples/minimal-c/main.c | |
+0 −0 | examples/mousebuttons-c/Makefile | |
+62 −0 | examples/mousebuttons-c/main.c | |
+0 −15 | examples/sound-c/Makefile | |
+0 −75 | examples/sound-c/main.c | |
+11 −1 | src/fenster/fenster.h | |
+8 −18 | src/fenster/fenster_linux.h | |
+13 −6 | src/fenster/fenster_mac.h | |
+13 −6 | src/fenster/fenster_windows.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters