Skip to content

feat(ui): add ui plugin with button management#46

Merged
Miou-zora merged 28 commits intomainfrom
12-ui-plugin
Nov 9, 2024
Merged

feat(ui): add ui plugin with button management#46
Miou-zora merged 28 commits intomainfrom
12-ui-plugin

Conversation

@Miou-zora
Copy link
Contributor

@Miou-zora Miou-zora commented Oct 28, 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 Buttons 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

@Miou-zora Miou-zora added the enhancement New feature or request label Oct 28, 2024
@Miou-zora Miou-zora self-assigned this Oct 28, 2024
@Miou-zora Miou-zora linked an issue Oct 28, 2024 that may be closed by this pull request
@Miou-zora Miou-zora marked this pull request as ready for review October 29, 2024 02:01
@Miou-zora Miou-zora requested a review from a team October 31, 2024 11:57
@Miou-zora Miou-zora requested review from a team and removed request for a team November 6, 2024 03:09
@Miou-zora Miou-zora merged commit bd4cc10 into main Nov 9, 2024
@Miou-zora Miou-zora deleted the 12-ui-plugin branch November 9, 2024 07:56
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI Plugin

2 participants