1
0
Fork 0

Compare commits

..

No commits in common. "main" and "1.1.0" have entirely different histories.
main ... 1.1.0

5 changed files with 17 additions and 46 deletions

View file

@ -2,16 +2,6 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
---
## [1.2.0](http://git.sargeras.net/pnx/tetris-go/src/1.2.0) - 2026-04-04
### Features
- **(menu)** use list.SetSelected() on Enter() so that no audio is played. ([ef79889](http://git.sargeras.net/pnx/tetris-go/commit/ef798896c3493d67b823ae762bb0c8a14c6a2f45))
- **(menu)** play "menu enter" sound when button action is triggered ([eb7486f](http://git.sargeras.net/pnx/tetris-go/commit/eb7486f57cf9878cd626fcbf39417b714e9acaef))
- **(music)** add gameplay background music ([562d47a](http://git.sargeras.net/pnx/tetris-go/commit/562d47a72366eeaca88a0eeb3c3ee5f75bed36f8))
- **(ui)** add ListBox.SetSelected() ([f3d7995](http://git.sargeras.net/pnx/tetris-go/commit/f3d7995bc25b8da9055f6a7ead404c3ad21df852))
---
## [1.1.0](http://git.sargeras.net/pnx/tetris-go/src/1.1.0) - 2025-10-28
@ -65,7 +55,7 @@ All notable changes to this project will be documented in this file. See [conven
- update readme and add license ([02a915b](http://git.sargeras.net/pnx/tetris-go/commit/02a915b8373f9ace1ae9702b565f82065b4289ed))
---
## [0.13.0](http://git.sargeras.net/pnx/tetris-go/src/v0.13.0) - 2025-09-24
## [0.13.0](http://git.sargeras.net/pnx/tetris-go/src/0.13.0) - 2025-09-24
### Bug Fixes
@ -90,7 +80,7 @@ All notable changes to this project will be documented in this file. See [conven
- improve menu ([288e710](http://git.sargeras.net/pnx/tetris-go/commit/288e710b9f298de25d0a16564287c54e788fb551))
---
## [0.12.0](http://git.sargeras.net/pnx/tetris-go/src/v0.12.0) - 2025-09-21
## [0.12.0](http://git.sargeras.net/pnx/tetris-go/src/0.12.0) - 2025-09-21
### Features
@ -101,7 +91,7 @@ All notable changes to this project will be documented in this file. See [conven
- add sound on shape locked and row clear ([a5c9e68](http://git.sargeras.net/pnx/tetris-go/commit/a5c9e687ee604a5c783c7873ffa0d5a5e5f6813c))
---
## [0.11.0](http://git.sargeras.net/pnx/tetris-go/src/v0.11.0) - 2025-09-17
## [0.11.0](http://git.sargeras.net/pnx/tetris-go/src/0.11.0) - 2025-09-17
### Features
@ -109,14 +99,14 @@ All notable changes to this project will be documented in this file. See [conven
- use ShapeQueue to implement shape RNG ([d6c9389](http://git.sargeras.net/pnx/tetris-go/commit/d6c9389e60252048c80f44572b024607d19c8814))
---
## [0.10.0](http://git.sargeras.net/pnx/tetris-go/src/v0.10.0) - 2025-09-17
## [0.10.0](http://git.sargeras.net/pnx/tetris-go/src/0.10.0) - 2025-09-17
### Features
- draw next shape ([12712e0](http://git.sargeras.net/pnx/tetris-go/commit/12712e0172071013f323d87c75d573645d7f2195))
---
## [0.9.0](http://git.sargeras.net/pnx/tetris-go/src/v0.9.0) - 2025-09-15
## [0.9.0](http://git.sargeras.net/pnx/tetris-go/src/0.9.0) - 2025-09-15
### Features
@ -124,7 +114,7 @@ All notable changes to this project will be documented in this file. See [conven
- show score and increment when lines are cleared ([b6a33d0](http://git.sargeras.net/pnx/tetris-go/commit/b6a33d017f718659a5b21f2d80b8c706d4ee28be))
---
## [0.8.0](http://git.sargeras.net/pnx/tetris-go/src/v0.8.0) - 2025-09-15
## [0.8.0](http://git.sargeras.net/pnx/tetris-go/src/0.8.0) - 2025-09-15
### Features
@ -135,14 +125,14 @@ All notable changes to this project will be documented in this file. See [conven
- clear full lines after locking shape ([ac4d911](http://git.sargeras.net/pnx/tetris-go/commit/ac4d911efd0bfa7aeff57acf8535c916dc6a22ca))
---
## [0.7.0](http://git.sargeras.net/pnx/tetris-go/src/v0.7.0) - 2025-09-15
## [0.7.0](http://git.sargeras.net/pnx/tetris-go/src/0.7.0) - 2025-09-15
### Features
- soft drop ([8f11a99](http://git.sargeras.net/pnx/tetris-go/commit/8f11a99e08edc0473458f28adb4db87a75092a04))
---
## [0.6.0](http://git.sargeras.net/pnx/tetris-go/src/v0.6.0) - 2025-09-15
## [0.6.0](http://git.sargeras.net/pnx/tetris-go/src/0.6.0) - 2025-09-15
### Features
@ -150,7 +140,7 @@ All notable changes to this project will be documented in this file. See [conven
- rotate shape when UP is pressed. ([4ce5b82](http://git.sargeras.net/pnx/tetris-go/commit/4ce5b82b25acd93ce7cfaab18b300b6c25f2ba30))
---
## [0.5.0](http://git.sargeras.net/pnx/tetris-go/src/v0.5.0) - 2025-09-15
## [0.5.0](http://git.sargeras.net/pnx/tetris-go/src/0.5.0) - 2025-09-15
### Features
@ -162,7 +152,7 @@ All notable changes to this project will be documented in this file. See [conven
- update go.mod ([d6a9e80](http://git.sargeras.net/pnx/tetris-go/commit/d6a9e80fbb79532a2f63d88b126b2fd448de3c7f))
---
## [0.4.0](http://git.sargeras.net/pnx/tetris-go/src/v0.4.0) - 2025-09-14
## [0.4.0](http://git.sargeras.net/pnx/tetris-go/src/0.4.0) - 2025-09-14
### Bug Fixes
@ -173,7 +163,7 @@ All notable changes to this project will be documented in this file. See [conven
- **(collision)** check for collision against blocks in the grid. ([dab2570](http://git.sargeras.net/pnx/tetris-go/commit/dab2570b76c224ad3b6b3741c3cb0381d403fa79))
---
## [0.3.0](http://git.sargeras.net/pnx/tetris-go/src/v0.3.0) - 2025-09-14
## [0.3.0](http://git.sargeras.net/pnx/tetris-go/src/0.3.0) - 2025-09-14
### Features
@ -184,7 +174,7 @@ All notable changes to this project will be documented in this file. See [conven
- cleanup main loop code by moving related code into update/render functions respectively. ([3c84709](http://git.sargeras.net/pnx/tetris-go/commit/3c847094a060caec81dd805bc58f2ab1b93b2289))
---
## [0.2.0](http://git.sargeras.net/pnx/tetris-go/src/v0.2.0) - 2025-09-14
## [0.2.0](http://git.sargeras.net/pnx/tetris-go/src/0.2.0) - 2025-09-14
### Features

View file

@ -7,7 +7,6 @@ import (
const (
SFX_SHAPE_LOCKED audio.SoundID = 0
SFX_ROW_CLEARED audio.SoundID = 1
SFX_MUSIC audio.SoundID = 3
SFX_MENU_SELECT audio.SoundID = 0
SFX_MENU_ENTER audio.SoundID = 1
SFX_MENU_SOUND_VOLUME_SELECT audio.SoundID = 1

View file

@ -54,12 +54,9 @@ func (gp *GamePlay) Enter() {
gp.nextShape = gp.shapeQueue.Next()
gp.SpawnShape()
gp.lineClearAnimation.Reset()
audio.PlayLooped(assets.SFX_MUSIC)
}
func (GamePlay) Exit() {
audio.Stop(assets.SFX_MUSIC)
}
func (gp *GamePlay) SpawnShape() {

View file

@ -2,7 +2,6 @@ package handlers
import (
"tetris/assets"
"tetris/engine/audio"
"tetris/engine/render"
"tetris/game"
"tetris/game/state"
@ -18,26 +17,19 @@ type MainMenu struct {
list *layouts.ListBox
}
func enterState(fsm state.Transitioner, state string) func() {
return func() {
audio.Play(assets.SFX_MENU_ENTER)
fsm.Switch(state)
}
}
func NewMainMenu(fsm state.Transitioner) *MainMenu {
return &MainMenu{
list: layouts.NewListBox([]ui.InputWidget{
widgets.NewButton("Start", 32, enterState(fsm, "gameplay")),
widgets.NewButton("Options", 32, enterState(fsm, "options")),
widgets.NewButton("Quit", 32, enterState(fsm, "quit")),
widgets.NewButton("Start", 32, func() { fsm.Switch("gameplay") }),
widgets.NewButton("Options", 32, func() { fsm.Switch("options") }),
widgets.NewButton("Quit", 32, func() { fsm.Switch("quit") }),
}).Spacing(10).
OnSelect(uievents.MenuSelect),
}
}
func (main *MainMenu) Enter() {
main.list.SetSelected(0)
main.list.Select(0)
}
func (MainMenu) Exit() {

View file

@ -42,19 +42,12 @@ func (lb ListBox) Entries() []ui.InputWidget {
}
func (lb *ListBox) Select(index int) {
if lb.SetSelected(index) {
lb.onSelect()
}
}
func (lb *ListBox) SetSelected(index int) bool {
if index >= 0 && index < len(lb.entries) {
lb.entries[lb.selected].SetFocus(false)
lb.selected = index
lb.entries[lb.selected].SetFocus(true)
return true
lb.onSelect()
}
return false
}
func (lb ListBox) Selected() ui.InputWidget {