Ver Fonte

Mouse events;

bjorn há 2 anos atrás
pai
commit
d99f961c9e

+ 35 - 0
api/lovr/callbacks/mousemoved.lua

@@ -0,0 +1,35 @@
+return {
+  tag = 'callbacks',
+  summary = 'Called when the mouse is moved.',
+  description = 'This callback is called when the mouse is moved.',
+  arguments = {
+    {
+      name = 'x',
+      type = 'number',
+      description = 'The new x position of the mouse.'
+    },
+    {
+      name = 'y',
+      type = 'number',
+      description = 'The new y position of the mouse.'
+    },
+    {
+      name = 'dx',
+      type = 'number',
+      description = 'The movement on the x axis since the last mousemove event.'
+    },
+    {
+      name = 'dy',
+      type = 'number',
+      description = 'The movement on the y axis since the last mousemove event.'
+    }
+  },
+  returns = {},
+  related = {
+    'lovr.mousepressed',
+    'lovr.mousereleased',
+    'lovr.system.getMouseX',
+    'lovr.system.getMouseY',
+    'lovr.system.getMousePosition'
+  }
+}

+ 31 - 0
api/lovr/callbacks/mousepressed.lua

@@ -0,0 +1,31 @@
+return {
+  tag = 'callbacks',
+  summary = 'Called when a mouse button is pressed.',
+  description = 'This callback is called when a mouse button is pressed.',
+  arguments = {
+    {
+      name = 'x',
+      type = 'number',
+      description = 'The x position of the mouse when the button was pressed.'
+    },
+    {
+      name = 'y',
+      type = 'number',
+      description = 'The y position of the mouse when the button was pressed.'
+    },
+    {
+      name = 'button',
+      type = 'number',
+      description = [[
+        The button that was pressed.  Will be 1 for the primary button, 2 for the secondary button,
+        or 3 for the middle mouse button.
+      ]]
+    }
+  },
+  returns = {},
+  related = {
+    'lovr.mousereleased',
+    'lovr.mousemoved',
+    'lovr.system.isMouseDown'
+  }
+}

+ 31 - 0
api/lovr/callbacks/mousereleased.lua

@@ -0,0 +1,31 @@
+return {
+  tag = 'callbacks',
+  summary = 'Called when a mouse button is released.',
+  description = 'This callback is called when a mouse button is released.',
+  arguments = {
+    {
+      name = 'x',
+      type = 'number',
+      description = 'The x position of the mouse when the button was released.'
+    },
+    {
+      name = 'y',
+      type = 'number',
+      description = 'The y position of the mouse when the button was released.'
+    },
+    {
+      name = 'button',
+      type = 'number',
+      description = [[
+        The button that was released.  Will be 1 for the primary button, 2 for the secondary button,
+        or 3 for the middle mouse button.
+      ]]
+    }
+  },
+  returns = {},
+  related = {
+    'lovr.mousepressed',
+    'lovr.mousemoved',
+    'lovr.system.isMouseDown'
+  }
+}