Skip to content

Commit a5f2030

Browse files
committed
Add minor wiki changes
Resolves #38, resolves #39, resolves #41
1 parent e242b7d commit a5f2030

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

library/evt.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ event = {
1313
--> This event is sent every time a key is pressed, and continuously re-sent if they key is held down. This event should be used if you want to have a key shortcut; The textinput event should be used instead if you want to handle text input / Unicode.<br>
1414
--> This event can be canceled<br>
1515
--> Arguments: key, scan, repeat, shift, ctrl, alt<br>
16-
-->> key is the key code, a number that is usually the ascii value for the key, but for non-printable characters it may be a high number. You can find a list of key codes here: https://wiki.libsdl.org/SDLKeycodeLookup<br>
17-
-->> scan is the scan code. This is a number that represents the physical location of a key on a keyboard. You can find a list of scan codes here: https://wiki.libsdl.org/SDLScancodeLookup<br>
18-
-->> repeat is a boolean that tells whether this is a key repeat event (sent every so often when the key is held down). You may want to ignore this event when it is just a key repeat event<br>
19-
-->> shift / ctrl / alt are booleans that will tell you whether those modifiers are currently held<br>
16+
-->> **key** is the key code. This is a number that represents the symbol that may be printed on a key on a keyboard. The relation of these numbers to physical keys varies wildly across systems and keyboard layouts. The interface API provides constants you can use to compare this with: you can find a list of key codes [here](https://github.com/The-Powder-Toy/The-Powder-Toy/blob/master/src/lua/LuaSDLKeys.h) (the ones starting with SDLK, for example, interface.SDLK_a)<br>
17+
-->> **scan** is the scan code. This is a number that represents the physical location of a key on a keyboard. You can find a list of scan codes here: https://wiki.libsdl.org/SDLScancodeLookup<br>
18+
-->> **repeat** is a boolean that tells whether this is a key repeat event (sent every so often when the key is held down). You may want to ignore this event when it is just a key repeat event<br>
19+
-->> **shift / ctrl / alt** are booleans that will tell you whether those modifiers are currently held<br>
2020
KEYPRESS = 2,
2121

2222
--### keyrelease<br>
@@ -41,31 +41,31 @@ event = {
4141
--> This event is sent whenever the mouse is clicked.<br>
4242
--> This event can be canceled<br>
4343
--> Arguments: x, y, button<br>
44-
-->> x and y will not be adjusted for the zoom window. See sim.adjustCoords for that. Coordinates may be outside of the simulation bounds (clicks outside the simulation area are still sent)<br>
45-
-->> button is the mouse button pressed. 1 is left click, 2 is middle click, 3 is right click. There may also be higher mouse buttons like 4 and 5.<br>
44+
-->> **x and **y** will not be adjusted for the zoom window. See sim.adjustCoords for that. Coordinates may be outside of the simulation bounds (clicks outside the simulation area are still sent)<br>
45+
-->> **button** is the mouse button pressed. 1 is left click, 2 is middle click, 3 is right click. There may also be higher mouse buttons like 4 and 5.<br>
4646
MOUSEDOWN = 4,
4747

4848
--### mouseup<br>
4949
--> This event is sent whenever the mouse is released. There are also other some special cases this event may be sent,<br>
5050
--> This event can be canceled (only when reason = 0)<br>
5151
--> Arguments: x, y, button, reason<br>
52-
-->> x, y, and button function the same as the mousedown event<br>
53-
-->> reason is a number that describes what type of mouseup event this is (basically, hacks we sent mouseup events on anyway). reason 0 is for normal mouseup events. reason 1 is used when another interface is opened and a blur event is sent. This is how tpt ensures that the mouse isn't "stuck" down forever if you release the mouse after opening another interface. reason 2 is used when the mouse moves inside or outside of the zoom window. This is how tpt cancels mouse drawing with zoom windows to ensure a big line isn't drawn across the screen. The normal reason = 0 event will still be sent later.<br>
52+
-->> **x**, **y**, and **button** function the same as the mousedown event<br>
53+
-->> **reason** is a number that describes what type of mouseup event this is (basically, hacks we sent mouseup events on anyway). reason 0 is for normal mouseup events. reason 1 is used when another interface is opened and a blur event is sent. This is how tpt ensures that the mouse isn't "stuck" down forever if you release the mouse after opening another interface. reason 2 is used when the mouse moves inside or outside of the zoom window. This is how tpt cancels mouse drawing with zoom windows to ensure a big line isn't drawn across the screen. The normal reason = 0 event will still be sent later.<br>
5454
MOUSEUP = 5,
5555

5656
--### mousemove<br>
5757
--> This event is sent every time the mouse is moved. It is only sent when the mouse is inside the tpt window, unless the mouse is held, in which case it can also be sent outside of the tpt window until the mouse is released. Coordinates from outside the tpt window bounds (including negative coordinates) can be sent in that case.<br>
5858
--> This event can be canceled<br>
5959
--> Arguments: x, y, dx, dy<br>
60-
-->> x and y are the mouse coordinates. dx and dy are the diff from the previous coordinates to the current ones.<br>
60+
-->> **x** and **y** are the mouse coordinates. **dx** and **dy** are the diff from the previous coordinates to the current ones.<br>
6161
MOUSEMOVE = 6,
6262

6363
--### mousewheel<br>
6464
--> This event is sent whenever the mousewheel is scrolled.<br>
6565
--> This event can be canceled<br>
6666
--> Arguments: x, y, d<br>
67-
-->> x and y are the mouse position where the wheel was scrolled<br>
68-
-->> d is the distance the mouse was scrolled. On nearly all mice this will be 1 or -1, but in certain situations it may be higher. You most likely want to treat higher values as 1 or -1 anyway. Horizontal scrolling is not supported at the moment, in the meantime d will be 0 for horizontal scrolling.<br>
67+
-->> **x** and **y** are the mouse position where the wheel was scrolled<br>
68+
-->> **d** is the distance the mouse was scrolled. On nearly all mice this will be 1 or -1, but in certain situations it may be higher. You most likely want to treat higher values as 1 or -1 anyway. Horizontal scrolling is not supported at the moment, in the meantime d will be 0 for horizontal scrolling.<br>
6969
MOUSEWHEEL = 7,
7070

7171
--### tick<br>

library/sim.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ simulation = {}
6868
--```
6969
--number[] sim.partNeighbors(number x, number y, number radius, [number type])
7070
--```
71+
--Returns an array of indices of particles that neighbour the given coordinates and match the given type (if it is specified). The resulting array does not contain the particle at the specified position.<br>
7172
---@param x integer
7273
---@param y integer
7374
---@param radius integer

0 commit comments

Comments
 (0)