Raycaster example works

This commit is contained in:
2023-04-20 00:22:29 -04:00
parent dbee2ff5a9
commit 698414ee65
5 changed files with 5 additions and 693 deletions

View File

@@ -103,7 +103,7 @@ func (game *Game) tick () {
if game.stamina < 0 {
game.stamina = 0
}
tomo.Do(game.Invalidate)
if statUpdate && game.onStatUpdate != nil {
tomo.Do(game.onStatUpdate)

View File

@@ -57,12 +57,13 @@ func run () {
topBar.Adopt(elements.NewLabel("Health:"))
topBar.AdoptExpand(healthBar)
container.Adopt(topBar)
container.AdoptExpand(game)
container.AdoptExpand(game.Raycaster)
game.Focus()
game.OnStatUpdate (func () {
staminaBar.SetProgress(game.Stamina())
})
game.Start()
window.OnClose(tomo.Stop)
window.Show()

View File

@@ -138,6 +138,8 @@ func (element *Raycaster) Focus () {
element.entity.Focus()
}
func (element *Raycaster) SetEnabled (bool) { }
func (element *Raycaster) Enabled () bool { return true }
func (element *Raycaster) HandleFocusChange () { }