Documentation ¶
Overview ¶
Package macaw provides some of the core concepts required by the game engine Macaw. To create our games we are still require to use other internal packages: entity, system, and input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Window is the window of our game Window *sdl.Window // WinWidth has the default screen width WinWidth = int32(800) // WinHeight has the default screen height WinHeight = int32(600) // WinTitle has the default screen title WinTitle = "Macaw" )
We only have one input manager for now and one window, so they are going to be globals
Functions ¶
func PlayMusic ¶
func PlayMusic(file string)
PlayMusic plays the file and leave it as background music
func QuitSound ¶
func QuitSound()
QuitSound close open files and unloads libraries loaded with mix.Init()
func SetFullscreen ¶
func SetFullscreen(flags uint32)
SetFullscreen changes the Window's fullscreen state Flags are: sdl.WINDOW_FULLSCREEN (0x00000001) - for "real" fullscreen with a videomode change sdl.WINDOW_FULLSCREEN_DESKTOP (sdl.WINDOW_FULLSCREEN | 0x00001000) - for "fake" fullscreen that takes the size of the desktop 0 - window mode
Types ¶
type GameLoop ¶
type GameLoop struct { InputManager *input.Manager SceneManager // contains filtered or unexported fields }
GameLoop is the data structure which will execute our systems in order. inspired by http://www.koonsolo.com/news/dewitters-gameloop/
type Scene ¶
type Scene struct { Name string UpdateSystems []system.Systemer // responsible to update the game RenderSystem *system.RenderSystem // responsible to render the game InitFunc func() ExitFunc func() SceneOptions }
Scene is responsible to hold the systems in a scene
func (*Scene) AddGameUpdateSystem ¶
AddGameUpdateSystem adds the systems which will run in the game loop
func (*Scene) AddRenderSystem ¶
func (s *Scene) AddRenderSystem(system *system.RenderSystem)
AddRenderSystem adds the render system to our game loop
type SceneManager ¶
type SceneManager struct { Scenes []*Scene // SceneMap has the position of the scene in the array SceneMap map[string]int // contains filtered or unexported fields }
SceneManager manges the scenes in the game
func (*SceneManager) AddScene ¶
func (s *SceneManager) AddScene(scene *Scene)
AddScene adds a new scene
func (*SceneManager) ChangeScene ¶
func (s *SceneManager) ChangeScene(sceneName string) *Scene
ChangeScene changes to a specific scene by its name
func (*SceneManager) Current ¶
func (s *SceneManager) Current() *Scene
Current returns the current Scene
func (*SceneManager) NextScene ¶
func (s *SceneManager) NextScene() *Scene
NextScene goes to the next scene if it exists
Directories ¶
Path | Synopsis |
---|---|
Package cmd is used to parse the command line arguments.
|
Package cmd is used to parse the command line arguments. |
Package entity provides the entity manager, spritesheet and font structure, and some built-in components.
|
Package entity provides the entity manager, spritesheet and font structure, and some built-in components. |
Package input provides a wrapper to handle user input events (keyboard and mouse for now).
|
Package input provides a wrapper to handle user input events (keyboard and mouse for now). |
internal
|
|
utils
Package utils contains some internal tools we use in macaw.
|
Package utils contains some internal tools we use in macaw. |
Package math provides structures and functions to handle mathematical functions.
|
Package math provides structures and functions to handle mathematical functions. |
Package system provides the interface used in the game engine, messaging between systems, and some built in systems.
|
Package system provides the interface used in the game engine, messaging between systems, and some built in systems. |