···2525- [x] Toggle Save Block
2626- [x] Make Column/Row count configurable, this allows for way bigger playing fields
2727- [x] Add modern multiplayer, where you have to clear the game together
2828+- [x] Config persistence
2829- [ ] Toggle T-Spins
2930- [ ] Points for perfect clears
3131+- [ ] Scoreboard/Leaderboard
3032- [ ] Add classic Tetris multiplayer (deleted rows will be a penalty for the opponent)
+5-40
screen_start.go
···1515}
16161717type StartScreen struct {
1818- SplashImage ff.Image
1919- currentFrame int
2020- frameCounter int
2121- totalFrames int
2222- framesPerSprite int
2323- spriteWidth int
2424- spriteHeight int
1818+ SplashImage ff.Image
1919+ spriteWidth int
25202621 // Menu
2722 MenuList []MenuItem
···3833}
39344035func (ss *StartScreen) OnEnter() {
4141- // Configuration for the sprite animation
4242- ss.totalFrames = 1 // 4 sprites in the sheet
4343- ss.framesPerSprite = 30 // Change sprite every 60 frames
4444- ss.currentFrame = 0
4545- ss.frameCounter = 0
46364737 // Load once; reuse the allocation on subsequent OnEnter calls.
4838 if ss.spriteWidth == 0 {
4939 ss.SplashImage = ff.LoadFile("start", nil).Image()
5050- ss.spriteWidth = ss.SplashImage.Width() / ss.totalFrames
5151- ss.spriteHeight = ss.SplashImage.Height()
4040+ ss.spriteWidth = ss.SplashImage.Width()
5241 }
53425443 // Menu setup
···7564}
76657766func (ss *StartScreen) OnExit() {
7878- ss.currentFrame = 0
7979- ss.frameCounter = 0
8080- ss.totalFrames = 0
8181- ss.framesPerSprite = 0
8267 ss.MenuList = nil
8368 ss.MenuListState = 0
8469 ss.maxTextWidthInList = 0
···9075}
91769277func (ss *StartScreen) Draw() {
9393- // Calculate which sprite to show based on frame counter
9494- spriteIndex := (ss.frameCounter / ss.framesPerSprite) % ss.totalFrames
9595-9696- // Calculate the position to extract the sprite from the sheet
9797- spriteX := spriteIndex * ss.spriteWidth
9898- spriteY := 0
9999-100100- // Create a sub-image for the current sprite
101101- subImage := ss.SplashImage.Sub(
102102- ff.Point{X: spriteX, Y: spriteY},
103103- ff.Size{W: ss.spriteWidth, H: ss.spriteHeight},
104104- )
105105-106106- // Center the sprite on screen
107107- centerX := (ff.Width - ss.spriteWidth) / 2
108108- centerY := (ff.Height-ss.spriteHeight)/2 - 10
109109-110110- // Draw the current sprite frame
111111- ff.DrawSubImage(subImage, ff.Point{X: centerX, Y: centerY})
7878+ ff.DrawImage(ss.SplashImage, ff.Point{X: 0, Y: 0})
1127911380 // Draw commit hash at bottom-left
11481 ff.DrawText(versionText, VERSIONFONT, ff.Point{X: 3, Y: ff.Height - 5}, ff.ColorLightGray)
···11784 ff.DrawRect(
11885 ff.P((ff.Width/2)-5, ff.Height/4+25),
11986 ff.S(60, 40),
120120- ff.Style{ff.ColorWhite, ff.ColorNone, 1},
8787+ ff.Style{FillColor: ff.ColorWhite, StrokeColor: ff.ColorNone, StrokeWidth: 1},
12188 )
1228912390 // Draw Menu
···234201}
235202236203func (ss *StartScreen) Update() {
237237- // Increment frame counter for animation
238238- ss.frameCounter++
239204 ss.HandleInput()
240205}
241206