-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eff3724
commit fa62dac
Showing
2 changed files
with
0 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
--[[pod_format="raw",created="2024-04-03 04:05:08",modified="2024-04-03 04:21:29",revision=12]] | ||
{"elements":[{"type":"label","text":"mouse() returns all the atributes of the mouse."},{"type":"snippet","text":"mx, my, mb, mhs, mvs = mouse()\n-- mx: x position\n-- my: y position\n-- mb: the state of the mouse's buttons\n-- mhs: horizontal scrolling (-1, 0, or 1)\n-- mvs: vertical scrolling (-1, 0, or 1)"},{"type":"label","text":"Position is calculated relative to the\nupper left corrner of the project, windowed\nor un-windowed."},{"type":"demo","text":"function _draw()\n\tcls()\n\tmx, my = mouse()\n\tprint(mx..\" : \"..my,7)\nend"},{"type":"label","text":"The state of the mouse's button is \nread as a number.\n1 or 0b001 -> left click\n2 or 0b010 -> right click\n4 or 0b100 -> middle click"},{"type":"label","text":"This means that if we press the left\nand right mouse button at the same time,\nmb will read as 3."},{"type":"label","text":"We can use some binary opporations to\nselectively listen to a certain button."},{"type":"demo","text":"function _draw()\n\tcls()\n\tmx, my, mb = mouse()\n\tprint(mb)\n\tif (mb & 0b001 > 0) print(\"left\")\n\tif (mb & 0b010 > 0) print(\"right\")\n\tif (mb & 0b100 > 0) print(\"middle\")\nend"}],"metadata":{"authors":["kravohi"],"version":"0.4","page_title":"mouse()"}} |
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
--[[pod_format="raw",created="2024-04-03 03:48:02",modified="2024-04-03 03:57:53",revision=2]] | ||
{"elements":[{"type":"snippet","text":"rnd()\n--> returns a random number >= 0 and < 1.\n\nrnd(1.23) \n--> returns a random number >= 0 and < 1.23.\n\nrnd(-21) \n--> returns a random number > -21 and <= 0.\n\nrnd({1,23,34,56}) \n--> returns a random value from a given table."},{"type":"label","text":"to get a random integer, use flr(rnd(...))"},{"type":"snippet","text":"flr(rnd(2))\n--> will return 0 or 1\n\nflr(rnd(5)) - 2\n--> will return -2, -1, 0, 1, or 2."}],"metadata":{"version":"0.4","authors":["kravohi"],"page_title":"rnd()"}} |