Documentation ¶
Index ¶
- Variables
- func CenterX() int32
- func CenterY() int32
- func HalfHeightF() float32
- func HalfWidthF() float32
- func Height() int32
- func HeightF() float32
- func InitOptions()
- func IsCursorLocked() bool
- func KeyStates() []uint8
- func LockCursor(lock bool)
- func OnResize(f *func())
- func Present()
- func Renderer() *sdl.Renderer
- func Running() bool
- func Start(t string)
- func Stop()
- func Width() int32
- func WidthF() float32
- func Window() *sdl.Window
- type Opt
Constants ¶
This section is empty.
Variables ¶
var ( // DeltaTime is the time in seconds since last frame DeltaTime float32 )
var (
P = player{2, 1.5, 0, 0, 0}
)
Functions ¶
func CenterX ¶
func CenterX() int32
CenterX returns the center of the window on the X axis. This is equal to Width() / 2.
func CenterY ¶
func CenterY() int32
CenterY returns the center of the window on the Y axis. This is equal to Height() / 2.
func HalfHeightF ¶
func HalfHeightF() float32
HalfHeightF returns half of the window height as a float32.
func HalfWidthF ¶
func HalfWidthF() float32
HalfWidthF returns half of the window width as a float32.
func InitOptions ¶
func InitOptions()
InitOptions ensures that optionData file exists and is initialized. If it doesn't exist, create it. If it does exist, load it.
func IsCursorLocked ¶
func IsCursorLocked() bool
IsCursorLocked returns whether the cursor is locked to the window or not.
func KeyStates ¶
func KeyStates() []uint8
KeyStates returns a snapshot of the current state of the keyboard. <https://wiki.libsdl.org/SDL_GetKeyboardState>
func LockCursor ¶
func LockCursor(lock bool)
LockCursor sets whether the cursor should be locked to the window or not.
func OnResize ¶
func OnResize(f *func())
OnResize sets the function to be called when the window is resized. This is for the game modes like firstperson, topdown, etc.
func Present ¶
func Present()
Present draws the frame to the screen. Call this at the very end of the game loop.
func Running ¶
func Running() bool
Running returns whether the game loop should continue or not. Use this to determine when to exit the game loop.