Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Aug 22, 2022
1 parent 9789cf4 commit e368c52
Show file tree
Hide file tree
Showing 19 changed files with 318 additions and 161 deletions.
2 changes: 1 addition & 1 deletion BuildMarkdownDocs/CodeBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ internal static CodeBlock FromXml(XElement element)

public override string ToString()
{
return $"```{Language}\n{Code}\n```";
return $"\n#### _{Language}_:\n```{Language}\n{Code}\n```";
}
}
}
4 changes: 2 additions & 2 deletions BuildMarkdownDocs/Example.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ internal static Example FromXml(XElement element)
value = elementChild.Value.Trim();
}

example.TextContent.Add(value);
example.TextContent.AddRange(value.Split('\n'));
}

return example;
}

public override string ToString()
{
return string.Join("\n\n", TextContent);
return "> " + string.Join("\n> ", TextContent) + "\n---";
}
}
}
15 changes: 15 additions & 0 deletions Docs/Api/Enumerations/Buttons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# `Buttons`


## Example Use

`Buttons.None`

## Possible Values

* `None`
* `Left`
* `Right`
* `Middle`
* `WheelUp`
* `WheelDown`
11 changes: 11 additions & 0 deletions Docs/Api/Enumerations/GamePadStick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `GamePadStick`


## Example Use

`GamePadStick.Left`

## Possible Values

* `Left`
* `Right`
11 changes: 11 additions & 0 deletions Docs/Api/Enumerations/MoveType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `MoveType`


## Example Use

`MoveType.Relative`

## Possible Values

* `Relative`
* `Absolute`
20 changes: 20 additions & 0 deletions Docs/Api/Input/GamePad.Reset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# `GamePad.Reset` ()


Reset the gamepad so the stick returns to the resting position (0,0)




## Examples

> Moves the left gamepad joystick halfway down and to the right, then resets after 500ms
>
> #### _lua_:
> ```lua
> GamePad.SimulateMove(0.5,0.5)
> SetTimeout(function()
> GamePad.Reset()
> end, 500)
> ```
---
18 changes: 10 additions & 8 deletions Docs/Api/Input/GamePad.Simulate.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ Simulate pressing or releasing (or both) gamepad buttons.

## Examples

Shows how to press "A" on the gamepad for 500ms, then release it.

```js
GamePad.Simulate(GamePadControl.A, PressState.Press);
setTimeout(function () {
GamePad.Simulate(GamePadControl.A, PressState.Release);
}, 500);
```
> Shows how to press "A" on the gamepad for 500ms, then release it.
>
> #### _js_:
> ```js
> GamePad.Simulate(GamePadControl.A, PressState.Press);
> setTimeout(function () {
> GamePad.Simulate(GamePadControl.A, PressState.Release);
> }, 500);
> ```
---
33 changes: 33 additions & 0 deletions Docs/Api/Input/GamePad.SimulateMove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `GamePad.SimulateMove` (`Double`, `Double`, `GamePadStick`)


Simulate moving a gamepad joystick


## Parameters

* **deltaX (`Double`)**

The fraction by which to move the stick forward (negative) or backward (positive)

* **deltaY (`Double`)**

The fraction by which to move the stick right (positive) or left (negative)

* **stick (`GamePadStick`)**

Which gamepad stick to move, either GamePadStick.Left (default) or .Right


## Examples

> Moves the left gamepad joystick halfway down and to the right, then resets after 500ms
>
> #### _lua_:
> ```lua
> GamePad.SimulateMove(0.5,0.5)
> SetTimeout(function()
> GamePad.Reset()
> end, 500)
> ```
---
38 changes: 21 additions & 17 deletions Docs/Api/Input/Keyboard.GetKeyDown.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,24 @@ You can find the keycodes in [../Enumerations/KeyboardKey.md](../Enumerations/Ke
True if the key is currently pressed down, false otherwise
## Examples

Shows how to show all keys currently pressed.

```lua
for keyName, key in pairs(KeyboardKey)do
if(Keyboard.GetKeyDown(key))then
Print(keyName, "is currently pressed")
end
end
```

Shows how to only simulate pressing "A" when shift is also held down. This allows binding to multiple keys, where one is the trigger and the rest of the inputs are checked in the script.

```js
if(Keyboard.GetKeyDown(KeyboardKey.Shift)) {
GamePad.Simulate(GamePadControl.A, PressState.Press);
}
```
> Shows how to show all keys currently pressed.
>
> #### _lua_:
> ```lua
> for keyName, key in pairs(KeyboardKey)do
> if(Keyboard.GetKeyDown(key))then
> Print(keyName, "is currently pressed")
> end
> end
> ```
---
> Shows how to only simulate pressing "A" when shift is also held down. This allows binding to multiple keys, where one is the trigger and the rest of the inputs are checked in the script.
>
> #### _js_:
> ```js
> if(Keyboard.GetKeyDown(KeyboardKey.Shift)) {
> GamePad.Simulate(GamePadControl.A, PressState.Press);
> }
> ```
---
13 changes: 0 additions & 13 deletions Docs/Api/Input/Keyboard.Simulate.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,3 @@ Simulate pressing or releasing (or both) keyboard keys.
Action to simulate


## Examples

TODO: Explain how to use this function in js

```js
//TODO: JS example
```

TODO: Explain how to use this function in Lua

```lua
--TODO: Lua example
```
17 changes: 17 additions & 0 deletions Docs/Api/Input/Mouse.Simulate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `Mouse.Simulate` (`Buttons`, `PressState`)


Simulate pressing or releasing (or both) mouse buttons.


## Parameters

* **button (`Buttons`)**

Button to simulate

* **pressState (`PressState`)**

Action to simulate


38 changes: 38 additions & 0 deletions Docs/Api/Input/Mouse.SimulateMove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# `Mouse.SimulateMove` (`Int32`, `Int32`, `MoveType`)


Simulate moving the mouse


## Parameters

* **x (`Int32`)**

X coordinate to move by/to

* **y (`Int32`)**

Y coordinate to move by/to

* **moveType (`MoveType`)**

Whether to move relative to the current cursor position (default) or to an absolute position on screen


## Examples

> Nudges the cursor 100 pixels to the left from where it is now.
>
> #### _js_:
> ```js
> Mouse.SimulateMove(-100,0)
> ```
---
> Moves the cursor to an absolute position on the screen.
>
> #### _lua_:
> ```lua
> Mouse.SimulateMove(1024,1050,MoveType.Absolute)
> ```
---
32 changes: 17 additions & 15 deletions Docs/Api/Logic/ClearInterval.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ Cancels an interval previously established by calling SetInterval()

## Examples

Shows how to count up to 3 every second and then stop by using ClearInterval();

```js
var count = 0;
var intervalId;

intervalId = setInterval(() => {
Print(count++);

if(count == 3)
clearInterval(intervalId);
}, 1000);

Print(intervalId);
```
> Shows how to count up to 3 every second and then stop by using ClearInterval();
>
> #### _js_:
> ```js
> var count = 0;
> var intervalId;
>
> intervalId = setInterval(() => {
> Print(count++);
>
> if(count == 3)
> clearInterval(intervalId);
> }, 1000);
>
> Print(intervalId);
> ```
---
24 changes: 13 additions & 11 deletions Docs/Api/Logic/ClearTimeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ Cancels a timeout previously established by calling SetTimeout()

## Examples

Shows how to set and immediately cancel a timeout.

```js
var timeoutID = setTimeout(() => {
Print("You shouldn't see this because the timeout will have been cancelled!");
}, 1000);

Print(timeoutID);

clearTimeout(timeoutID);
```
> Shows how to set and immediately cancel a timeout.
>
> #### _js_:
> ```js
> var timeoutID = setTimeout(() => {
> Print("You shouldn't see this because the timeout will have been cancelled!");
> }, 1000);
>
> Print(timeoutID);
>
> clearTimeout(timeoutID);
> ```
---
46 changes: 24 additions & 22 deletions Docs/Api/Logic/SetDelayedFunctions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ The first function is executed immediately.

## Examples

Shows how to count down from 3 and execute a command using Lua.

```lua
SetDelayedFunctions(
1000,
function ()
Print("Aborting in 3 second...")
end,
function ()
Print("Three")
end,
function ()
Print("Two")
end,
function ()
Print("One")
end,
function ()
App.Command("abort")
end
)
```
> Shows how to count down from 3 and execute a command using Lua.
>
> #### _lua_:
> ```lua
> SetDelayedFunctions(
> 1000,
> function ()
> Print("Aborting in 3 second...")
> end,
> function ()
> Print("Three")
> end,
> function ()
> Print("Two")
> end,
> function ()
> Print("One")
> end,
> function ()
> App.Command("abort")
> end
> )
> ```
---
Loading

0 comments on commit e368c52

Please sign in to comment.