Documentation ¶
Overview ¶
Package game provides an example of a usual Kaori game skeleton. Everything that are specific to the game should and only be in this class only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeScene ¶
ChangeScene changes the scene and runs the proper functions ( Run Exit on Old Scene, and Enter on New Scene )
func Clean ¶
func Clean()
Clean is used for cleaning the game's resources such as Freeing the Textures, Clean the used resources, etc.
func HandleEvents ¶
func HandleEvents()
HandleEvents is used for receiving and handling SDL Events such as Update the mouse location, Check if the user is requesting to close the game, etc.
func Init ¶
Init is used for a starting procedure of the game which will do things such as creating the SDL Window, creating the SDL Renderer, Start the Scene, etc.
func Render ¶
func Render()
Render is used for drawing something to the renderer. Which will show up on the screen.
Types ¶
type DemoScene ¶
type DemoScene struct {
// contains filtered or unexported fields
}
DemoScene is an example use of a Scene in this case drawing the logo
func (*DemoScene) Exit ¶
func (s *DemoScene) Exit()
Exit executes when the scene is being changed or the game is closing
func (*DemoScene) HandleEvents ¶
HandleEvents executes when there's an SDL Event from the Event Poll
type EmptyScene ¶
type EmptyScene struct { }
EmptyScene is a skeleton for a Scene
func (*EmptyScene) Draw ¶
func (s *EmptyScene) Draw(r *sdl.Renderer)
Draw is used when a game render event happens usually this function is used for drawing the objects
func (*EmptyScene) Enter ¶
func (s *EmptyScene) Enter()
Enter is used when the Scene is going to be used usually this function is used for loading assets, transitions, etc
func (*EmptyScene) Exit ¶
func (s *EmptyScene) Exit()
Exit is used when the Scene is going to change or the game is going to close ( You can check what's going on with the running variable ) usually this function is used for freeing resources, cleaning objects, transitions, etc
func (*EmptyScene) HandleEvents ¶
func (s *EmptyScene) HandleEvents(e sdl.Event)
HandleEvents is used when a certain SDL Event is received
func (*EmptyScene) Update ¶
func (s *EmptyScene) Update()
Update is used when a game update event happens usually this function is used for moving the objects, check the input devices, etc