@@ -14,6 +14,75 @@ func flipY(pos Vec2) Vec2 {
1414 return Vec2 {X : pos .X , Y : - pos .Y }
1515}
1616
17+ // ============================================================================
18+ // Sprite Coordinate Adapters
19+ // ============================================================================
20+
21+ func (pself * Sprite ) SetPosition (pos Vec2 ) {
22+ pself .Sprite .SetPosition (flipY (pos ))
23+ }
24+
25+ func (pself * Sprite ) GetPosition () Vec2 {
26+ return flipY (pself .Sprite .GetPosition ())
27+ }
28+
29+ func (pself * Sprite ) SetChildPosition (path string , pos Vec2 ) {
30+ pself .Sprite .SetChildPosition (path , flipY (pos ))
31+ }
32+
33+ func (pself * Sprite ) GetChildPosition (path string ) Vec2 {
34+ return flipY (pself .Sprite .GetChildPosition (path ))
35+ }
36+
37+ func (pself * Sprite ) SetVelocity (velocity Vec2 ) {
38+ pself .Sprite .SetVelocity (flipY (velocity ))
39+ }
40+
41+ func (pself * Sprite ) GetVelocity () Vec2 {
42+ return flipY (pself .Sprite .GetVelocity ())
43+ }
44+
45+ func (pself * Sprite ) SetPivot (pivot Vec2 ) {
46+ pself .Sprite .SetPivot (flipY (pivot ))
47+ }
48+
49+ func (pself * Sprite ) GetPivot () Vec2 {
50+ return flipY (pself .Sprite .GetPivot ())
51+ }
52+
53+ func (pself * Sprite ) CheckCollisionWithPoint (point Vec2 , isTrigger bool ) bool {
54+ return pself .Sprite .CheckCollisionWithPoint (flipY (point ), isTrigger )
55+ }
56+
57+ // extra wrap functions
58+ func (pself * Sprite ) GetLastMotion () Vec2 {
59+ return flipY (pself .Sprite .GetLastMotion ())
60+ }
61+
62+ func (pself * Sprite ) GetPositionDelta () Vec2 {
63+ return flipY (pself .Sprite .GetPositionDelta ())
64+ }
65+
66+ func (pself * Sprite ) GetFloorNormal () Vec2 {
67+ return flipY (pself .Sprite .GetFloorNormal ())
68+ }
69+
70+ func (pself * Sprite ) GetWallNormal () Vec2 {
71+ return flipY (pself .Sprite .GetWallNormal ())
72+ }
73+
74+ func (pself * Sprite ) GetRealVelocity () Vec2 {
75+ return flipY (pself .Sprite .GetRealVelocity ())
76+ }
77+
78+ func (pself * Sprite ) SetAnimOffset (offset Vec2 ) {
79+ pself .Sprite .SetAnimOffset (flipY (offset ))
80+ }
81+
82+ func (pself * Sprite ) GetAnimOffset () Vec2 {
83+ return flipY (pself .Sprite .GetAnimOffset ())
84+ }
85+
1786// ============================================================================
1887// SpriteMgr Coordinate Adapters
1988// ============================================================================
@@ -83,6 +152,18 @@ func (pself *SpriteMgrImpl) GetAnimOffset(obj gdx.Object) Vec2 {
83152 return flipY (pself .spriteMgrImpl .GetAnimOffset (obj ))
84153}
85154
155+ func (pself * SpriteMgrImpl ) AddImpulse (obj gdx.Object , impulse Vec2 ) {
156+ pself .spriteMgrImpl .AddImpulse (obj , flipY (impulse ))
157+ }
158+
159+ func (pself * SpriteMgrImpl ) GetGravity (obj gdx.Object ) float64 {
160+ return - pself .spriteMgrImpl .GetGravity (obj )
161+ }
162+
163+ func (pself * SpriteMgrImpl ) SetGravity (obj gdx.Object , gravity float64 ) {
164+ pself .spriteMgrImpl .SetGravity (obj , - gravity )
165+ }
166+
86167// ============================================================================
87168// SceneMgr Coordinate Adapters
88169// ============================================================================
0 commit comments