Add ANSI escape code colors to tetromino pieces#13
Draft
Conversation
- Update blocks texture with 7 colored block strings (comma-separated) - Add inline coloredBlocks array in tetromino.h indexed by Shape enum - Use colored blocks in shapes map and rotate() in tetromino.cc - Update board.cc comparisons from == "■" to != " " for colored blocks - Preserve colored block strings when locking pieces to the grid Co-authored-by: itssimmons <62354548+itssimmons@users.noreply.github.com>
Co-authored-by: itssimmons <62354548+itssimmons@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add colors to the pieces using ANSI escape codes
Add ANSI escape code colors to tetromino pieces
Feb 14, 2026
itssimmons
reviewed
Feb 14, 2026
Owner
There was a problem hiding this comment.
@copilot You create the file, which is good, but you don't use it because you end up creating a coloredBlocks variable. What would be the goal of this file otherwise?
Author
There was a problem hiding this comment.
Fixed in 7fbd619. coloredBlocks is now loaded from tetris/assets/textures/blocks at runtime via loadBlocks(), which reads the file and parses the comma-separated colored blocks. The header now just declares it as extern const—the file is the single source of truth.
…ding The blocks file is now the single source of truth for piece colors. coloredBlocks is declared extern in tetromino.h and defined in tetromino.cc via loadBlocks() which reads and parses the file. Co-authored-by: itssimmons <62354548+itssimmons@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.
tetris/assets/textures/blocksto contain 7 colored block strings separated by commas, matching the Shape enum order (L=Orange, T=Pink, J=Purple/DarkBlue, S=Green, Z=Red, O=Yellow, I=Cyan)coloredBlocksfrom theblocksfile at runtime vialoadBlocks()instead of hardcoding in the headercoloredBlocksasextern constintetromino.h, define intetromino.cctetromino.ccshapes map to usecoloredBlocks[Shape]instead of plain"■"Tetromino::rotate()to usecoloredBlocks[shapeType]for the current shapeBoard::lockPiece()to store the colored block string from the piece matrix into the gridBoard::render()to display the colored block from the piece matrix for the active pieceBoard::gameOver()andBoard::calculateBaseline()comparisons from== "■"to!= " "so colored blocks are properly detectedOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.