-
Notifications
You must be signed in to change notification settings - Fork 4
Change script engine to use Sol2 instead of LuaBridge #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
addictgamer
wants to merge
11
commits into
master
Choose a base branch
from
sol2-merge
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
74b2147
* Added sol2 header
addictgamer 3463134
* Changed Script engine implementation from LuaBridge to Sol2.
addictgamer ef125fb
Merge remote-tracking branch 'origin/master' into sol2-merge
addictgamer 2936844
* Fixed compilation issues
addictgamer 6f8c74a
* Fixed MSVC linker failing with LTCG enabled because it's somehow r…
addictgamer f2b5315
* Use const reference for WideVector in shoot function.
addictgamer 5b9b959
Merge branch 'sol2-merge' of github.com:TurningWheel/Spacepunk into s…
addictgamer 13f8285
* Fixed frame buttons not dispatching their script properly.
addictgamer 1cff0c9
Update VS2017 project
SheridanR 1f0326d
Merge branch 'master' into sol2-merge
SheridanR 07ea35a
Update VS2017 project
SheridanR File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include <assert.h> | ||
|
|
||
| #define GLM_FORCE_RADIANS | ||
| #include <glm/vec4.hpp> | ||
|
|
||
|
|
@@ -58,7 +60,7 @@ class Button { | |
| const bool isHighlighted() const { return highlighted; } | ||
| const bool isDisabled() const { return disabled; } | ||
| const style_t getStyle() const { return style; } | ||
| Script::Args& getParams() { return params; } | ||
| const Script::Args& getParams() const { return params; } | ||
|
|
||
| void setBorder(const int _border) { border = _border; } | ||
| void setPos(const int x, const int y) { size.x = x; size.y = y; } | ||
|
|
@@ -73,23 +75,43 @@ class Button { | |
| void setStyle(const style_t _style) { style = _style; } | ||
| void setPressed(const bool _pressed) { reallyPressed = _pressed; } | ||
|
|
||
| template<typename T> | ||
| void addParam(T param) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is way better, kudos. |
||
| { | ||
| if (nullptr == parent) | ||
| { | ||
| assert(0); | ||
| return; | ||
| } | ||
|
|
||
| Script* scripter = parent->getScriptEngine(); | ||
| if (nullptr == scripter) | ||
| { | ||
| assert(0); | ||
| return; | ||
| } | ||
|
|
||
| scripter->addParam(param, params); | ||
| } | ||
|
|
||
| private: | ||
| Frame* parent = nullptr; // parent frame | ||
|
|
||
| String name; // internal button name | ||
| String text; // button text, if any | ||
| String icon; // icon, if any (supersedes text content) | ||
| String tooltip; // if empty, button has no tooltip; otherwise, it does | ||
| Script::Args params; // optional function parameters to use when the button function is called | ||
| int border = 3; // size of the button border in pixels | ||
| Rect<int> size; // size and position of the button within its parent frame | ||
| bool pressed = false; // button pressed state | ||
| bool reallyPressed = false; // the "actual" button state, pre-mouse process | ||
| bool highlighted = true; // true if mouse is hovering over button; false otherwise | ||
| glm::vec4 color; // the button's color | ||
| glm::vec4 textColor; // text color | ||
| style_t style = STYLE_NORMAL; // button style | ||
| bool disabled=false; // if true, the button is invisible and unusable | ||
| Uint32 highlightTime = 0; // records the time since the button was highlighted | ||
| Image* iconImg = nullptr; // the icon image | ||
| Frame* parent = nullptr; // parent frame | ||
|
|
||
| String name; // internal button name | ||
| String text; // button text, if any | ||
| String icon; // icon, if any (supersedes text content) | ||
| String tooltip; // if empty, button has no tooltip; otherwise, it does | ||
| //std::vector<sol::object> params; // optional function parameters to use when the button function is called. | ||
| Script::Args params; // optional function parameters to use when the button function is called. | ||
| int border = 3; // size of the button border in pixels | ||
| Rect<int> size; // size and position of the button within its parent frame | ||
| bool pressed = false; // button pressed state | ||
| bool reallyPressed = false; // the "actual" button state, pre-mouse process | ||
| bool highlighted = true; // true if mouse is hovering over button; false otherwise | ||
| glm::vec4 color; // the button's color | ||
| glm::vec4 textColor; // text color | ||
| style_t style = STYLE_NORMAL; // button style | ||
| bool disabled=false; // if true, the button is invisible and unusable | ||
| Uint32 highlightTime = 0; // records the time since the button was highlighted | ||
| Image* iconImg = nullptr; // the icon image | ||
| }; | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for a first pass but if these expose functions could be members of their respective classes (ie BBox::exposeToScript() instead of Script::exposeBBox()) it would be way better.