blob: b1fdca35efd2cfbd253b925c56b57b796c3993a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package objs
import (
"github.com/Zyko0/go-sdl3/sdl"
"ponger/ecs"
"ponger/input"
)
type Cursor struct {
*ecs.GameObject
}
func (c *Cursor) Render(renderer *sdl.Renderer) {
renderer.SetDrawColor(255, 0, 0, 255)
renderer.RenderPoint(c.Position.X, c.Position.Y)
}
func (c *Cursor) Process(ev input.Event) {
c.Position.X += ev.Dx
c.Position.Y += ev.Dy
}
func (c *Cursor) GO() *ecs.GameObject {
return c.GameObject
}
func NewCursor() ecs.IsGameObject {
return &Cursor{
GameObject: &ecs.GameObject{},
}
}
|