Skip to content
Merged
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
1 change: 1 addition & 0 deletions cmd/gox/pkg/gengo/pkg/github.com/goplus/spx/v2/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func init() {
NamedTypes: map[string]reflect.Type{
"Color": reflect.TypeOf((*q.Color)(nil)).Elem(),
"Config": reflect.TypeOf((*q.Config)(nil)).Elem(),
"DecoratorJSON": reflect.TypeOf((*q.DecoratorJSON)(nil)).Elem(),
"EffectKind": reflect.TypeOf((*q.EffectKind)(nil)).Elem(),
"Game": reflect.TypeOf((*q.Game)(nil)).Elem(),
"List": reflect.TypeOf((*q.List)(nil)).Elem(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@ func init() {
"sync": "sync",
},
Interfaces: map[string]reflect.Type{
"IAudioMgr": reflect.TypeOf((*q.IAudioMgr)(nil)).Elem(),
"ICameraMgr": reflect.TypeOf((*q.ICameraMgr)(nil)).Elem(),
"IDebugMgr": reflect.TypeOf((*q.IDebugMgr)(nil)).Elem(),
"IExtMgr": reflect.TypeOf((*q.IExtMgr)(nil)).Elem(),
"IInputMgr": reflect.TypeOf((*q.IInputMgr)(nil)).Elem(),
"ILifeCycle": reflect.TypeOf((*q.ILifeCycle)(nil)).Elem(),
"IManager": reflect.TypeOf((*q.IManager)(nil)).Elem(),
"INavigationMgr": reflect.TypeOf((*q.INavigationMgr)(nil)).Elem(),
"IPenMgr": reflect.TypeOf((*q.IPenMgr)(nil)).Elem(),
"IPhysicMgr": reflect.TypeOf((*q.IPhysicMgr)(nil)).Elem(),
"IPlatformMgr": reflect.TypeOf((*q.IPlatformMgr)(nil)).Elem(),
"IResMgr": reflect.TypeOf((*q.IResMgr)(nil)).Elem(),
"ISceneMgr": reflect.TypeOf((*q.ISceneMgr)(nil)).Elem(),
"ISpriteMgr": reflect.TypeOf((*q.ISpriteMgr)(nil)).Elem(),
"ISpriter": reflect.TypeOf((*q.ISpriter)(nil)).Elem(),
"ITilemapMgr": reflect.TypeOf((*q.ITilemapMgr)(nil)).Elem(),
"IUiMgr": reflect.TypeOf((*q.IUiMgr)(nil)).Elem(),
"IUiNode": reflect.TypeOf((*q.IUiNode)(nil)).Elem(),
"IAudioMgr": reflect.TypeOf((*q.IAudioMgr)(nil)).Elem(),
"ICameraMgr": reflect.TypeOf((*q.ICameraMgr)(nil)).Elem(),
"IDebugMgr": reflect.TypeOf((*q.IDebugMgr)(nil)).Elem(),
"IExtMgr": reflect.TypeOf((*q.IExtMgr)(nil)).Elem(),
"IInputMgr": reflect.TypeOf((*q.IInputMgr)(nil)).Elem(),
"ILifeCycle": reflect.TypeOf((*q.ILifeCycle)(nil)).Elem(),
"IManager": reflect.TypeOf((*q.IManager)(nil)).Elem(),
"INavigationMgr": reflect.TypeOf((*q.INavigationMgr)(nil)).Elem(),
"IPenMgr": reflect.TypeOf((*q.IPenMgr)(nil)).Elem(),
"IPhysicMgr": reflect.TypeOf((*q.IPhysicMgr)(nil)).Elem(),
"IPlatformMgr": reflect.TypeOf((*q.IPlatformMgr)(nil)).Elem(),
"IResMgr": reflect.TypeOf((*q.IResMgr)(nil)).Elem(),
"ISceneMgr": reflect.TypeOf((*q.ISceneMgr)(nil)).Elem(),
"ISpriteMgr": reflect.TypeOf((*q.ISpriteMgr)(nil)).Elem(),
"ISpriter": reflect.TypeOf((*q.ISpriter)(nil)).Elem(),
"ITilemapMgr": reflect.TypeOf((*q.ITilemapMgr)(nil)).Elem(),
"ITilemapparserMgr": reflect.TypeOf((*q.ITilemapparserMgr)(nil)).Elem(),
"IUiMgr": reflect.TypeOf((*q.IUiMgr)(nil)).Elem(),
"IUiNode": reflect.TypeOf((*q.IUiNode)(nil)).Elem(),
},
NamedTypes: map[string]reflect.Type{
"Action0": reflect.TypeOf((*q.Action0)(nil)).Elem(),
Expand Down Expand Up @@ -75,6 +76,7 @@ func init() {
"SceneMgr": reflect.ValueOf(&q.SceneMgr),
"SpriteMgr": reflect.ValueOf(&q.SpriteMgr),
"TilemapMgr": reflect.ValueOf(&q.TilemapMgr),
"TilemapparserMgr": reflect.ValueOf(&q.TilemapparserMgr),
"TimeSinceGameStart": reflect.ValueOf(&q.TimeSinceGameStart),
"UiMgr": reflect.ValueOf(&q.UiMgr),
},
Expand Down
106 changes: 53 additions & 53 deletions cmd/gox/template/platform/webworker/worker.wrap.gen.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/*------------------------------------------------------------------------------
// This code was generated by template worker.wrap.gen.js.tmpl.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Any updates should be done in
// "worker.wrap.gen.js.tmpl" so they can be included in the generated
// code.
//----------------------------------------------------------------------------*/
function BindFFI(goBridge) {
var ffi = {}
ffi.gdspx_on_engine_start = goBridge.getGoFunction("gdspx_on_engine_start")
ffi.gdspx_on_engine_update = goBridge.getGoFunction("gdspx_on_engine_update")
ffi.gdspx_on_engine_fixed_update = goBridge.getGoFunction("gdspx_on_engine_fixed_update")
ffi.gdspx_on_engine_destroy = goBridge.getGoFunction("gdspx_on_engine_destroy")
ffi.gdspx_on_engine_reset = goBridge.getGoFunction("gdspx_on_engine_reset")
ffi.gdspx_on_engine_pause = goBridge.getGoFunction("gdspx_on_engine_pause")
ffi.gdspx_on_scene_sprite_instantiated = goBridge.getGoFunction("gdspx_on_scene_sprite_instantiated")
ffi.gdspx_on_sprite_ready = goBridge.getGoFunction("gdspx_on_sprite_ready")
ffi.gdspx_on_sprite_updated = goBridge.getGoFunction("gdspx_on_sprite_updated")
ffi.gdspx_on_sprite_fixed_updated = goBridge.getGoFunction("gdspx_on_sprite_fixed_updated")
ffi.gdspx_on_sprite_destroyed = goBridge.getGoFunction("gdspx_on_sprite_destroyed")
ffi.gdspx_on_sprite_frames_set_changed = goBridge.getGoFunction("gdspx_on_sprite_frames_set_changed")
ffi.gdspx_on_sprite_animation_changed = goBridge.getGoFunction("gdspx_on_sprite_animation_changed")
ffi.gdspx_on_sprite_frame_changed = goBridge.getGoFunction("gdspx_on_sprite_frame_changed")
ffi.gdspx_on_sprite_animation_looped = goBridge.getGoFunction("gdspx_on_sprite_animation_looped")
ffi.gdspx_on_sprite_animation_finished = goBridge.getGoFunction("gdspx_on_sprite_animation_finished")
ffi.gdspx_on_sprite_vfx_finished = goBridge.getGoFunction("gdspx_on_sprite_vfx_finished")
ffi.gdspx_on_sprite_screen_exited = goBridge.getGoFunction("gdspx_on_sprite_screen_exited")
ffi.gdspx_on_sprite_screen_entered = goBridge.getGoFunction("gdspx_on_sprite_screen_entered")
ffi.gdspx_on_mouse_pressed = goBridge.getGoFunction("gdspx_on_mouse_pressed")
ffi.gdspx_on_mouse_released = goBridge.getGoFunction("gdspx_on_mouse_released")
ffi.gdspx_on_key_pressed = goBridge.getGoFunction("gdspx_on_key_pressed")
ffi.gdspx_on_key_released = goBridge.getGoFunction("gdspx_on_key_released")
ffi.gdspx_on_action_pressed = goBridge.getGoFunction("gdspx_on_action_pressed")
ffi.gdspx_on_action_just_pressed = goBridge.getGoFunction("gdspx_on_action_just_pressed")
ffi.gdspx_on_action_just_released = goBridge.getGoFunction("gdspx_on_action_just_released")
ffi.gdspx_on_axis_changed = goBridge.getGoFunction("gdspx_on_axis_changed")
ffi.gdspx_on_collision_enter = goBridge.getGoFunction("gdspx_on_collision_enter")
ffi.gdspx_on_collision_stay = goBridge.getGoFunction("gdspx_on_collision_stay")
ffi.gdspx_on_collision_exit = goBridge.getGoFunction("gdspx_on_collision_exit")
ffi.gdspx_on_trigger_enter = goBridge.getGoFunction("gdspx_on_trigger_enter")
ffi.gdspx_on_trigger_stay = goBridge.getGoFunction("gdspx_on_trigger_stay")
ffi.gdspx_on_trigger_exit = goBridge.getGoFunction("gdspx_on_trigger_exit")
ffi.gdspx_on_ui_ready = goBridge.getGoFunction("gdspx_on_ui_ready")
ffi.gdspx_on_ui_updated = goBridge.getGoFunction("gdspx_on_ui_updated")
ffi.gdspx_on_ui_destroyed = goBridge.getGoFunction("gdspx_on_ui_destroyed")
ffi.gdspx_on_ui_pressed = goBridge.getGoFunction("gdspx_on_ui_pressed")
ffi.gdspx_on_ui_released = goBridge.getGoFunction("gdspx_on_ui_released")
ffi.gdspx_on_ui_hovered = goBridge.getGoFunction("gdspx_on_ui_hovered")
ffi.gdspx_on_ui_clicked = goBridge.getGoFunction("gdspx_on_ui_clicked")
ffi.gdspx_on_ui_toggle = goBridge.getGoFunction("gdspx_on_ui_toggle")
ffi.gdspx_on_ui_text_changed = goBridge.getGoFunction("gdspx_on_ui_text_changed")
return ffi
/*------------------------------------------------------------------------------
// This code was generated by template worker.wrap.gen.js.tmpl.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Any updates should be done in
// "worker.wrap.gen.js.tmpl" so they can be included in the generated
// code.
//----------------------------------------------------------------------------*/
function BindFFI(goBridge) {
var ffi = {}
ffi.gdspx_on_engine_start = goBridge.getGoFunction("gdspx_on_engine_start")
ffi.gdspx_on_engine_update = goBridge.getGoFunction("gdspx_on_engine_update")
ffi.gdspx_on_engine_fixed_update = goBridge.getGoFunction("gdspx_on_engine_fixed_update")
ffi.gdspx_on_engine_destroy = goBridge.getGoFunction("gdspx_on_engine_destroy")
ffi.gdspx_on_engine_reset = goBridge.getGoFunction("gdspx_on_engine_reset")
ffi.gdspx_on_engine_pause = goBridge.getGoFunction("gdspx_on_engine_pause")
ffi.gdspx_on_scene_sprite_instantiated = goBridge.getGoFunction("gdspx_on_scene_sprite_instantiated")
ffi.gdspx_on_sprite_ready = goBridge.getGoFunction("gdspx_on_sprite_ready")
ffi.gdspx_on_sprite_updated = goBridge.getGoFunction("gdspx_on_sprite_updated")
ffi.gdspx_on_sprite_fixed_updated = goBridge.getGoFunction("gdspx_on_sprite_fixed_updated")
ffi.gdspx_on_sprite_destroyed = goBridge.getGoFunction("gdspx_on_sprite_destroyed")
ffi.gdspx_on_sprite_frames_set_changed = goBridge.getGoFunction("gdspx_on_sprite_frames_set_changed")
ffi.gdspx_on_sprite_animation_changed = goBridge.getGoFunction("gdspx_on_sprite_animation_changed")
ffi.gdspx_on_sprite_frame_changed = goBridge.getGoFunction("gdspx_on_sprite_frame_changed")
ffi.gdspx_on_sprite_animation_looped = goBridge.getGoFunction("gdspx_on_sprite_animation_looped")
ffi.gdspx_on_sprite_animation_finished = goBridge.getGoFunction("gdspx_on_sprite_animation_finished")
ffi.gdspx_on_sprite_vfx_finished = goBridge.getGoFunction("gdspx_on_sprite_vfx_finished")
ffi.gdspx_on_sprite_screen_exited = goBridge.getGoFunction("gdspx_on_sprite_screen_exited")
ffi.gdspx_on_sprite_screen_entered = goBridge.getGoFunction("gdspx_on_sprite_screen_entered")
ffi.gdspx_on_mouse_pressed = goBridge.getGoFunction("gdspx_on_mouse_pressed")
ffi.gdspx_on_mouse_released = goBridge.getGoFunction("gdspx_on_mouse_released")
ffi.gdspx_on_key_pressed = goBridge.getGoFunction("gdspx_on_key_pressed")
ffi.gdspx_on_key_released = goBridge.getGoFunction("gdspx_on_key_released")
ffi.gdspx_on_action_pressed = goBridge.getGoFunction("gdspx_on_action_pressed")
ffi.gdspx_on_action_just_pressed = goBridge.getGoFunction("gdspx_on_action_just_pressed")
ffi.gdspx_on_action_just_released = goBridge.getGoFunction("gdspx_on_action_just_released")
ffi.gdspx_on_axis_changed = goBridge.getGoFunction("gdspx_on_axis_changed")
ffi.gdspx_on_collision_enter = goBridge.getGoFunction("gdspx_on_collision_enter")
ffi.gdspx_on_collision_stay = goBridge.getGoFunction("gdspx_on_collision_stay")
ffi.gdspx_on_collision_exit = goBridge.getGoFunction("gdspx_on_collision_exit")
ffi.gdspx_on_trigger_enter = goBridge.getGoFunction("gdspx_on_trigger_enter")
ffi.gdspx_on_trigger_stay = goBridge.getGoFunction("gdspx_on_trigger_stay")
ffi.gdspx_on_trigger_exit = goBridge.getGoFunction("gdspx_on_trigger_exit")
ffi.gdspx_on_ui_ready = goBridge.getGoFunction("gdspx_on_ui_ready")
ffi.gdspx_on_ui_updated = goBridge.getGoFunction("gdspx_on_ui_updated")
ffi.gdspx_on_ui_destroyed = goBridge.getGoFunction("gdspx_on_ui_destroyed")
ffi.gdspx_on_ui_pressed = goBridge.getGoFunction("gdspx_on_ui_pressed")
ffi.gdspx_on_ui_released = goBridge.getGoFunction("gdspx_on_ui_released")
ffi.gdspx_on_ui_hovered = goBridge.getGoFunction("gdspx_on_ui_hovered")
ffi.gdspx_on_ui_clicked = goBridge.getGoFunction("gdspx_on_ui_clicked")
ffi.gdspx_on_ui_toggle = goBridge.getGoFunction("gdspx_on_ui_toggle")
ffi.gdspx_on_ui_text_changed = goBridge.getGoFunction("gdspx_on_ui_text_changed")
return ffi
}
1 change: 1 addition & 0 deletions cmd/igox/pkg/github.com/goplus/spx/v2/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func init() {
NamedTypes: map[string]reflect.Type{
"Color": reflect.TypeOf((*q.Color)(nil)).Elem(),
"Config": reflect.TypeOf((*q.Config)(nil)).Elem(),
"DecoratorJSON": reflect.TypeOf((*q.DecoratorJSON)(nil)).Elem(),
"EffectKind": reflect.TypeOf((*q.EffectKind)(nil)).Elem(),
"Game": reflect.TypeOf((*q.Game)(nil)).Elem(),
"List": reflect.TypeOf((*q.List)(nil)).Elem(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,25 @@ func init() {
"sync": "sync",
},
Interfaces: map[string]reflect.Type{
"IAudioMgr": reflect.TypeOf((*q.IAudioMgr)(nil)).Elem(),
"ICameraMgr": reflect.TypeOf((*q.ICameraMgr)(nil)).Elem(),
"IDebugMgr": reflect.TypeOf((*q.IDebugMgr)(nil)).Elem(),
"IExtMgr": reflect.TypeOf((*q.IExtMgr)(nil)).Elem(),
"IInputMgr": reflect.TypeOf((*q.IInputMgr)(nil)).Elem(),
"ILifeCycle": reflect.TypeOf((*q.ILifeCycle)(nil)).Elem(),
"IManager": reflect.TypeOf((*q.IManager)(nil)).Elem(),
"INavigationMgr": reflect.TypeOf((*q.INavigationMgr)(nil)).Elem(),
"IPenMgr": reflect.TypeOf((*q.IPenMgr)(nil)).Elem(),
"IPhysicMgr": reflect.TypeOf((*q.IPhysicMgr)(nil)).Elem(),
"IPlatformMgr": reflect.TypeOf((*q.IPlatformMgr)(nil)).Elem(),
"IResMgr": reflect.TypeOf((*q.IResMgr)(nil)).Elem(),
"ISceneMgr": reflect.TypeOf((*q.ISceneMgr)(nil)).Elem(),
"ISpriteMgr": reflect.TypeOf((*q.ISpriteMgr)(nil)).Elem(),
"ISpriter": reflect.TypeOf((*q.ISpriter)(nil)).Elem(),
"ITilemapMgr": reflect.TypeOf((*q.ITilemapMgr)(nil)).Elem(),
"IUiMgr": reflect.TypeOf((*q.IUiMgr)(nil)).Elem(),
"IUiNode": reflect.TypeOf((*q.IUiNode)(nil)).Elem(),
"IAudioMgr": reflect.TypeOf((*q.IAudioMgr)(nil)).Elem(),
"ICameraMgr": reflect.TypeOf((*q.ICameraMgr)(nil)).Elem(),
"IDebugMgr": reflect.TypeOf((*q.IDebugMgr)(nil)).Elem(),
"IExtMgr": reflect.TypeOf((*q.IExtMgr)(nil)).Elem(),
"IInputMgr": reflect.TypeOf((*q.IInputMgr)(nil)).Elem(),
"ILifeCycle": reflect.TypeOf((*q.ILifeCycle)(nil)).Elem(),
"IManager": reflect.TypeOf((*q.IManager)(nil)).Elem(),
"INavigationMgr": reflect.TypeOf((*q.INavigationMgr)(nil)).Elem(),
"IPenMgr": reflect.TypeOf((*q.IPenMgr)(nil)).Elem(),
"IPhysicMgr": reflect.TypeOf((*q.IPhysicMgr)(nil)).Elem(),
"IPlatformMgr": reflect.TypeOf((*q.IPlatformMgr)(nil)).Elem(),
"IResMgr": reflect.TypeOf((*q.IResMgr)(nil)).Elem(),
"ISceneMgr": reflect.TypeOf((*q.ISceneMgr)(nil)).Elem(),
"ISpriteMgr": reflect.TypeOf((*q.ISpriteMgr)(nil)).Elem(),
"ISpriter": reflect.TypeOf((*q.ISpriter)(nil)).Elem(),
"ITilemapMgr": reflect.TypeOf((*q.ITilemapMgr)(nil)).Elem(),
"ITilemapparserMgr": reflect.TypeOf((*q.ITilemapparserMgr)(nil)).Elem(),
"IUiMgr": reflect.TypeOf((*q.IUiMgr)(nil)).Elem(),
"IUiNode": reflect.TypeOf((*q.IUiNode)(nil)).Elem(),
},
NamedTypes: map[string]reflect.Type{
"Action0": reflect.TypeOf((*q.Action0)(nil)).Elem(),
Expand Down Expand Up @@ -75,6 +76,7 @@ func init() {
"SceneMgr": reflect.ValueOf(&q.SceneMgr),
"SpriteMgr": reflect.ValueOf(&q.SpriteMgr),
"TilemapMgr": reflect.ValueOf(&q.TilemapMgr),
"TilemapparserMgr": reflect.ValueOf(&q.TilemapparserMgr),
"TimeSinceGameStart": reflect.ValueOf(&q.TimeSinceGameStart),
"UiMgr": reflect.ValueOf(&q.UiMgr),
},
Expand Down
27 changes: 27 additions & 0 deletions game_tilemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,30 @@ func (p *Game) createStaticSprite(texturePath string, pos mathf.Vec2, rot float6
colliderTypeInt := parseColliderShapeType(colliderType, 0)
sceneMgr.CreateStaticSprite(engine.ToAssetPath(texturePath), pos, rot, scale, zindex, pivot, colliderTypeInt, colliderPivot, colliderParams)
}

// ============================================================================
// Dynamic Tilemap Loading API
// ============================================================================

// LoadTilemap dynamically loads a tilemap from the specified path
// mapDir can be either:
// - A directory path (new format): "tilemaps/map1" -> uses C++ TileMapParser
// - A file path (old format): "tilemaps/map1.json" -> uses Go loader
//
// This will unload any currently loaded tilemap before loading the new one.
func (p *Game) LoadTilemap(mapDir string) {
p.tilemapMgr.unloadMap()
p.tilemapMgr.loadMap(mapDir)
p.tilemapMgr.parseTilemap()
}

// UnloadTilemap unloads the currently loaded tilemap and cleans up resources
func (p *Game) UnloadTilemap() {
p.tilemapMgr.unloadMap()
}

// TilemapName returns the name of the currently loaded tilemap
// Returns empty string if no tilemap is loaded
func (p *Game) TilemapName() string {
return p.tilemapMgr.getCurrentMap()
}
29 changes: 15 additions & 14 deletions gdspx.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@ import (

// copy these variable to any namespace you want
var (
audioMgr enginewrap.AudioMgrImpl
cameraMgr enginewrap.CameraMgrImpl
inputMgr enginewrap.InputMgrImpl
physicMgr enginewrap.PhysicMgrImpl
platformMgr enginewrap.PlatformMgrImpl
resMgr enginewrap.ResMgrImpl
sceneMgr enginewrap.SceneMgrImpl
spriteMgr enginewrap.SpriteMgrImpl
uiMgr enginewrap.UiMgrImpl
extMgr enginewrap.ExtMgrImpl
penMgr enginewrap.PenMgrImpl
debugMgr enginewrap.DebugMgrImpl
navigationMgr enginewrap.NavigationMgrImpl
tilemapMgr enginewrap.TilemapMgrImpl
audioMgr enginewrap.AudioMgrImpl
cameraMgr enginewrap.CameraMgrImpl
inputMgr enginewrap.InputMgrImpl
physicMgr enginewrap.PhysicMgrImpl
platformMgr enginewrap.PlatformMgrImpl
resMgr enginewrap.ResMgrImpl
sceneMgr enginewrap.SceneMgrImpl
spriteMgr enginewrap.SpriteMgrImpl
uiMgr enginewrap.UiMgrImpl
extMgr enginewrap.ExtMgrImpl
penMgr enginewrap.PenMgrImpl
debugMgr enginewrap.DebugMgrImpl
navigationMgr enginewrap.NavigationMgrImpl
tilemapMgr enginewrap.TilemapMgrImpl
tilemapparserMgr enginewrap.TilemapparserMgrImpl
)

var (
Expand Down
Loading
Loading