[twotris] Complete rewrite: proper board, piece, scoring, effects, and UI modules - #393
Merged
Conversation
Owner
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merged
Owner
Author
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.

Twotris has been rewritten from a minimal proof-of-concept into a complete, playable game.
The old single-file
components.rs/plugin.rsstructure has been replaced with a proper module layout:piece.rsfor shapes and the 7-bag randomiser,board.rsfor the locked-cell playfield,game.rsfor input/gravity/locking/scoring,render.rsfor arena construction and per-frame drawing,ui.rsfor the score bug, side panels, and full-screen overlays,effects.rsfor confetti, lock flashes, score popups, and screen shake, andtheme.rsfor the palette and sizing constants.Gameplay is now fully featured: DAS/ARR horizontal movement, soft and hard drop, hold, ghost piece, wall and floor kicks, a 0.5 s lock delay with up to 15 resets, guideline scoring (100/300/500/800 × level, combo bonuses, back-to-back tetris at 1.5×), and gravity that accelerates every 10 lines up to level 20. The unfocused board falls at half speed so neglecting it is punishing but not immediately fatal. Score, level, and lines are shared across both boards.
The renderer switches from event-driven redraw messages to a flat per-frame repaint, which eliminates the ghost-piece desync that plagued the old approach. The falling piece is never written into the board; it lives as an
Activecomponent and is composited at draw time so collision queries never have to reason about a piece hitting itself.The window is given a fixed 1180 × 820 resolution, nearest-neighbour filtering for crisp block edges, an HDR render target, and a bloom pass. Piece colours are authored above 1.0 in linear space so they bloom into the surrounding darkness. The focused board's halo breathes; both boards tint toward red as they fill.
A title screen with drifting background tetrominoes, a pause overlay, and a game-over screen with best-score tracking round out the feature set. The README has been expanded with controls, rules, and a module map.