You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
660 B
32 lines
660 B
package system |
|
|
|
import ( |
|
"code.rocketnine.space/tslocum/commandeuropa/component" |
|
"code.rocketnine.space/tslocum/gohan" |
|
"github.com/hajimehoshi/ebiten/v2" |
|
) |
|
|
|
type RenderUnit struct { |
|
Position *component.Position |
|
Sprite *component.Sprite |
|
|
|
op *ebiten.DrawImageOptions |
|
initialized bool |
|
} |
|
|
|
func (r *RenderUnit) Initialize() { |
|
r.op = &ebiten.DrawImageOptions{} |
|
} |
|
|
|
func (r *RenderUnit) Update(e gohan.Entity) error { |
|
return gohan.ErrUnregister |
|
} |
|
|
|
func (r *RenderUnit) Draw(e gohan.Entity, screen *ebiten.Image) error { |
|
if !r.initialized { |
|
r.Initialize() |
|
} |
|
|
|
renderSprite(screen, r.Sprite.Image, r.Position.X, r.Position.Y, r.op) |
|
return nil |
|
}
|
|
|