summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjussi2023-11-27 23:16:49 +0200
committerjussi2023-11-27 23:16:49 +0200
commit2b330bbadbeb35807b4831ab6275f6e2867029b5 (patch)
treeb32f979ef1dddaaf345e3ede94aefda067f60dbe /examples
parentb3a956cff204f30edd36a426e471168e7c396801 (diff)
downloadreilua-enhanced-2b330bbadbeb35807b4831ab6275f6e2867029b5.tar.gz
reilua-enhanced-2b330bbadbeb35807b4831ab6275f6e2867029b5.tar.bz2
reilua-enhanced-2b330bbadbeb35807b4831ab6275f6e2867029b5.zip
Experimental pen tablet events.
Diffstat (limited to 'examples')
-rw-r--r--examples/events/main.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/events/main.lua b/examples/events/main.lua
index f8f615d..28d63a3 100644
--- a/examples/events/main.lua
+++ b/examples/events/main.lua
@@ -64,6 +64,9 @@ local function keyName( key )
return "Unknown"
end
+local mousePos = { 0, 0 }
+local cursorMode = 1
+
function RL.event( event )
text = "Event: "..getEventType( event ).."\n"
@@ -126,6 +129,25 @@ function RL.event( event )
-- elseif event.type == RL.SDL_JOYBUTTONDOWN or event.type == RL.SDL_JOYBUTTONUP then
-- text = text.."which "..event.which.." Button: "..event.button.." State: "..event.state
-- end
+
+ -- Experimental GLFW pen tablet events.
+
+ -- if event.type == RL.GLFW_MOUSE_CURSOR_POS_EVENT then
+ -- mousePos = { event.x, event.y }
+ -- elseif event.type == RL.GLFW_PEN_TABLET_DATA_EVENT then
+ -- text = "x: "..event.x.." y: "..event.y.." pressure: "..event.pressure
+ -- text = text.."\nMouse Pos: "..mousePos[1]..", "..mousePos[2]
+
+ -- if cursorMode == 1 then
+ -- text = text.."\nMode: Pen"
+ -- elseif cursorMode == 2 then
+ -- text = text.."\nMode: Eraser"
+ -- end
+ -- elseif event.type == RL.GLFW_PEN_TABLET_CURSOR_EVENT then
+ -- cursorMode = event.identifier
+ -- elseif event.type == RL.GLFW_PEN_TABLET_PROXIMITY_EVENT then
+ -- print( event.state )
+ -- end
end
function RL.draw()