robust-parenting #12

Merged
sashakoshka merged 17 commits from robust-parenting into main 2023-03-15 22:34:08 -06:00
2 changed files with 8 additions and 4 deletions
Showing only changes of commit 0ebf0bc814 - Show all commits

View File

@ -31,7 +31,11 @@ func NewGame (world World, textures Textures) (game *Game) {
return return
} }
func (game *Game) DrawTo (canvas canvas.Canvas, bounds image.Rectangle) { func (game *Game) DrawTo (
canvas canvas.Canvas,
bounds image.Rectangle,
onDamage func (image.Rectangle),
) {
if canvas == nil { if canvas == nil {
select { select {
case game.stopChan <- true: case game.stopChan <- true:
@ -41,7 +45,7 @@ func (game *Game) DrawTo (canvas canvas.Canvas, bounds image.Rectangle) {
game.running = true game.running = true
go game.run() go game.run()
} }
game.Raycaster.DrawTo(canvas, bounds) game.Raycaster.DrawTo(canvas, bounds, onDamage)
} }
func (game *Game) Stamina () float64 { func (game *Game) Stamina () float64 {

View File

@ -49,9 +49,9 @@ func NewRaycaster (world World, textures Textures) (element *Raycaster) {
textures: textures, textures: textures,
renderDistance: 8, renderDistance: 8,
} }
element.Core, element.core = core.NewCore(element.drawAll) element.Core, element.core = core.NewCore(element, element.drawAll)
element.FocusableCore, element.FocusableCore,
element.focusableControl = core.NewFocusableCore(element.Draw) element.focusableControl = core.NewFocusableCore(element.core, element.Draw)
element.core.SetMinimumSize(64, 64) element.core.SetMinimumSize(64, 64)
return return
} }