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

AGS 4.0: Support all 3 flip styles in ViewFrame #2620

Open
wants to merge 5 commits into
base: ags4
Choose a base branch
from

Conversation

ivan-mogilko
Copy link
Contributor

@ivan-mogilko ivan-mogilko commented Dec 13, 2024

This lets set any kind of Flip style to a ViewFrame, affecting anything that uses a viewframe (including animating buttons since #1944).

(Probably should have based #2619 on top of this...)

  • Updated Direct3D and OpenGL renderers to be able to flip texture all ways.
  • Added SpriteTransformationFlags that may hold a number of sprite flags together. Currently they only have flip types.
  • ViewFrame's "flags" field is now classified as SpriteTransformationFlags. Removed the only VFLG_FLIPSPRITE flag. There's no backwards compatibility issue here, because luckily VFLG_FLIPSPRITE is matching our new FlipX flag. (If we need separate flags for something ViewFrame specific, we may add another field, and there are 2 reserved ints in it, so we won't have to change serialization format in such case)
  • Adjusted all drawing functions that had "flipped" or "mirror" boolean to have GraphicFlip parameter instead. There are functions that cast between GraphicFlip and SpriteTransformationFlags, in case we want to "extract" only the flip style. NOTE: I was a little stupid and somehow missed the fact that GraphicFlip is already suitable to be treated as flags with exact same values (by accident). I might adjust the code to reflect that.
  • In the Editor deprecated ViewFrame.Flipped property and added "SpriteFlipStyle Flip" property to be used instead. Added conversion for project upgrade.
  • ViewFrame.Flipped in script API is converted to eFlipDirection. This is backwards compatible, because old boolean value match "No flip" and "Horizontal flip" respectively. I decided to keep the property name in sake of users convenience, since it's still suitable as it is.

NOTE: In the Editor, "Flip frame" command is kept to flip horizontally only. I was not certain how to deal with it. Vertical flip is not very common, so maybe it should have a separate command and key shortcut.


POSSIBLE NEXT THINGS:
Overlay.Flip: #2619
Add Button.GraphicFlip, to mimic this addition from @AlanDrake 's Draconian version: AlanDrake@58ea65d

@ivan-mogilko ivan-mogilko added ags 4 related to the ags4 development context: game logic labels Dec 13, 2024
@ivan-mogilko ivan-mogilko force-pushed the ags4--flippingstuff branch 3 times, most recently from d11352e to 4d6028f Compare December 14, 2024 19:26
@ivan-mogilko
Copy link
Contributor Author

Had to rebase after fixing software renderer in the ags4 branch, and also couple of mistakes in this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ags 4 related to the ags4 development context: game logic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant