Documentation ¶
Index ¶
- Constants
- type AsyncHandler
- type DB
- type DebugDrawComp
- type FPS
- type Game
- func (g *Game) Camera() *gfx.Camera
- func (g *Game) Create(w, h float32, ratio float32)
- func (g *Game) Destroy()
- func (g *Game) Draw(dt float32)
- func (g *Game) DrawProfile()
- func (g *Game) Init()
- func (g *Game) Input(dt float32)
- func (g *Game) OnCreate(w, h float32, ratio float32)
- func (g *Game) OnDestroy()
- func (g *Game) OnFocusChanged(focused bool)
- func (g *Game) OnKeyEvent(key int, pressed bool)
- func (g *Game) OnLoop()
- func (g *Game) OnPause()
- func (g *Game) OnPointEvent(key int, pressed bool, x, y float32)
- func (g *Game) OnResize(w, h int32)
- func (g *Game) OnResume()
- func (g *Game) Update()
- type Loader
- type LoaderState
- type Options
- type Scene
- type SceneManager
- func (sm *SceneManager) Clear()
- func (*SceneManager) Load(sn Scene)
- func (sm *SceneManager) Peek() (sn Scene, ok bool)
- func (sm *SceneManager) Pop() (sn Scene, ok bool)
- func (sm *SceneManager) Push(sn Scene)
- func (sm *SceneManager) SetDefault(sn Scene)
- func (sm *SceneManager) Setup(g *Game)
- func (*SceneManager) UnLoad(sn Scene)
- func (sm *SceneManager) Update(dt float32)
- type Script
- type ScriptComp
- type ScriptSystem
- type ScriptTable
- type Table
- type TagComp
- type TagTable
- func (tt *TagTable) Alive(entity engi.Entity) bool
- func (tt *TagTable) Comp(entity engi.Entity) (tc *TagComp)
- func (tt *TagTable) Delete(entity engi.Entity) (tc *TagComp)
- func (tt *TagTable) DeleteTag(entity engi.Entity)
- func (tt *TagTable) Group(tag string) []engi.Entity
- func (tt *TagTable) NewComp(entity engi.Entity) (tc *TagComp)
- func (tt *TagTable) Size() (size, cap int)
- type UnLoader
Constants ¶
const ( MaxScriptSize = 1024 MaxSpriteSize = 64 << 10 MaxTransformSize = 64 << 10 MaxTextSize = 64 << 10 MaxMeshSize = 64 << 10 MaxParticleSize = 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncHandler ¶
type AsyncHandler chan bool
type DB ¶
type DB struct { EntityM *engi.EntityManager Tables []interface{} }
type DebugDrawComp ¶
type DebugDrawComp struct { }
type Game ¶
type Game struct { Options FPS DB // scene manager SceneManager // system *gfx.RenderSystem *input.InputSystem *effect.ParticleSimulateSystem *ScriptSystem *anim.AnimationSystem // contains filtered or unexported fields }
var G *Game
统一管理游戏各个子系统的创建和销毁的地方
func (*Game) DrawProfile ¶
func (g *Game) DrawProfile()
func (*Game) OnFocusChanged ¶
type LoaderState ¶
type LoaderState struct {
// contains filtered or unexported fields
}
type Scene ¶
Scene has lifecycle callback. OnEnter is called when the scene is shown. Update is called each frame. OnExit is called when the scene is hided.
type SceneManager ¶
type SceneManager struct {
// contains filtered or unexported fields
}
SceneManager manages scenes.
func (*SceneManager) Clear ¶
func (sm *SceneManager) Clear()
func (*SceneManager) Peek ¶
func (sm *SceneManager) Peek() (sn Scene, ok bool)
func (*SceneManager) Pop ¶
func (sm *SceneManager) Pop() (sn Scene, ok bool)
func (*SceneManager) Push ¶
func (sm *SceneManager) Push(sn Scene)
func (*SceneManager) SetDefault ¶
func (sm *SceneManager) SetDefault(sn Scene)
SetDefault sets the default Scene before the Game start. It's designed for internal usage. You should not use it.
func (*SceneManager) Setup ¶
func (sm *SceneManager) Setup(g *Game)
func (*SceneManager) UnLoad ¶
func (*SceneManager) UnLoad(sn Scene)
func (*SceneManager) Update ¶
func (sm *SceneManager) Update(dt float32)
type ScriptComp ¶
func (*ScriptComp) SetScript ¶
func (sc *ScriptComp) SetScript(script Script)
type ScriptSystem ¶
type ScriptSystem struct {
*ScriptTable
}
func NewScriptSystem ¶
func NewScriptSystem() *ScriptSystem
func (*ScriptSystem) RequireTable ¶
func (ss *ScriptSystem) RequireTable(tables []interface{})
func (*ScriptSystem) Update ¶
func (ss *ScriptSystem) Update(dt float32)
type ScriptTable ¶
type ScriptTable struct {
// contains filtered or unexported fields
}
func NewScriptTable ¶
func NewScriptTable(cap int) *ScriptTable
func (*ScriptTable) Comp ¶
func (st *ScriptTable) Comp(entity engi.Entity) (sc *ScriptComp)
func (*ScriptTable) Delete ¶
func (st *ScriptTable) Delete(entity engi.Entity)
func (*ScriptTable) NewComp ¶
func (st *ScriptTable) NewComp(entity engi.Entity, script Script) (sc *ScriptComp)
func (*ScriptTable) Size ¶
func (st *ScriptTable) Size() (size, cap int)
type TagComp ¶
* 标记并分类游戏对象, 在 Tag (Name) 的基础上再加一个 Label,作为二级分类, 在游戏中,很多时候是需要这样的二级分类的。比如: enemy {bullet, ship}
http://bitsquid.blogspot.se/2015/06/allocation-adventures-1-datacomponent.html http://bitsquid.blogspot.com/2015/06/allocation-adventures-2-arrays-of-arrays.html
关于 string 比较的问题,还需要研究:https://stackoverflow.com/questions/20232976/how-does-go-do-string-comparison
关于 Tag 系统的设计,可以学下一下