Documentation ¶
Index ¶
- Constants
- Variables
- func BoxIntersectsSphere(cube go4game.HyperRect, c go4game.Vector3D, r float64) bool
- func CollCube2Sphere(cc *Cube, sp *Sphere) bool
- type Apple
- type CmdReceiver
- type Collider
- type Cube
- type GameObjBase
- type GameObjI
- type InteractType
- type NearInfo
- type OGActor
- type ObjGroupBase
- func (og *ObjGroupBase) AddGameObj(o GameObjI)
- func (og *ObjGroupBase) AddInitMembers()
- func (og *ObjGroupBase) AddToOctreeVol(ot *OctreeVol)
- func (og *ObjGroupBase) FrameActionResult() interface{}
- func (og *ObjGroupBase) GameObjI() map[int64]GameObjI
- func (og *ObjGroupBase) ID() int64
- func (og *ObjGroupBase) RemoveGameObj(id int64)
- func (og *ObjGroupBase) StartFrameAction(world WorldI, ftime time.Time)
- type ObjGroupI
- type OctreeVol
- type OctreeVolObjI
- type Plum
- type Snake
- func (og *Snake) AddGameObj(o GameObjI)
- func (og *Snake) AddInitMembers()
- func (og *Snake) AddToOctreeVol(ot *OctreeVol)
- func (og *Snake) FrameActionResult() interface{}
- func (og *Snake) GameObjI() map[int64]GameObjI
- func (og *Snake) ID() int64
- func (og *Snake) RemoveGameObj(id int64)
- func (og *Snake) StartFrameAction(world WorldI, ftime time.Time)
- type SnakeConfig
- type SnakeHead
- type SnakeService
- type SnakeTail
- type Sphere
- type StageApples
- func (og *StageApples) AddGameObj(o GameObjI)
- func (og *StageApples) AddInitMembers()
- func (og *StageApples) AddToOctreeVol(ot *OctreeVol)
- func (og *StageApples) FrameActionResult() interface{}
- func (og *StageApples) GameObjI() map[int64]GameObjI
- func (og *StageApples) ID() int64
- func (og *StageApples) RemoveGameObj(id int64)
- func (og *StageApples) StartFrameAction(world WorldI, ftime time.Time)
- type StagePlums
- func (og *StagePlums) AddGameObj(o GameObjI)
- func (og *StagePlums) AddInitMembers()
- func (og *StagePlums) AddToOctreeVol(ot *OctreeVol)
- func (og *StagePlums) FrameActionResult() interface{}
- func (og *StagePlums) GameObjI() map[int64]GameObjI
- func (og *StagePlums) ID() int64
- func (og *StagePlums) RemoveGameObj(id int64)
- func (og *StagePlums) StartFrameAction(world WorldI, ftime time.Time)
- type StageWalls
- func (og *StageWalls) AddGameObj(o GameObjI)
- func (og *StageWalls) AddInitMembers()
- func (og *StageWalls) AddToOctreeVol(ot *OctreeVol)
- func (og *StageWalls) FrameActionResult() interface{}
- func (og *StageWalls) GameObjI() map[int64]GameObjI
- func (og *StageWalls) ID() int64
- func (og *StageWalls) RemoveGameObj(id int64)
- func (og *StageWalls) StartFrameAction(world WorldI, ftime time.Time)
- type Wall
- type World
- func (w *World) AddObjGroup(og ObjGroupI)
- func (w *World) CollideList(o GameObjI) []GameObjI
- func (w *World) Do1Frame(ftime time.Time) bool
- func (w *World) ID() int64
- func (w *World) ListNearObj(hr *go4game.HyperRect) []GameObjI
- func (w *World) Loop()
- func (w *World) MakeOctreeVol() *OctreeVol
- func (w *World) RemoveObjGroup(id int64)
- func (w *World) SendGoCmd(Cmd string, Args interface{}, Rsp chan<- interface{})
- func (w World) String() string
- type WorldI
Constants ¶
View Source
const (
MaxOctreeVolData = 8
)
View Source
const WorldSize = 500
View Source
const WorldSizeY = 500
Variables ¶
View Source
var SnakeDefault = SnakeConfig{ WorldCube: &go4game.HyperRect{ go4game.Vector3D{-WorldSize, -WorldSizeY, -WorldSize}, go4game.Vector3D{WorldSize, WorldSizeY, WorldSize}}, FramePerSec: 60.0, }
Functions ¶
func BoxIntersectsSphere ¶
func CollCube2Sphere ¶
Types ¶
type Apple ¶
type Apple struct { GameObjBase Sphere }
func (*Apple) ToOctreeVolObj ¶
func (o *Apple) ToOctreeVolObj() OctreeVolObjI
type CmdReceiver ¶
type CmdReceiver interface { SendGoCmd(Cmd string, Args interface{}, Rsp chan<- interface{}) Loop() }
type GameObjBase ¶
func MakeGameObjBase ¶
func MakeGameObjBase(og ObjGroupI, color uint32) GameObjBase
type GameObjI ¶
type GameObjI interface { ID() int64 OctreeVolObjI ToOctreeVolObj() OctreeVolObjI ActByTime(w WorldI, t time.Time) }
type InteractType ¶
type InteractType int
const ( NoInteract InteractType = iota InteractRemove InteractBlock )
type ObjGroupBase ¶
type ObjGroupBase struct {
// contains filtered or unexported fields
}
func NewObjGroup ¶
func NewObjGroup(w *World) *ObjGroupBase
func (*ObjGroupBase) AddGameObj ¶
func (og *ObjGroupBase) AddGameObj(o GameObjI)
func (*ObjGroupBase) AddInitMembers ¶
func (og *ObjGroupBase) AddInitMembers()
func (*ObjGroupBase) AddToOctreeVol ¶
func (og *ObjGroupBase) AddToOctreeVol(ot *OctreeVol)
func (*ObjGroupBase) FrameActionResult ¶
func (og *ObjGroupBase) FrameActionResult() interface{}
func (*ObjGroupBase) GameObjI ¶
func (og *ObjGroupBase) GameObjI() map[int64]GameObjI
func (*ObjGroupBase) ID ¶
func (og *ObjGroupBase) ID() int64
func (*ObjGroupBase) RemoveGameObj ¶
func (og *ObjGroupBase) RemoveGameObj(id int64)
func (*ObjGroupBase) StartFrameAction ¶
func (og *ObjGroupBase) StartFrameAction(world WorldI, ftime time.Time)
type OctreeVol ¶
type OctreeVol struct { BoundCube *go4game.HyperRect Center go4game.Vector3D DataList []OctreeVolObjI Children [8]*OctreeVol }
func NewOctreeVol ¶
func (*OctreeVol) Insert ¶
func (ot *OctreeVol) Insert(o OctreeVolObjI) bool
func (*OctreeVol) InsertChild ¶
func (ot *OctreeVol) InsertChild(o OctreeVolObjI) bool
func (*OctreeVol) QueryByHyperRect ¶
type OctreeVolObjI ¶
type Plum ¶
type Plum struct { GameObjBase MoveVector go4game.Vector3D Sphere }
func (*Plum) ToOctreeVolObj ¶
func (o *Plum) ToOctreeVolObj() OctreeVolObjI
type Snake ¶
type Snake struct { ObjGroupBase Color uint32 HeadID int64 }
func (*Snake) AddGameObj ¶
func (*Snake) AddInitMembers ¶
func (og *Snake) AddInitMembers()
func (*Snake) AddToOctreeVol ¶
func (*Snake) FrameActionResult ¶
func (og *Snake) FrameActionResult() interface{}
func (*Snake) RemoveGameObj ¶
type SnakeConfig ¶
type SnakeConfig struct { WorldCube *go4game.HyperRect WorldDiag float64 WorldCube2 *go4game.HyperRect // for octree WorldDiag2 float64 FramePerSec float64 }
func (*SnakeConfig) Load ¶
func (config *SnakeConfig) Load(filename string) bool
func (*SnakeConfig) Save ¶
func (config *SnakeConfig) Save(filename string) bool
func (*SnakeConfig) SaveLoad ¶
func (config *SnakeConfig) SaveLoad(filename string)
func (*SnakeConfig) Validate ¶
func (config *SnakeConfig) Validate()
type SnakeHead ¶
type SnakeHead struct { GameObjBase MoveVector go4game.Vector3D Sphere }
func NewSnakeHead ¶
func (*SnakeHead) ToOctreeVolObj ¶
func (o *SnakeHead) ToOctreeVolObj() OctreeVolObjI
type SnakeService ¶
func NewService ¶
func NewService() *SnakeService
func (*SnakeService) AddWorld ¶
func (s *SnakeService) AddWorld(w WorldI)
func (*SnakeService) ID ¶
func (s *SnakeService) ID() int64
func (*SnakeService) Loop ¶
func (s *SnakeService) Loop()
func (*SnakeService) RemoveWorld ¶
func (s *SnakeService) RemoveWorld(id int64)
func (*SnakeService) SendGoCmd ¶
func (s *SnakeService) SendGoCmd(Cmd string, Args interface{}, Rsp chan<- interface{})
func (SnakeService) String ¶
func (s SnakeService) String() string
type SnakeTail ¶
type SnakeTail struct { GameObjBase Sphere // contains filtered or unexported fields }
func (*SnakeTail) ToOctreeVolObj ¶
func (o *SnakeTail) ToOctreeVolObj() OctreeVolObjI
type StageApples ¶
type StageApples struct { ObjGroupBase Color int }
func NewStageApples ¶
func NewStageApples(w *World) *StageApples
func (*StageApples) AddGameObj ¶
func (og *StageApples) AddGameObj(o GameObjI)
func (*StageApples) AddInitMembers ¶
func (og *StageApples) AddInitMembers()
func (*StageApples) AddToOctreeVol ¶
func (og *StageApples) AddToOctreeVol(ot *OctreeVol)
func (*StageApples) FrameActionResult ¶
func (og *StageApples) FrameActionResult() interface{}
func (*StageApples) GameObjI ¶
func (og *StageApples) GameObjI() map[int64]GameObjI
func (*StageApples) ID ¶
func (og *StageApples) ID() int64
func (*StageApples) RemoveGameObj ¶
func (og *StageApples) RemoveGameObj(id int64)
func (*StageApples) StartFrameAction ¶
func (og *StageApples) StartFrameAction(world WorldI, ftime time.Time)
type StagePlums ¶
type StagePlums struct { ObjGroupBase Color int }
func NewStagePlums ¶
func NewStagePlums(w *World) *StagePlums
func (*StagePlums) AddGameObj ¶
func (og *StagePlums) AddGameObj(o GameObjI)
func (*StagePlums) AddInitMembers ¶
func (og *StagePlums) AddInitMembers()
func (*StagePlums) AddToOctreeVol ¶
func (og *StagePlums) AddToOctreeVol(ot *OctreeVol)
func (*StagePlums) FrameActionResult ¶
func (og *StagePlums) FrameActionResult() interface{}
func (*StagePlums) GameObjI ¶
func (og *StagePlums) GameObjI() map[int64]GameObjI
func (*StagePlums) ID ¶
func (og *StagePlums) ID() int64
func (*StagePlums) RemoveGameObj ¶
func (og *StagePlums) RemoveGameObj(id int64)
func (*StagePlums) StartFrameAction ¶
func (og *StagePlums) StartFrameAction(world WorldI, ftime time.Time)
type StageWalls ¶
type StageWalls struct { ObjGroupBase ExitPos go4game.Vector3D Color int }
func NewStageWalls ¶
func NewStageWalls(w *World) *StageWalls
func (*StageWalls) AddGameObj ¶
func (og *StageWalls) AddGameObj(o GameObjI)
func (*StageWalls) AddInitMembers ¶
func (og *StageWalls) AddInitMembers()
func (*StageWalls) AddToOctreeVol ¶
func (og *StageWalls) AddToOctreeVol(ot *OctreeVol)
func (*StageWalls) FrameActionResult ¶
func (og *StageWalls) FrameActionResult() interface{}
func (*StageWalls) GameObjI ¶
func (og *StageWalls) GameObjI() map[int64]GameObjI
func (*StageWalls) ID ¶
func (og *StageWalls) ID() int64
func (*StageWalls) RemoveGameObj ¶
func (og *StageWalls) RemoveGameObj(id int64)
func (*StageWalls) StartFrameAction ¶
func (og *StageWalls) StartFrameAction(world WorldI, ftime time.Time)
type Wall ¶
type Wall struct { GameObjBase Cube }
func (*Wall) ToOctreeVolObj ¶
func (o *Wall) ToOctreeVolObj() OctreeVolObjI
type World ¶
func NewWorld ¶
func NewWorld(s *SnakeService) *World
func (*World) AddObjGroup ¶
func (*World) CollideList ¶
func (*World) MakeOctreeVol ¶
func (*World) RemoveObjGroup ¶
Click to show internal directories.
Click to hide internal directories.