Skip to content

Commit

Permalink
added rnd(), a new input topic, and mouse() (#11)
Browse files Browse the repository at this point in the history
* test

* added rnd(), input topic, and mouse()

* fixing bad json pod conflicts

* fixing bad json pod conflits
  • Loading branch information
church-basement authored Apr 3, 2024
1 parent 472396f commit 812a45e
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion help_topics.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"elements":[{"text":"Here are our current help topics:","type":"label"},{"text":"Guides","ref":"topics/guides","type":"wiki_ref"},{"text":"Workspaces","ref":"topics/workspaces","type":"wiki_ref"},{"text":"API:","type":"label"},{"text":"Graphics","ref":"topics/graphics","type":"wiki_ref"},{"text":"Math","ref":"topics/math","type":"wiki_ref"},{"text":"Applications","ref":"topics/applications","type":"wiki_ref"}],"metadata":{"authors":["scrapSavage"],"version":"0.2","page_title":"Help topics"}}
{"metadata":{"authors":["scrapSavage"],"page_title":"Help topics","version":"0.2"},"elements":[{"type":"label","text":"Here are our current help topics:"},{"ref":"topics/guides","text":"Guides","type":"wiki_ref"},{"ref":"topics/workspaces","text":"Workspaces","type":"wiki_ref"},{"type":"label","text":"API:"},{"ref":"topics/graphics","text":"Graphics","type":"wiki_ref"},{"ref":"topics/math","text":"Math","type":"wiki_ref"},{"ref":"topics/applications","text":"Applications","type":"wiki_ref"},{"ref":"topics/input","text":"Input","type":"wiki_ref"}]}
Binary file added input/.info.pod
Binary file not shown.
1 change: 1 addition & 0 deletions input/mouse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"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()"}}
1 change: 1 addition & 0 deletions math/rnd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"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()"}}
2 changes: 1 addition & 1 deletion math/sqrt.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"elements":[{"type":"snippet","text":"sqrt(\n x -- any positive number\n)"},{"type":"label","text":"Returns the square root of any positive\nnumber."},{"type":"warning","text":"If 'x' is negative, this function\nwill return the value 'nan'!"},{"type":"label","text":"Here is a mathmatical equivalency.\nz = sqrt(z * z)"}],"metadata":{"authors":["kravohi"],"version":"0.4","page_title":"sqrt()"}}
{"metadata":{"version":"0.4","authors":["kravohi"],"page_title":"sqrt()"},"elements":[{"type":"snippet","text":"sqrt(\n x -- any positive number\n)"},{"type":"label","text":"Returns the square root of any positive\nnumber."},{"type":"warning","text":"If 'x' is negative, this function\nwill return the value 'nan'!"},{"type":"label","text":"Here is a mathmatical equivalency.\nz = sqrt(z * z)"}]}
1 change: 1 addition & 0 deletions topics/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"elements":[{"type":"label","text":"Here are our current documents:"},{"text":"mouse()","ref":"input/mouse","type":"wiki_ref"}],"metadata":{"authors":["kravohi"],"page_title":"Input","version":"0.4"}}
2 changes: 1 addition & 1 deletion topics/math.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"metadata":{"page_title":"Math","authors":["kravohi"],"version":"0.2"},"elements":[{"type":"label","text":"Here are our current documents:"},{"text":"atan2()","type":"wiki_ref","ref":"math/atan2"},{"text":"cos()","type":"wiki_ref","ref":"math/cos"},{"text":"max()","type":"wiki_ref","ref":"math/max"},{"text":"min()","type":"wiki_ref","ref":"math/min"},{"text":"mid()","type":"wiki_ref","ref":"math/mid"},{"text":"sin()","type":"wiki_ref","ref":"math/sin"},{"text":"sqrt()","type":"wiki_ref","ref":"math/sqrt"}]}
{"metadata":{"authors":["kravohi"],"version":"0.2","page_title":"Math"},"elements":[{"type":"label","text":"Here are our current documents:"},{"ref":"math/atan2","type":"wiki_ref","text":"atan2()"},{"ref":"math/cos","type":"wiki_ref","text":"cos()"},{"ref":"math/max","type":"wiki_ref","text":"max()"},{"ref":"math/min","type":"wiki_ref","text":"min()"},{"ref":"math/mid","type":"wiki_ref","text":"mid()"},{"ref":"math/rnd","type":"wiki_ref","text":"rnd()"},{"ref":"math/sin","type":"wiki_ref","text":"sin()"},{"ref":"math/sqrt","type":"wiki_ref","text":"sqrt()"}]}

0 comments on commit 812a45e

Please sign in to comment.