Skip to content

Commit ca802d1

Browse files
authored
Merge pull request #1130 from joeykchen/pr_bounce_off_edge_bug
Fix: Applies proper bounce physics by reflecting the direction
2 parents 1dd127a + ec74ee7 commit ca802d1

File tree

12 files changed

+657
-595
lines changed

12 files changed

+657
-595
lines changed

internal/enginewrap/sync.gen.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,13 @@ func (pself *physicMgrImpl) CheckTouchedCameraBoundary(obj gdx.Object, board_typ
534534
})
535535
return _ret1
536536
}
537+
func (pself *physicMgrImpl) CheckNearestTouchedCameraBoundary(obj gdx.Object) int64 {
538+
var _ret1 int64
539+
callInMainThread(func() {
540+
_ret1 = gdx.PhysicMgr.CheckNearestTouchedCameraBoundary(obj)
541+
})
542+
return _ret1
543+
}
537544
func (pself *physicMgrImpl) SetCollisionSystemType(is_collision_by_alpha bool) {
538545
callInMainThread(func() {
539546
gdx.PhysicMgr.SetCollisionSystemType(is_collision_by_alpha)

internal/enginewrap/sync_pure.gen.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ func (pself *physicMgrImpl) CheckTouchedCameraBoundary(obj gdx.Object, board_typ
291291
var _ret1 bool
292292
return _ret1
293293
}
294+
func (pself *physicMgrImpl) CheckNearestTouchedCameraBoundary(obj gdx.Object) int64 {
295+
var _ret1 int64
296+
return _ret1
297+
}
294298
func (pself *physicMgrImpl) SetCollisionSystemType(is_collision_by_alpha bool) {}
295299
func (pself *physicMgrImpl) SetGlobalGravity(gravity float64) {}
296300
func (pself *physicMgrImpl) GetGlobalGravity() float64 {

pkg/gdspx/internal/ffi/ffi.gen.go

Lines changed: 295 additions & 293 deletions
Large diffs are not rendered by default.

pkg/gdspx/internal/ffi/ffi_wrapper.gen.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ type GDExtensionSpxPhysicRaycast C.GDExtensionSpxPhysicRaycast
153153
type GDExtensionSpxPhysicCheckCollision C.GDExtensionSpxPhysicCheckCollision
154154
type GDExtensionSpxPhysicCheckTouchedCameraBoundaries C.GDExtensionSpxPhysicCheckTouchedCameraBoundaries
155155
type GDExtensionSpxPhysicCheckTouchedCameraBoundary C.GDExtensionSpxPhysicCheckTouchedCameraBoundary
156+
type GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary C.GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary
156157
type GDExtensionSpxPhysicSetCollisionSystemType C.GDExtensionSpxPhysicSetCollisionSystemType
157158
type GDExtensionSpxPhysicSetGlobalGravity C.GDExtensionSpxPhysicSetGlobalGravity
158159
type GDExtensionSpxPhysicGetGlobalGravity C.GDExtensionSpxPhysicGetGlobalGravity
@@ -1046,6 +1047,16 @@ func CallPhysicCheckTouchedCameraBoundary(
10461047

10471048
return (GdBool)(ret_val)
10481049
}
1050+
func CallPhysicCheckNearestTouchedCameraBoundary(
1051+
obj GdObj,
1052+
) GdInt {
1053+
arg0 := (C.GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary)(api.SpxPhysicCheckNearestTouchedCameraBoundary)
1054+
arg1GdObj := (C.GdObj)(obj)
1055+
var ret_val C.GdInt
1056+
C.cgo_callfn_GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary(arg0, arg1GdObj, &ret_val)
1057+
1058+
return (GdInt)(ret_val)
1059+
}
10491060
func CallPhysicSetCollisionSystemType(
10501061
is_collision_by_alpha GdBool,
10511062
) {

pkg/gdspx/internal/ffi/ffi_wrapper.gen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ void cgo_callfn_GDExtensionSpxPhysicCheckTouchedCameraBoundaries(const GDExtensi
216216
void cgo_callfn_GDExtensionSpxPhysicCheckTouchedCameraBoundary(const GDExtensionSpxPhysicCheckTouchedCameraBoundary fn, GdObj obj, GdInt board_type, GdBool* ret_val) {
217217
fn(obj, board_type,ret_val);
218218
}
219+
void cgo_callfn_GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary(const GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary fn, GdObj obj, GdInt* ret_val) {
220+
fn(obj,ret_val);
221+
}
219222
void cgo_callfn_GDExtensionSpxPhysicSetCollisionSystemType(const GDExtensionSpxPhysicSetCollisionSystemType fn, GdBool is_collision_by_alpha) {
220223
fn(is_collision_by_alpha);
221224
}

pkg/gdspx/internal/ffi/gdextension_spx_ext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ typedef void (*GDExtensionSpxPhysicRaycast)(GdVec2 from, GdVec2 to, GdInt collis
292292
typedef void (*GDExtensionSpxPhysicCheckCollision)(GdVec2 from, GdVec2 to, GdInt collision_mask, GdBool collide_with_areas, GdBool collide_with_bodies, GdBool *ret_value);
293293
typedef void (*GDExtensionSpxPhysicCheckTouchedCameraBoundaries)(GdObj obj, GdInt *ret_value);
294294
typedef void (*GDExtensionSpxPhysicCheckTouchedCameraBoundary)(GdObj obj, GdInt board_type, GdBool *ret_value);
295+
typedef void (*GDExtensionSpxPhysicCheckNearestTouchedCameraBoundary)(GdObj obj, GdInt *ret_value);
295296
typedef void (*GDExtensionSpxPhysicSetCollisionSystemType)(GdBool is_collision_by_alpha);
296297
typedef void (*GDExtensionSpxPhysicSetGlobalGravity)(GdFloat gravity);
297298
typedef void (*GDExtensionSpxPhysicGetGlobalGravity)(GdFloat *ret_value);

pkg/gdspx/internal/webffi/ffi.gen.go

Lines changed: 295 additions & 293 deletions
Large diffs are not rendered by default.

pkg/gdspx/internal/wrap/manager_wrapper.gen.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ func (pself *physicMgr) CheckTouchedCameraBoundary(obj Object, board_type int64)
485485
retValue := CallPhysicCheckTouchedCameraBoundary(arg0, arg1)
486486
return ToBool(retValue)
487487
}
488+
func (pself *physicMgr) CheckNearestTouchedCameraBoundary(obj Object) int64 {
489+
arg0 := ToGdObj(obj)
490+
retValue := CallPhysicCheckNearestTouchedCameraBoundary(arg0)
491+
return ToInt64(retValue)
492+
}
488493
func (pself *physicMgr) SetCollisionSystemType(is_collision_by_alpha bool) {
489494
arg0 := ToGdBool(is_collision_by_alpha)
490495
CallPhysicSetCollisionSystemType(arg0)

pkg/gdspx/internal/wrap/manager_wrapper_web.gen.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,11 @@ func (pself *physicMgr) CheckTouchedCameraBoundary(obj Object, board_type int64)
462462
_retValue := API.SpxPhysicCheckTouchedCameraBoundary.Invoke(arg0, arg1)
463463
return JsToGdBool(_retValue)
464464
}
465+
func (pself *physicMgr) CheckNearestTouchedCameraBoundary(obj Object) int64 {
466+
arg0 := JsFromGdObj(obj)
467+
_retValue := API.SpxPhysicCheckNearestTouchedCameraBoundary.Invoke(arg0)
468+
return JsToGdInt(_retValue)
469+
}
465470
func (pself *physicMgr) SetCollisionSystemType(is_collision_by_alpha bool) {
466471
arg0 := JsFromGdBool(is_collision_by_alpha)
467472
API.SpxPhysicSetCollisionSystemType.Invoke(arg0)

pkg/gdspx/pkg/engine/interface.gen.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ type IPhysicMgr interface {
121121
CheckCollision(from Vec2, to Vec2, collision_mask int64, collide_with_areas bool, collide_with_bodies bool) bool
122122
CheckTouchedCameraBoundaries(obj Object) int64
123123
CheckTouchedCameraBoundary(obj Object, board_type int64) bool
124+
CheckNearestTouchedCameraBoundary(obj Object) int64
124125
SetCollisionSystemType(is_collision_by_alpha bool)
125126
SetGlobalGravity(gravity float64)
126127
GetGlobalGravity() float64

0 commit comments

Comments
 (0)