Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions internal/enginewrap/sync.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,26 @@ func (pself *extMgrImpl) SetPenStampTexture(obj gdx.Object, texture_path string)
gdx.ExtMgr.SetPenStampTexture(obj, texture_path)
})
}
func (pself *extMgrImpl) CreateSpring() {
callInMainThread(func() {
gdx.ExtMgr.CreateSpring()
})
}
func (pself *extMgrImpl) DestroySpring() {
callInMainThread(func() {
gdx.ExtMgr.DestroySpring()
})
}
func (pself *extMgrImpl) ClearSpring() {
callInMainThread(func() {
gdx.ExtMgr.ClearSpring()
})
}
func (pself *extMgrImpl) NewSpringParticle(position Vec2, fixed bool) {
callInMainThread(func() {
gdx.ExtMgr.NewSpringParticle(position, fixed)
})
}

// IInputMgr
func (pself *inputMgrImpl) GetMousePos() Vec2 {
Expand Down
4 changes: 4 additions & 0 deletions internal/enginewrap/sync_pure.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ func (pself *extMgrImpl) SetPenTo(obj gdx.Object, property int64, value float64)
func (pself *extMgrImpl) ChangePenSizeBy(obj gdx.Object, amount float64) {}
func (pself *extMgrImpl) SetPenSizeTo(obj gdx.Object, size float64) {}
func (pself *extMgrImpl) SetPenStampTexture(obj gdx.Object, texture_path string) {}
func (pself *extMgrImpl) CreateSpring() {}
func (pself *extMgrImpl) DestroySpring() {}
func (pself *extMgrImpl) ClearSpring() {}
func (pself *extMgrImpl) NewSpringParticle(position Vec2, fixed bool) {}

// IInputMgr
func (pself *inputMgrImpl) GetMousePos() Vec2 {
Expand Down
8 changes: 8 additions & 0 deletions pkg/gdspx/internal/ffi/ffi.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ type GDExtensionInterface struct {
SpxExtChangePenSizeBy GDExtensionSpxExtChangePenSizeBy
SpxExtSetPenSizeTo GDExtensionSpxExtSetPenSizeTo
SpxExtSetPenStampTexture GDExtensionSpxExtSetPenStampTexture
SpxExtCreateSpring GDExtensionSpxExtCreateSpring
SpxExtDestroySpring GDExtensionSpxExtDestroySpring
SpxExtClearSpring GDExtensionSpxExtClearSpring
SpxExtNewSpringParticle GDExtensionSpxExtNewSpringParticle
SpxInputGetMousePos GDExtensionSpxInputGetMousePos
SpxInputGetKey GDExtensionSpxInputGetKey
SpxInputGetMouseState GDExtensionSpxInputGetMouseState
Expand Down Expand Up @@ -293,6 +297,10 @@ func (x *GDExtensionInterface) loadProcAddresses() {
x.SpxExtChangePenSizeBy = (GDExtensionSpxExtChangePenSizeBy)(dlsymGD("spx_ext_change_pen_size_by"))
x.SpxExtSetPenSizeTo = (GDExtensionSpxExtSetPenSizeTo)(dlsymGD("spx_ext_set_pen_size_to"))
x.SpxExtSetPenStampTexture = (GDExtensionSpxExtSetPenStampTexture)(dlsymGD("spx_ext_set_pen_stamp_texture"))
x.SpxExtCreateSpring = (GDExtensionSpxExtCreateSpring)(dlsymGD("spx_ext_create_spring"))
x.SpxExtDestroySpring = (GDExtensionSpxExtDestroySpring)(dlsymGD("spx_ext_destroy_spring"))
x.SpxExtClearSpring = (GDExtensionSpxExtClearSpring)(dlsymGD("spx_ext_clear_spring"))
x.SpxExtNewSpringParticle = (GDExtensionSpxExtNewSpringParticle)(dlsymGD("spx_ext_new_spring_particle"))
x.SpxInputGetMousePos = (GDExtensionSpxInputGetMousePos)(dlsymGD("spx_input_get_mouse_pos"))
x.SpxInputGetKey = (GDExtensionSpxInputGetKey)(dlsymGD("spx_input_get_key"))
x.SpxInputGetMouseState = (GDExtensionSpxInputGetMouseState)(dlsymGD("spx_input_get_mouse_state"))
Expand Down
30 changes: 30 additions & 0 deletions pkg/gdspx/internal/ffi/ffi_wrapper.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ type GDExtensionSpxExtSetPenTo C.GDExtensionSpxExtSetPenTo
type GDExtensionSpxExtChangePenSizeBy C.GDExtensionSpxExtChangePenSizeBy
type GDExtensionSpxExtSetPenSizeTo C.GDExtensionSpxExtSetPenSizeTo
type GDExtensionSpxExtSetPenStampTexture C.GDExtensionSpxExtSetPenStampTexture
type GDExtensionSpxExtCreateSpring C.GDExtensionSpxExtCreateSpring
type GDExtensionSpxExtDestroySpring C.GDExtensionSpxExtDestroySpring
type GDExtensionSpxExtClearSpring C.GDExtensionSpxExtClearSpring
type GDExtensionSpxExtNewSpringParticle C.GDExtensionSpxExtNewSpringParticle
type GDExtensionSpxInputGetMousePos C.GDExtensionSpxInputGetMousePos
type GDExtensionSpxInputGetKey C.GDExtensionSpxInputGetKey
type GDExtensionSpxInputGetMouseState C.GDExtensionSpxInputGetMouseState
Expand Down Expand Up @@ -679,6 +683,32 @@ func CallExtSetPenStampTexture(

C.cgo_callfn_GDExtensionSpxExtSetPenStampTexture(arg0, arg1GdObj, arg2GdString)

}
func CallExtCreateSpring() {
arg0 := (C.GDExtensionSpxExtCreateSpring)(api.SpxExtCreateSpring)

C.cgo_callfn_GDExtensionSpxExtCreateSpring(arg0)
}
func CallExtDestroySpring() {
arg0 := (C.GDExtensionSpxExtDestroySpring)(api.SpxExtDestroySpring)

C.cgo_callfn_GDExtensionSpxExtDestroySpring(arg0)
}
func CallExtClearSpring() {
arg0 := (C.GDExtensionSpxExtClearSpring)(api.SpxExtClearSpring)

C.cgo_callfn_GDExtensionSpxExtClearSpring(arg0)
}
func CallExtNewSpringParticle(
position GdVec2,
fixed GdBool,
) {
arg0 := (C.GDExtensionSpxExtNewSpringParticle)(api.SpxExtNewSpringParticle)
arg1GdVec2 := (C.GdVec2)(position)
arg2GdBool := (C.GdBool)(fixed)

C.cgo_callfn_GDExtensionSpxExtNewSpringParticle(arg0, arg1GdVec2, arg2GdBool)

}
func CallInputGetMousePos() GdVec2 {
arg0 := (C.GDExtensionSpxInputGetMousePos)(api.SpxInputGetMousePos)
Expand Down
12 changes: 12 additions & 0 deletions pkg/gdspx/internal/ffi/ffi_wrapper.gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ void cgo_callfn_GDExtensionSpxExtSetPenSizeTo(const GDExtensionSpxExtSetPenSizeT
void cgo_callfn_GDExtensionSpxExtSetPenStampTexture(const GDExtensionSpxExtSetPenStampTexture fn, GdObj obj, GdString texture_path) {
fn(obj, texture_path);
}
void cgo_callfn_GDExtensionSpxExtCreateSpring(const GDExtensionSpxExtCreateSpring fn) {
fn();
}
void cgo_callfn_GDExtensionSpxExtDestroySpring(const GDExtensionSpxExtDestroySpring fn) {
fn();
}
void cgo_callfn_GDExtensionSpxExtClearSpring(const GDExtensionSpxExtClearSpring fn) {
fn();
}
void cgo_callfn_GDExtensionSpxExtNewSpringParticle(const GDExtensionSpxExtNewSpringParticle fn, GdVec2 position, GdBool fixed) {
fn(position, fixed);
}
void cgo_callfn_GDExtensionSpxInputGetMousePos(const GDExtensionSpxInputGetMousePos fn, GdVec2* ret_val) {
fn(ret_val);
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/gdspx/internal/ffi/gdextension_spx_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ typedef void (*GDExtensionSpxExtSetPenTo)(GdObj obj, GdInt property, GdFloat val
typedef void (*GDExtensionSpxExtChangePenSizeBy)(GdObj obj, GdFloat amount);
typedef void (*GDExtensionSpxExtSetPenSizeTo)(GdObj obj, GdFloat size);
typedef void (*GDExtensionSpxExtSetPenStampTexture)(GdObj obj, GdString texture_path);
typedef void (*GDExtensionSpxExtCreateSpring)();
typedef void (*GDExtensionSpxExtDestroySpring)();
typedef void (*GDExtensionSpxExtClearSpring)();
typedef void (*GDExtensionSpxExtNewSpringParticle)(GdVec2 position, GdBool fixed);
// SpxInput
typedef void (*GDExtensionSpxInputGetMousePos)(GdVec2* ret_value);
typedef void (*GDExtensionSpxInputGetKey)(GdInt key, GdBool* ret_value);
Expand Down
8 changes: 8 additions & 0 deletions pkg/gdspx/internal/webffi/ffi.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ type GDExtensionInterface struct {
SpxExtChangePenSizeBy js.Value
SpxExtSetPenSizeTo js.Value
SpxExtSetPenStampTexture js.Value
SpxExtCreateSpring js.Value
SpxExtDestroySpring js.Value
SpxExtClearSpring js.Value
SpxExtNewSpringParticle js.Value
SpxInputGetMousePos js.Value
SpxInputGetKey js.Value
SpxInputGetMouseState js.Value
Expand Down Expand Up @@ -297,6 +301,10 @@ func (x *GDExtensionInterface) loadProcAddresses() {
x.SpxExtChangePenSizeBy = dlsymGD("gdspx_ext_change_pen_size_by")
x.SpxExtSetPenSizeTo = dlsymGD("gdspx_ext_set_pen_size_to")
x.SpxExtSetPenStampTexture = dlsymGD("gdspx_ext_set_pen_stamp_texture")
x.SpxExtCreateSpring = dlsymGD("gdspx_ext_create_spring")
x.SpxExtDestroySpring = dlsymGD("gdspx_ext_destroy_spring")
x.SpxExtClearSpring = dlsymGD("gdspx_ext_clear_spring")
x.SpxExtNewSpringParticle = dlsymGD("gdspx_ext_new_spring_particle")
x.SpxInputGetMousePos = dlsymGD("gdspx_input_get_mouse_pos")
x.SpxInputGetKey = dlsymGD("gdspx_input_get_key")
x.SpxInputGetMouseState = dlsymGD("gdspx_input_get_mouse_state")
Expand Down
14 changes: 14 additions & 0 deletions pkg/gdspx/internal/wrap/manager_wrapper.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,20 @@ func (pself *extMgr) SetPenStampTexture(obj Object, texture_path string) {
defer C.free(unsafe.Pointer(arg1Str))
CallExtSetPenStampTexture(arg0, arg1)
}
func (pself *extMgr) CreateSpring() {
CallExtCreateSpring()
}
func (pself *extMgr) DestroySpring() {
CallExtDestroySpring()
}
func (pself *extMgr) ClearSpring() {
CallExtClearSpring()
}
func (pself *extMgr) NewSpringParticle(position Vec2, fixed bool) {
arg0 := ToGdVec2(position)
arg1 := ToGdBool(fixed)
CallExtNewSpringParticle(arg0, arg1)
}
func (pself *inputMgr) GetMousePos() Vec2 {
retValue := CallInputGetMousePos()
return ToVec2(retValue)
Expand Down
14 changes: 14 additions & 0 deletions pkg/gdspx/internal/wrap/manager_wrapper_web.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,20 @@ func (pself *extMgr) SetPenStampTexture(obj Object, texture_path string) {
arg1 := JsFromGdString(texture_path)
API.SpxExtSetPenStampTexture.Invoke(arg0, arg1)
}
func (pself *extMgr) CreateSpring() {
API.SpxExtCreateSpring.Invoke()
}
func (pself *extMgr) DestroySpring() {
API.SpxExtDestroySpring.Invoke()
}
func (pself *extMgr) ClearSpring() {
API.SpxExtClearSpring.Invoke()
}
func (pself *extMgr) NewSpringParticle(position Vec2, fixed bool) {
arg0 := JsFromGdVec2(position)
arg1 := JsFromGdBool(fixed)
API.SpxExtNewSpringParticle.Invoke(arg0, arg1)
}
func (pself *inputMgr) GetMousePos() Vec2 {
_retValue := API.SpxInputGetMousePos.Invoke()
return JsToGdVec2(_retValue)
Expand Down
4 changes: 4 additions & 0 deletions pkg/gdspx/pkg/engine/interface.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ type IExtMgr interface {
ChangePenSizeBy(obj Object, amount float64)
SetPenSizeTo(obj Object, size float64)
SetPenStampTexture(obj Object, texture_path string)
CreateSpring()
DestroySpring()
ClearSpring()
NewSpringParticle(position Vec2, fixed bool)
}

type IInputMgr interface {
Expand Down
9 changes: 9 additions & 0 deletions sprite.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ type Sprite interface {
Parent() *Game
PenDown()
PenUp()
CreateSpring()
DestroySpring()
PrevCostume()
Quote__0(message string)
Quote__1(message string, secs float64)
Expand Down Expand Up @@ -1772,6 +1774,13 @@ func (p *SpriteImpl) applyPenHsvProperty() {
extMgr.SetPenColorTo(*p.penObj, p.penColor)
}

func (p *SpriteImpl) CreateSpring() {
extMgr.CreateSpring()
}
func (p *SpriteImpl) DestroySpring() {
extMgr.DestroySpring()
}

// -----------------------------------------------------------------------------

func (p *SpriteImpl) HideVar(name string) {
Expand Down
2 changes: 2 additions & 0 deletions tutorial/00-Hello/Calf.spx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
onStart => {
say "Hello XGo"
hide
createSpring()
}
Loading