feat(ui): add ui plugin with button management#46
Merged
Conversation
…ing mouse position
Closed
ripel2
approved these changes
Nov 9, 2024
MasterLaplace
pushed a commit
that referenced
this pull request
Dec 6, 2024
I've added a way to click on a collider and update its state (for texture). It also use given callback. Component: - `Button`: represents a clickable entity. Said entity should have `BoxCollider2D`, `Transform` and `Sprite2D` to work properly System: - `UpdateButtonState`: update `Button`s states and add TemporaryComponent `ES::Plugin::Tools::HasChanged<ES::Plugin::UI::Component::Button>` if state have changed - `UpdateButtonTexture`: if states have changed, it will update `Button`'s texture or color - `ButtonClick`: call `onClick` function attribute if button have changed from state pressed to hover I've also added other plugins and tools: - `HasChanged` (Plugin `Tools`): used to tell that a component has changed (should work with temporary component) - `Rect` (Plugin `Math`): struct to store data of a rectange (size and pos) - `QuaternionToEuler` (Plugin `Math`): utility function to convert a quaternion to euler angles (used to rotate a 2DTexture) - `Color` (Plugin `Colors`): struct representing a color using RGBA. Contains already many default colors --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
MasterLaplace
pushed a commit
that referenced
this pull request
Dec 6, 2024
I've added a way to click on a collider and update its state (for texture). It also use given callback. Component: - `Button`: represents a clickable entity. Said entity should have `BoxCollider2D`, `Transform` and `Sprite2D` to work properly System: - `UpdateButtonState`: update `Button`s states and add TemporaryComponent `ES::Plugin::Tools::HasChanged<ES::Plugin::UI::Component::Button>` if state have changed - `UpdateButtonTexture`: if states have changed, it will update `Button`'s texture or color - `ButtonClick`: call `onClick` function attribute if button have changed from state pressed to hover I've also added other plugins and tools: - `HasChanged` (Plugin `Tools`): used to tell that a component has changed (should work with temporary component) - `Rect` (Plugin `Math`): struct to store data of a rectange (size and pos) - `QuaternionToEuler` (Plugin `Math`): utility function to convert a quaternion to euler angles (used to rotate a 2DTexture) - `Color` (Plugin `Colors`): struct representing a color using RGBA. Contains already many default colors --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
MasterLaplace
pushed a commit
that referenced
this pull request
Dec 6, 2024
I've added a way to click on a collider and update its state (for texture). It also use given callback. Component: - `Button`: represents a clickable entity. Said entity should have `BoxCollider2D`, `Transform` and `Sprite2D` to work properly System: - `UpdateButtonState`: update `Button`s states and add TemporaryComponent `ES::Plugin::Tools::HasChanged<ES::Plugin::UI::Component::Button>` if state have changed - `UpdateButtonTexture`: if states have changed, it will update `Button`'s texture or color - `ButtonClick`: call `onClick` function attribute if button have changed from state pressed to hover I've also added other plugins and tools: - `HasChanged` (Plugin `Tools`): used to tell that a component has changed (should work with temporary component) - `Rect` (Plugin `Math`): struct to store data of a rectange (size and pos) - `QuaternionToEuler` (Plugin `Math`): utility function to convert a quaternion to euler angles (used to rotate a 2DTexture) - `Color` (Plugin `Colors`): struct representing a color using RGBA. Contains already many default colors --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I've added a way to click on a collider and update its state (for texture). It also use given callback.
Component:
Button: represents a clickable entity. Said entity should haveBoxCollider2D,TransformandSprite2Dto work properlySystem:
UpdateButtonState: updateButtons states and add TemporaryComponentES::Plugin::Tools::HasChanged<ES::Plugin::UI::Component::Button>if state have changedUpdateButtonTexture: if states have changed, it will updateButton's texture or colorButtonClick: callonClickfunction attribute if button have changed from state pressed to hoverI've also added other plugins and tools:
HasChanged(PluginTools): used to tell that a component has changed (should work with temporary component)Rect(PluginMath): struct to store data of a rectange (size and pos)QuaternionToEuler(PluginMath): utility function to convert a quaternion to euler angles (used to rotate a 2DTexture)Color(PluginColors): struct representing a color using RGBA. Contains already many default colors