Documentation ¶
Index ¶
- Constants
- func DelObject(obj Object)
- func GetBhvrIDs() []int
- func GetBhvrIDsByBhvrTypeID(id int) []int
- func GetBhvrIDsByObjInstID(id int) []int
- func GetBhvrTypes() []string
- func GetCanvasSize() (w, h int)
- func GetInstIDByBhvrInstID(id int) int
- func GetInstIDs() []int
- func GetInstIDsByBhvrTypeID(id int) []int
- func GetInstIDsByObjTypeID(id int) []int
- func GetInstTypes() []string
- func GetScreenSize() (w, h int)
- func ID(ins Instance) int
- func PrintDebug() string
- func Run() error
- func SetCanvasSize(w, h int)
- func SetCustomLayoutFunction(fn func(outsideWidth, outsideHeight int) (screenWidth, screenHeight int))
- func SetLayoutType(layoutType LayoutType)
- func Type(ins Instance) string
- func TypeID(ins Instance) int
- type Behaviour
- type BehavioursData
- type Instance
- type Instancer
- type LayoutType
- type Object
- type Objecter
Constants ¶
const ( ErrInstanceNotFound = "ErrInstanceNotFound" ErrBehaviourNotFound = "ErrBehaviourNotFound" ErrParentObjectNotFound = "ErrParentObjectNotFound" )
const ( // If you develop game for mobile it's better to use this default size (if portrait) DefaultCanvasW int = 372 // safe zone area is 270 pixel (based on 20:9), which is pixel 51-321 DefaultCanvasH int = 600 // safe zone area is 496 pixel (based on 4:3), which is pixel 52-548 )
Variables ¶
This section is empty.
Functions ¶
func GetBhvrIDs ¶
func GetBhvrIDs() []int
func GetBhvrIDsByBhvrTypeID ¶
func GetBhvrIDsByObjInstID ¶
func GetBhvrTypes ¶
func GetBhvrTypes() []string
func GetCanvasSize ¶
func GetCanvasSize() (w, h int)
func GetInstIDByBhvrInstID ¶
func GetInstIDs ¶
func GetInstIDs() []int
func GetInstIDsByBhvrTypeID ¶
func GetInstIDsByObjTypeID ¶
func GetInstTypes ¶
func GetInstTypes() []string
func GetScreenSize ¶
func GetScreenSize() (w, h int)
func ID ¶
ID returns the instance's ID. It is not safe for use on search query. If it is never been set on game_data before, it will return 0.
func PrintDebug ¶
func PrintDebug() string
func SetCanvasSize ¶
func SetCanvasSize(w, h int)
func SetCustomLayoutFunction ¶
func SetCustomLayoutFunction(fn func(outsideWidth, outsideHeight int) (screenWidth, screenHeight int))
SetCustomLayoutFunction set user's custom Layout function. Setting this not automatically use this function. You should set the layout type to LayoutType_Custom to use this.
func SetLayoutType ¶
func SetLayoutType(layoutType LayoutType)
func Type ¶
Type returns the instance's Type. It is a guarantee that it will not return empty string, but doesn't mean that this already set on game_data. If it is an instance of Object, it is better to use it once, and cache it on some variable, because it is VERY EXPENSIVE (using reflect). If it is a Behaviour or BehavioursData, you don't need to cache it, because it will autaomatically cached on BehavioursData.
func TypeID ¶
TypeID returns the instance's TypeID. It is a guarantee that it will not return 0. It will automatically set the Type, TypeID, and BehavioursData to the game_data. If it is an instance of Object, it is better to use it once, and cache it on some variable, because it is VERY EXPENSIVE (using reflect). If it is a Behaviour or BehavioursData, you don't need to cache it, because it will automatically cached on BehavioursData.
Types ¶
type Behaviour ¶
type Behaviour interface { Instance Data() BehavioursData PreInit() PostInit() // PreUpdate() // PostUpdate() Draw(*ebiten.Image) }
TODO: Consider different interface between Behaviour and Object
func GetBhvrByBhvrInstID ¶
func MustGetBehaviour ¶
Get Behaviour by type. Must return, panic if not found.
func MustGetBehaviourRel ¶
Get relative's Behaviour by type. Must return, panic if not found.
type BehavioursData ¶
type BehavioursData interface { Instance Behaviour() Behaviour // ByInstance(Object) interface{} DelInstance(Object) PreUpdate() PostUpdate() }
func GetBhvrDataByBhvrTypeID ¶
func GetBhvrDataByBhvrTypeID(id int) BehavioursData
func GetBhvrDatas ¶
func GetBhvrDatas() []BehavioursData
type LayoutType ¶
type LayoutType int
const ( // LayoutType_Canvas means that the size of game screen will follow the game's canvas. See the // implementation in game's Layout function. LayoutType_SnapCanvas LayoutType = iota // LayoutType_Outside means that the size of game screen will follow the game's device/window. See // the implementation in game's Layout function. LayoutType_SnapOutside // LayoutType_Custom means that the size of game screen will follow user's function. LayoutType_Custom )
type Object ¶
type Object interface { Instance Zidx() int SetZidx(int) IsUpdate() bool SetIsUpdate(bool) IsDraw() bool SetIsDraw(bool) Init() Update() Draw(*ebiten.Image) // contains filtered or unexported methods }
TODO: Consider different interface between Behaviour and Object
func GetInstByObjInstID ¶
func MustGetObjectParent ¶
Get behaviour's parent. Must return, panic if not found.
type Objecter ¶
type Objecter struct { Instancer // contains filtered or unexported fields }