Skip to content
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

Allow for flippable UI Images #3225

Closed
Seldom-SE opened this issue Nov 30, 2021 · 0 comments
Closed

Allow for flippable UI Images #3225

Seldom-SE opened this issue Nov 30, 2021 · 0 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible

Comments

@Seldom-SE
Copy link

What problem does this solve or what need does it fill?

General UI functionality. In my case, some of the textures that appear in the world also need to be shown into the UI (in a Minecraft-esque tile picker that includes flipped tiles), using ImageBundle. I imagine others may run into similar issues.

What solution would you like?

Allow Sprite components (which include flip_x and flip_y fields) to affect UI images created from ImageBundle. The resize_mode field will perhaps also be useful, if that functionality is not already covered for UI. I don't imagine the size field will be as relevant in UI though, but I may be wrong.

What alternative(s) have you considered?

Allow sprites to be flipped with negative Transform scale values. Currently, they scale properly for positive values, but disappear for negative values. This is less intuitive for developers newer to gamedev, but will make particular scenarios easier to code, such as lerping to a flipped state from an un-flipped one through scaling. I don't think it should be the blessed way, though, unless they specifically need scaling and flipping to be closely related.

Thank you!

@Seldom-SE Seldom-SE added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Nov 30, 2021
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets and removed S-Needs-Triage This issue needs to be labelled labels Dec 2, 2021
ickshonpe added a commit to ickshonpe/bevy that referenced this issue Oct 18, 2022
    Adds the ImageFlip component.
    Adds an ImageFlip field called flip to UiImageBundle.
    Adds flip_x and flip_y fields to ExtractedUiNode.
    Changes extract_uinodes to extract the ImageFlip component values.
    Changes prepare_uinodes to swap the UV coords depending on the values of the ExtractedUiNode's flip_x and flip_y fields.
bors bot pushed a commit that referenced this issue Nov 14, 2022
# Objective
Fixes  #3225, Allow for flippable UI Images

## Solution
Add flip_x and flip_y fields to UiImage, and swap the UV coordinates accordingly in ui_prepare_nodes.

## Changelog
* Changes UiImage to a struct with texture, flip_x, and flip_y fields.
* Adds flip_x and flip_y fields to ExtractedUiNode.
* Changes extract_uinodes to extract the flip_x and flip_y values from UiImage.
* Changes prepare_uinodes to swap the UV coordinates as required.
* Changes UiImage derefs to texture field accesses.
@bors bors bot closed this as completed in 5f12611 Nov 14, 2022
taiyoungjang pushed a commit to taiyoungjang/bevy that referenced this issue Dec 15, 2022
# Objective
Fixes  bevyengine#3225, Allow for flippable UI Images

## Solution
Add flip_x and flip_y fields to UiImage, and swap the UV coordinates accordingly in ui_prepare_nodes.

## Changelog
* Changes UiImage to a struct with texture, flip_x, and flip_y fields.
* Adds flip_x and flip_y fields to ExtractedUiNode.
* Changes extract_uinodes to extract the flip_x and flip_y values from UiImage.
* Changes prepare_uinodes to swap the UV coordinates as required.
* Changes UiImage derefs to texture field accesses.
alradish pushed a commit to alradish/bevy that referenced this issue Jan 22, 2023
# Objective
Fixes  bevyengine#3225, Allow for flippable UI Images

## Solution
Add flip_x and flip_y fields to UiImage, and swap the UV coordinates accordingly in ui_prepare_nodes.

## Changelog
* Changes UiImage to a struct with texture, flip_x, and flip_y fields.
* Adds flip_x and flip_y fields to ExtractedUiNode.
* Changes extract_uinodes to extract the flip_x and flip_y values from UiImage.
* Changes prepare_uinodes to swap the UV coordinates as required.
* Changes UiImage derefs to texture field accesses.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective
Fixes  bevyengine#3225, Allow for flippable UI Images

## Solution
Add flip_x and flip_y fields to UiImage, and swap the UV coordinates accordingly in ui_prepare_nodes.

## Changelog
* Changes UiImage to a struct with texture, flip_x, and flip_y fields.
* Adds flip_x and flip_y fields to ExtractedUiNode.
* Changes extract_uinodes to extract the flip_x and flip_y values from UiImage.
* Changes prepare_uinodes to swap the UV coordinates as required.
* Changes UiImage derefs to texture field accesses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants