Skip to content

Commit

Permalink
add filled circle, fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Mar 10, 2021
1 parent e05a61a commit 15f8441
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 6 additions & 3 deletions docs/script-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Table of strings where you should set some script metadata shown in the UI.
A bunch of [game state](#statememory) variables
Example:
```
if state.time_level > 300 and state.theme == [THEME.DWELLING](#theme) then
if state.time_level > 300 and state.theme == THEME.DWELLING then
toast("Congratulations for lasting 5 seconds in Dwelling")
end
```
Expand Down Expand Up @@ -324,13 +324,16 @@ Converts a color to int to be used in drawing functions. Use values from `0..255
Draws a line on screen
### `draw_rect`
#### Params: `float x1, float y1, float x2, float y2, float thickness, float rounding, int color`
Draws rectangle on screen from top-left to bottom-right.
Draws a rectangle on screen from top-left to bottom-right.
### `draw_rect_filled`
#### Params: `float x1, float y1, float x2, float y2, float rounding, int color`
Draws rectangle on screen from top-left to bottom-right.
Draws a filled rectangle on screen from top-left to bottom-right.
### `draw_circle`
#### Params: `float x, float y, float radius, float thickness, int color`
Draws a circle on screen
### `draw_circle_filled`
#### Params: `float x, float y, float radius, int color`
Draws a filled circle on screen
### `draw_text`
#### Params: `float x, float y, string text, int color`
Draws text on screen
Expand Down
11 changes: 8 additions & 3 deletions src/injected/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Script::Script(std::string script, std::string file, bool enable)
/// A bunch of [game state](#statememory) variables
/// Example:
/// ```
/// if state.time_level > 300 and state.theme == [THEME.DWELLING](#theme) then
/// if state.time_level > 300 and state.theme == THEME.DWELLING then
/// toast("Congratulations for lasting 5 seconds in Dwelling")
/// end
/// ```
Expand Down Expand Up @@ -373,13 +373,13 @@ Script::Script(std::string script, std::string file, bool enable)
ImVec2 b = screenify({x2, y2});
drawlist->AddLine(a, b, color, thickness);
};
/// Draws rectangle on screen from top-left to bottom-right.
/// Draws a rectangle on screen from top-left to bottom-right.
lua["draw_rect"] = [this](float x1, float y1, float x2, float y2, float thickness, float rounding, ImU32 color) {
ImVec2 a = screenify({x1, y1});
ImVec2 b = screenify({x2, y2});
drawlist->AddRect(a, b, color, rounding, 15, thickness);
};
/// Draws rectangle on screen from top-left to bottom-right.
/// Draws a filled rectangle on screen from top-left to bottom-right.
lua["draw_rect_filled"] = [this](float x1, float y1, float x2, float y2, float rounding, ImU32 color) {
ImVec2 a = screenify({x1, y1});
ImVec2 b = screenify({x2, y2});
Expand All @@ -390,6 +390,11 @@ Script::Script(std::string script, std::string file, bool enable)
ImVec2 a = screenify({x, y});
drawlist->AddCircle(a, screenify(radius), color, 0, thickness);
};
/// Draws a filled circle on screen
lua["draw_circle_filled"] = [this](float x, float y, float radius, ImU32 color) {
ImVec2 a = screenify({x, y});
drawlist->AddCircleFilled(a, screenify(radius), color, 0);
};
/// Draws text on screen
lua["draw_text"] = [this](float x, float y, std::string text, ImU32 color) {
ImVec2 a = screenify({x, y});
Expand Down

0 comments on commit 15f8441

Please sign in to comment.