robust-parenting #12
@ -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 {
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user