Documentation ¶
Overview ¶
+build !windows
Index ¶
- Variables
- func CreateWindow(title string, width, height int, fullscreen bool)
- func DestroyWindow()
- func Exit()
- func Height() float32
- func IsIntersecting(rect1 AABB, rect2 AABB) bool
- func LoadShader(vertSrc, fragSrc string) *webgl.Program
- func Open(opts RunOptions, defaultScene Scene)
- func RegisterScene(s Scene)
- func RunIteration()
- func RunPreparation(defaultScene Scene)
- func SetBg(color uint32)
- func SetCursor(c *glfw.Cursor)
- func SetFPSLimit(limit int) error
- func SetScaleOnResize(b bool)
- func SetScene(s Scene, forceNewWorld bool)
- func SetSceneByName(name string, forceNewWorld bool) error
- func SetTitle(title string)
- func SetVSync(enabled bool)
- func Width() float32
- func WindowHeight() float32
- func WindowWidth() float32
- type AABB
- type Action
- type AnimationAction
- type AnimationComponent
- func (ac *AnimationComponent) AddAnimationAction(action *AnimationAction)
- func (ac *AnimationComponent) AddAnimationActions(actions []*AnimationAction)
- func (ac *AnimationComponent) Cell() Drawable
- func (ac *AnimationComponent) NextFrame()
- func (ac *AnimationComponent) SelectAnimationByAction(action *AnimationAction)
- func (ac *AnimationComponent) SelectAnimationByName(name string)
- func (*AnimationComponent) Type() string
- type AnimationSystem
- type Assets
- type AudioComponent
- type AudioSystem
- type ByFirstgid
- type CameraAxis
- type CameraMessage
- type Clock
- type CollisionComponent
- type CollisionMasterComponent
- type CollisionMessage
- type CollisionSystem
- type DefaultShader
- type Drawable
- type EdgeScroller
- type Font
- type Format
- type HUDShader
- type Image
- type ImageObject
- type ImageRGBA
- type Key
- type KeyManager
- type KeyState
- type KeyboardScroller
- type Level
- type Line
- type Loader
- func (l *Loader) Add(urls ...string)
- func (l *Loader) AddFromDir(url string, recurse bool)
- func (l *Loader) Image(name string) *Texture
- func (l *Loader) Json(name string) string
- func (l *Loader) Level(name string) *Level
- func (l *Loader) Load(onFinish func())
- func (l *Loader) Sound(name string) ReadSeekCloser
- type Message
- type MessageHandler
- type MessageManager
- type Modifier
- type MouseButton
- type MouseComponent
- type MouseSystem
- type MouseZoomer
- type Player
- func (p *Player) Close() error
- func (p *Player) Current() time.Duration
- func (p *Player) Pause() error
- func (p *Player) Play(background bool) error
- func (p *Player) Seek(background bool, offset time.Duration) error
- func (p *Player) SetVolume(vol float64)
- func (p *Player) State() State
- func (p *Player) Stop() error
- func (p *Player) Total(background bool) time.Duration
- func (p *Player) Volume() float64
- type Point
- func (p *Point) Add(p2 Point)
- func (p *Point) AddScalar(s float32)
- func (p *Point) Multiply(p2 Point)
- func (p *Point) MultiplyScalar(s float32)
- func (a *Point) Normalize() (Point, float32)
- func (p *Point) PointDistance(p2 Point) float32
- func (p *Point) PointDistanceSquared(p2 Point) float32
- func (a *Point) ProjectOnto(b Point) Point
- func (p *Point) Set(x, y float32)
- func (p *Point) SetTo(v float32)
- func (p *Point) Subtract(p2 Point)
- func (p *Point) SubtractScalar(s float32)
- type PriorityLevel
- type ReadSeekCloser
- type Region
- type RenderComponent
- type RenderSystem
- func (rs *RenderSystem) AddEntity(e *ecs.Entity)
- func (rs *RenderSystem) New(w *ecs.World)
- func (rs *RenderSystem) Post()
- func (rs *RenderSystem) Pre()
- func (rs *RenderSystem) Priority() int
- func (rs *RenderSystem) RemoveEntity(e *ecs.Entity)
- func (*RenderSystem) Type() string
- func (rs *RenderSystem) Update(entity *ecs.Entity, dt float32)
- type Resource
- type RunOptions
- type Scene
- type Shader
- type ShadersLibrary
- type SpaceComponent
- type Sprite
- type Spritesheet
- type State
- type TMXImgLayer
- type TMXImgSrc
- type TMXLayer
- type TMXLevel
- type TMXObj
- type TMXObjGroup
- type TMXPolyline
- type TMXTileset
- type TMXTilesetSrc
- type Texture
Constants ¶
This section is empty.
Variables ¶
var ( MinZoom float32 = 0.25 MaxZoom float32 = 3 )
var ( Time *Clock Files *Loader Gl *webgl.Context WorldBounds AABB Mailbox *MessageManager )
var ( Arrow *glfw.Cursor IBeam *glfw.Cursor Crosshair *glfw.Cursor Hand *glfw.Cursor HResize *glfw.Cursor VResize *glfw.Cursor )
var ( Mouse mouse MOVE = Action(0) PRESS = Action(1) RELEASE = Action(2) NEUTRAL = Action(99) SHIFT = Modifier(0x0001) CONTROL = Modifier(0x0002) ALT = Modifier(0x0004) SUPER = Modifier(0x0008) )
var ( Dash = Key(189) Apostrophe = Key(222) Semicolon = Key(186) Equals = Key(187) Comma = Key(188) Period = Key(190) Slash = Key(191) Backslash = Key(220) Backspace = Key(8) Tab = Key(9) CapsLock = Key(20) Space = Key(32) Enter = Key(13) Escape = Key(27) Insert = Key(45) PrintScreen = Key(42) Delete = Key(46) PageUp = Key(33) PageDown = Key(34) Home = Key(36) End = Key(35) Pause = Key(19) ScrollLock = Key(145) ArrowLeft = Key(37) ArrowRight = Key(39) ArrowDown = Key(40) ArrowUp = Key(38) LeftBracket = Key(219) LeftShift = Key(16) LeftControl = Key(17) LeftSuper = Key(73) LeftAlt = Key(18) RightBracket = Key(221) RightShift = Key(16) RightControl = Key(17) RightSuper = Key(73) RightAlt = Key(18) Zero = Key(48) One = Key(49) Two = Key(50) Three = Key(51) Four = Key(52) Five = Key(53) Six = Key(54) Seven = Key(55) Eight = Key(56) Nine = Key(57) F1 = Key(112) F2 = Key(113) F3 = Key(114) F4 = Key(115) F5 = Key(116) F6 = Key(117) F7 = Key(118) F8 = Key(119) F9 = Key(120) F10 = Key(121) F11 = Key(122) F12 = Key(123) A = Key(65) B = Key(66) C = Key(67) D = Key(68) E = Key(69) F = Key(70) G = Key(71) H = Key(72) I = Key(73) J = Key(74) K = Key(75) L = Key(76) M = Key(77) N = Key(78) O = Key(79) P = Key(80) Q = Key(81) R = Key(82) S = Key(83) T = Key(84) U = Key(85) V = Key(86) W = Key(87) X = Key(88) Y = Key(89) Z = Key(90) NumLock = Key(144) NumMultiply = Key(106) NumDivide = Key(111) NumAdd = Key(107) NumSubtract = Key(109) NumZero = Key(96) NumOne = Key(97) NumTwo = Key(98) NumThree = Key(99) NumFour = Key(100) NumFive = Key(101) NumSix = Key(102) NumSeven = Key(103) NumEight = Key(104) NumNine = Key(105) NumDecimal = Key(110) NumEnter = Key(13) )
those are default values for engi_js defined here because some of them are shared with engi_glfw. engi_glfw redefines the variables it needs to other values during init() so
var ( KEY_STATE_UP string = "up" KEY_STATE_DOWN string = "down" KEY_STATE_JUST_DOWN string = "justdown" KEY_STATE_JUST_UP string = "justup" Keys KeyManager )
var Shaders = ShadersLibrary{ // contains filtered or unexported fields }
Functions ¶
func CreateWindow ¶
func DestroyWindow ¶
func DestroyWindow()
func IsIntersecting ¶
func LoadShader ¶
func Open ¶
func Open(opts RunOptions, defaultScene Scene)
func RegisterScene ¶
func RegisterScene(s Scene)
RegisterScene registers the `Scene`, so it can later be used by `SetSceneByName`
func RunPreparation ¶
func RunPreparation(defaultScene Scene)
RunPreparation is called only once, and is called automatically when calling Open It is only here for benchmarking in combination with OpenHeadlessNoRun
func SetFPSLimit ¶
func SetScaleOnResize ¶
func SetScaleOnResize(b bool)
func SetScene ¶
SetScene sets the currentScene to the given Scene, and optionally forcing to create a new ecs.World that goes with it.
func SetSceneByName ¶
SetSceneByName does a lookup for the `Scene` where its `Type()` equals `name`, and then sets it as current `Scene`
func WindowHeight ¶
func WindowHeight() float32
func WindowWidth ¶
func WindowWidth() float32
Types ¶
type AnimationAction ¶
type AnimationComponent ¶
type AnimationComponent struct { Rate float32 // How often frames should increment, in seconds. Drawables []Drawable // Renderables Animations map[string][]int // All possible animations CurrentAnimation []int // The current animation // contains filtered or unexported fields }
Component that controls animation in rendering entities
func NewAnimationComponent ¶
func NewAnimationComponent(drawables []Drawable, rate float32) *AnimationComponent
func (*AnimationComponent) AddAnimationAction ¶
func (ac *AnimationComponent) AddAnimationAction(action *AnimationAction)
func (*AnimationComponent) AddAnimationActions ¶
func (ac *AnimationComponent) AddAnimationActions(actions []*AnimationAction)
func (*AnimationComponent) Cell ¶
func (ac *AnimationComponent) Cell() Drawable
func (*AnimationComponent) NextFrame ¶
func (ac *AnimationComponent) NextFrame()
func (*AnimationComponent) SelectAnimationByAction ¶
func (ac *AnimationComponent) SelectAnimationByAction(action *AnimationAction)
func (*AnimationComponent) SelectAnimationByName ¶
func (ac *AnimationComponent) SelectAnimationByName(name string)
func (*AnimationComponent) Type ¶
func (*AnimationComponent) Type() string
type AnimationSystem ¶
func (*AnimationSystem) New ¶
func (a *AnimationSystem) New(*ecs.World)
func (AnimationSystem) Type ¶
func (AnimationSystem) Type() string
type AudioComponent ¶
type AudioComponent struct { File string Repeat bool Background bool // contains filtered or unexported fields }
AudioComponent is a Component which is used by the AudioSystem
func (*AudioComponent) Type ¶
func (*AudioComponent) Type() string
type AudioSystem ¶
AudioSystem is a System that allows for sound effects and / or music
func (*AudioSystem) New ¶
func (as *AudioSystem) New(*ecs.World)
func (AudioSystem) Type ¶
func (AudioSystem) Type() string
type ByFirstgid ¶
type ByFirstgid []TMXTileset
func (ByFirstgid) Len ¶
func (t ByFirstgid) Len() int
func (ByFirstgid) Less ¶
func (t ByFirstgid) Less(i, j int) bool
func (ByFirstgid) Swap ¶
func (t ByFirstgid) Swap(i, j int)
type CameraAxis ¶
type CameraAxis uint8
CameraAxis is the axis at which the Camera can/has to move
const ( XAxis CameraAxis = iota YAxis ZAxis )
type CameraMessage ¶
type CameraMessage struct { Axis CameraAxis Value float32 Incremental bool }
CameraMessage is a message that can be sent to the Camera (and other Systemers), to indicate movement
func (CameraMessage) Type ¶
func (CameraMessage) Type() string
type CollisionComponent ¶
func (*CollisionComponent) Type ¶
func (*CollisionComponent) Type() string
type CollisionMasterComponent ¶
type CollisionMasterComponent struct { }
func (CollisionMasterComponent) Is ¶
func (cm CollisionMasterComponent) Is() bool
func (*CollisionMasterComponent) Type ¶
func (*CollisionMasterComponent) Type() string
type CollisionMessage ¶
func (CollisionMessage) Type ¶
func (collision CollisionMessage) Type() string
type CollisionSystem ¶
func (*CollisionSystem) New ¶
func (cs *CollisionSystem) New(*ecs.World)
func (*CollisionSystem) RunInParallel ¶
func (cs *CollisionSystem) RunInParallel() bool
func (*CollisionSystem) Type ¶
func (*CollisionSystem) Type() string
type DefaultShader ¶
type DefaultShader struct {
// contains filtered or unexported fields
}
func (*DefaultShader) Initialize ¶
func (s *DefaultShader) Initialize(width, height float32)
func (*DefaultShader) Post ¶
func (s *DefaultShader) Post()
func (*DefaultShader) Pre ¶
func (s *DefaultShader) Pre()
func (*DefaultShader) SetProjection ¶
func (s *DefaultShader) SetProjection(width, height float32)
type EdgeScroller ¶
EdgeScroller is a Systemer that allows for scrolling when the mouse is near the edges
func NewEdgeScroller ¶
func NewEdgeScroller(scrollSpeed float32, margin float64) *EdgeScroller
func (*EdgeScroller) New ¶
func (c *EdgeScroller) New(*ecs.World)
func (*EdgeScroller) Type ¶
func (*EdgeScroller) Type() string
type Font ¶
type Font struct { URL string Size float64 BG color.Color FG color.Color // contains filtered or unexported fields }
TODO FG and BG color config
func (*Font) CreatePreloaded ¶
CreatePreloaded is for loading fonts which have already been defined (and loaded) within Preload
type HUDShader ¶
type HUDShader struct {
// contains filtered or unexported fields
}
func (*HUDShader) Initialize ¶
func (*HUDShader) SetProjection ¶
type ImageObject ¶
type ImageObject struct {
// contains filtered or unexported fields
}
func NewImageObject ¶
func NewImageObject(img *image.NRGBA) *ImageObject
func (*ImageObject) Data ¶
func (i *ImageObject) Data() interface{}
func (*ImageObject) Height ¶
func (i *ImageObject) Height() int
func (*ImageObject) Width ¶
func (i *ImageObject) Width() int
type ImageRGBA ¶
type ImageRGBA struct {
// contains filtered or unexported fields
}
func NewImageRGBA ¶
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
func (*KeyManager) Get ¶
func (km *KeyManager) Get(k Key) KeyState
type KeyState ¶
type KeyState struct {
// contains filtered or unexported fields
}
func (KeyState) JustPressed ¶
func (KeyState) JustReleased ¶
type KeyboardScroller ¶
KeyboardScroller is a Systemer that allows for scrolling when certain keys are pressed
func NewKeyboardScroller ¶
func NewKeyboardScroller(scrollSpeed float32, up, right, down, left Key) *KeyboardScroller
func (*KeyboardScroller) BindKeyboard ¶
func (c *KeyboardScroller) BindKeyboard(up, right, down, left Key)
func (*KeyboardScroller) New ¶
func (c *KeyboardScroller) New(*ecs.World)
func (*KeyboardScroller) Type ¶
func (*KeyboardScroller) Type() string
type Line ¶
func (*Line) LineIntersection ¶
Returns the point where the two lines intersect
func (*Line) PointDistance ¶
Returns the squared euclidean distance from a point to a line *segment*
func (*Line) PointDistanceSquared ¶
Returns the squared euclidean distance from a point to a line *segment*
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func (*Loader) AddFromDir ¶
func (*Loader) Sound ¶
func (l *Loader) Sound(name string) ReadSeekCloser
type MessageHandler ¶
type MessageHandler func(msg Message)
type MessageManager ¶
type MessageManager struct {
// contains filtered or unexported fields
}
func (*MessageManager) Dispatch ¶
func (mm *MessageManager) Dispatch(message Message)
func (*MessageManager) Listen ¶
func (mm *MessageManager) Listen(messageType string, handler MessageHandler)
type MouseButton ¶
type MouseButton int
MouseButton corresponds to a mouse button.
const ( MouseButton1 MouseButton = 0 // left button MouseButton2 MouseButton = 1 // right button MouseButton3 MouseButton = 2 // middle button MouseButton4 MouseButton = 3 MouseButton5 MouseButton = 4 MouseButton6 MouseButton = 5 MouseButton7 MouseButton = 6 MouseButton8 MouseButton = 7 MouseButtonLast MouseButton = 7 MouseButtonLeft MouseButton = 0 // equivalent for MouseButton1 MouseButtonRight MouseButton = 1 // equivalent for MouseButton2 MouseButtonMiddle MouseButton = 2 // equivalent for MouseButton3 )
Mouse buttons
type MouseComponent ¶
type MouseComponent struct { // Clicked is true whenever the Mouse was clicked over // the entity space in this frame Clicked bool // Released is true whenever the left mouse button is released over the // entity space in this frame Released bool // Hovered is true whenever the Mouse is hovering // the entity space in this frame. This does not necessarily imply that // the mouse button was pressed down in your entity space. Hovered bool // Dragged is true whenever the entity space was clicked, // and then the mouse started moving (while holding) Dragged bool // RightClicked is true whenever the entity space was right-clicked // in this frame RightClicked bool // RightReleased is true whenever the right mouse button is released over // the entity space in this frame. This does not necessarily imply that // the mouse button was pressed down in your entity space. RightReleased bool // Enter is true whenever the Mouse entered the entity space in that frame, // but wasn't in that space during the previous frame Enter bool // Leave is true whenever the Mouse was in the space on the previous frame, // but now isn't Leave bool // Position of the mouse at any moment this is generally used // in conjunction with Track = true MouseX float32 MouseY float32 // Set manually this to true and your mouse component will track the mouse // and your entity will always be able to receive an updated mouse // component even if its space is not under the mouse cursor // WARNING: you MUST know why you want to use this because it will // have serious performance impacts if you have many entities with // a MouseComponent in tracking mode. // This is ideally used for a really small number of entities // that must really be aware of the mouse details event when the // mouse is not hovering them Track bool }
MouseComponent is the location for the MouseSystem to store its results; to be used / viewed by other Systems
func (*MouseComponent) Type ¶
func (*MouseComponent) Type() string
Type returns the string representation of the MouseComponent type
type MouseSystem ¶
MouseSystem listens for mouse events, and changes value for MouseComponent accordingly
func (*MouseSystem) Post ¶
func (m *MouseSystem) Post()
Post is called after all Update calls, and is used to compute internal values
func (*MouseSystem) Pre ¶
func (m *MouseSystem) Pre()
Pre is called before all Update calls, and is used to compute internal values
func (*MouseSystem) Priority ¶
func (m *MouseSystem) Priority() int
Priority returns a priority of 10 (higher than most) to ensure that this System runs before all others
func (*MouseSystem) Type ¶
func (*MouseSystem) Type() string
Type returns the string representation of the MouseSystem type
type MouseZoomer ¶
MouseZoomer is a Systemer that allows for zooming when the scroll wheel is used
func NewMouseZoomer ¶
func NewMouseZoomer(zoomSpeed float32) *MouseZoomer
func (*MouseZoomer) New ¶
func (c *MouseZoomer) New(*ecs.World)
func (*MouseZoomer) Type ¶
func (*MouseZoomer) Type() string
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
Player is a basic audio player that plays PCM data. Operations on a nil *Player are no-op, a nil *Player can be used for testing purposes.
func NewPlayer ¶
func NewPlayer(src ReadSeekCloser, format Format, samplesPerSecond int64) (*Player, error)
NewPlayer returns a new Player. It initializes the underlying audio devices and the related resources. If zero values are provided for format and sample rate values, the player determines them from the source's WAV header. An error is returned if the format and sample rate can't be determined.
The audio package is only designed for small audio sources.
func (*Player) Close ¶
Close closes the device and frees the underlying resources used by the player. It should be called as soon as the player is not in-use anymore.
func (*Player) Current ¶
Current returns the current playback position of the audio that is being played.
func (*Player) Play ¶
Play buffers the source audio to the audio device and starts to play the source. If the player paused or stopped, it reuses the previously buffered resources to keep playing from the time it has paused or stopped.
func (*Player) Seek ¶
Seek moves the play head to the given offset relative to the start of the source.
func (*Player) SetVolume ¶
SetVolume sets the volume of the player. The range of the volume is [0, 1].
type Point ¶
type Point struct {
X, Y float32
}
func MinimumTranslation ¶
func (*Point) MultiplyScalar ¶
func (*Point) PointDistance ¶
func (*Point) PointDistanceSquared ¶
func (*Point) ProjectOnto ¶
Returns the vector produced by projecting a on to b
func (*Point) SubtractScalar ¶
type PriorityLevel ¶
type PriorityLevel int
const ( // HighestGround is the highest PriorityLevel that will be rendered HighestGround PriorityLevel = 50 // HUDGround is a PriorityLevel from which everything isn't being affected by the Camera HUDGround PriorityLevel = 40 Foreground PriorityLevel = 30 MiddleGround PriorityLevel = 20 ScenicGround PriorityLevel = 10 // Background is the lowest PriorityLevel that will be rendered Background PriorityLevel = 0 // Hidden indicates that it should not be rendered by the RenderSystem Hidden PriorityLevel = -1 )
type ReadSeekCloser ¶
type ReadSeekCloser interface { io.ReadSeeker io.Closer }
ReadSeekCloser is an io.ReadSeeker and io.Closer.
type RenderComponent ¶
type RenderComponent struct { Label string Transparency float32 Color color.Color // contains filtered or unexported fields }
func NewRenderComponent ¶
func NewRenderComponent(d Drawable, scale Point, label string) *RenderComponent
func (*RenderComponent) Scale ¶
func (r *RenderComponent) Scale() Point
func (*RenderComponent) SetDrawable ¶
func (r *RenderComponent) SetDrawable(d Drawable)
func (*RenderComponent) SetPriority ¶
func (r *RenderComponent) SetPriority(p PriorityLevel)
func (*RenderComponent) SetScale ¶
func (r *RenderComponent) SetScale(scale Point)
func (*RenderComponent) Type ¶
func (*RenderComponent) Type() string
type RenderSystem ¶
func (*RenderSystem) AddEntity ¶
func (rs *RenderSystem) AddEntity(e *ecs.Entity)
func (*RenderSystem) New ¶
func (rs *RenderSystem) New(w *ecs.World)
func (*RenderSystem) Post ¶
func (rs *RenderSystem) Post()
func (*RenderSystem) Pre ¶
func (rs *RenderSystem) Pre()
func (*RenderSystem) Priority ¶
func (rs *RenderSystem) Priority() int
func (*RenderSystem) RemoveEntity ¶
func (rs *RenderSystem) RemoveEntity(e *ecs.Entity)
func (*RenderSystem) Type ¶
func (*RenderSystem) Type() string
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
type RunOptions ¶
type RunOptions struct { // NoRun indicates the Open function should return immediately, without looping NoRun bool // Title is the Window title Title string // HeadlessMode indicates whether or not OpenGL calls should be made HeadlessMode bool Fullscreen bool Width, Height int // VSync indicates whether or not OpenGL should wait for the monitor to swp the buffers VSync bool // ScaleOnResize indicates whether or not engi should make things larger/smaller whenever the screen resizes ScaleOnResize bool // FPSLimit indicates the maximum number of frames per second FPSLimit int }
type Scene ¶
type Scene interface { // Preload is called before loading resources Preload() // Setup is called before the main loop Setup(*ecs.World) // Show is called whenever the other Scene becomes inactive, and this one becomes the active one Show() // Hide is called when an other Scene becomes active Hide() // Type returns a unique string representation of the Scene, used to identify it Type() string }
Scene represents a screen ingame. i.e.: main menu, settings, but also the game itself
func CurrentScene ¶
func CurrentScene() Scene
CurrentScene returns the SceneWorld that is currently active
type ShadersLibrary ¶
type ShadersLibrary struct {
// contains filtered or unexported fields
}
ShadersLibrary is the manager for the Shaders
func (*ShadersLibrary) Get ¶
func (s *ShadersLibrary) Get(prio PriorityLevel) Shader
Get returns the `Shader` that should be used for the given `PriorityLevel`
func (*ShadersLibrary) Register ¶
func (s *ShadersLibrary) Register(prio PriorityLevel, sh Shader)
Registers the `Shader` for the given `PriorityLevel`; possibly overwriting previously registered Shaders It does no initialization whatsoever
type SpaceComponent ¶
func (SpaceComponent) AABB ¶
func (sc SpaceComponent) AABB() AABB
func (*SpaceComponent) Center ¶
func (sc *SpaceComponent) Center(p Point)
Center positions the space component according to its center instead of its top-left point (this avoids doing the same math each time in your systems)
func (*SpaceComponent) Type ¶
func (*SpaceComponent) Type() string
type Sprite ¶
type Spritesheet ¶
type Spritesheet struct {
CellWidth, CellHeight int // The dimensions of the cells
// contains filtered or unexported fields
}
Spritesheet is a class that stores a set of tiles from a file, used by tilemaps and animations
func NewSpritesheetFromFile ¶
func NewSpritesheetFromFile(textureName string, cellWidth, cellHeight int) *Spritesheet
NewSpritesheetFromFile is a simple handler for creating a new spritesheet from a file textureName is the name of a texture already preloaded with engi.Files.Add
func NewSpritesheetFromTexture ¶
func NewSpritesheetFromTexture(texture *Texture, cellWidth, cellHeight int) *Spritesheet
func (*Spritesheet) Cell ¶
func (s *Spritesheet) Cell(index int) *Region
Cell gets the region at the index i, updates and pulls from cache if need be
func (*Spritesheet) CellCount ¶
func (s *Spritesheet) CellCount() int
func (*Spritesheet) Cells ¶
func (s *Spritesheet) Cells() []*Region
func (*Spritesheet) Drawable ¶
func (s *Spritesheet) Drawable(index int) Drawable
func (*Spritesheet) Drawables ¶
func (s *Spritesheet) Drawables() []Drawable
func (Spritesheet) Height ¶
func (s Spritesheet) Height() float32
Height is the amount of tiles on the y-axis of the spritesheet
func (Spritesheet) Width ¶
func (s Spritesheet) Width() float32
Width is the amount of tiles on the x-axis of the spritesheet
type TMXImgLayer ¶
type TMXLevel ¶
type TMXLevel struct { Width int `xml:"width,attr"` Height int `xml:"height,attr"` TileWidth int `xml:"tilewidth,attr"` TileHeight int `xml:"tileheight,attr"` Tilesets []TMXTileset `xml:"tileset"` Layers []TMXLayer `xml:"layer"` ObjGroups []TMXObjGroup `xml:"objectgroup"` ImgLayers []TMXImgLayer `xml:"imagelayer"` }
type TMXObj ¶
type TMXObj struct { X float64 `xml:"x,attr"` Y float64 `xml:"y,attr"` Polylines []TMXPolyline `xml:"polyline"` }
type TMXObjGroup ¶
type TMXPolyline ¶
type TMXPolyline struct {
Points string `xml:"points,attr"`
}
type TMXTileset ¶
type TMXTilesetSrc ¶
type TMXTilesetSrc struct { Source string `xml:"source,attr"` Width int `xml:"width,attr"` Height int `xml:"height,attr"` }
Just used to create levelTileset->Image
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ecs is the implementation of the Entity Component System design used by github.com/paked/engi.
|
Package ecs is the implementation of the Entity Component System design used by github.com/paked/engi. |