Skip to content

Conversation

@tmck-code
Copy link
Owner

@tmck-code tmck-code commented Jun 16, 2025

Context

Over time, I've found it awkward that the pokemon sprites always face to the left, which is usually the very edge of the terminal.

Additionally, in future I'd like to make it possible to have the speech bubble placed horizontally beside the pokemon, rather than always being vertically above

Changes

This introduces the ability to "flip" any pokemon with -F or --flip

regular flipped
Screenshot_20250616_133401_Termux~2 Screenshot_20250616_133454_Termux~2

This is a rough initial implementation that works 100% correctly 🎉, and I'll improve the algorithm over time

  1. Tokenise the ANSI chars & escape sequence
  2. Reverse them
  3. Stitch together into a string

Each reversed line will end with an ANSI reset code, allowing a speech bubble (or anything) to be placed to the right without having to worry about the colours

Each line also ends with padding spaces resulting in a "square", so alignment is also not an issue

In future I'll also update the regular sprites to work like this too

@tmck-code tmck-code merged commit 660b770 into master Jun 16, 2025
1 check passed
@tmck-code tmck-code deleted the flip-horizontal branch June 16, 2025 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants