core

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DeltaTime is the time in seconds since last frame
	DeltaTime float32
)
View Source
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 Height

func Height() int32

Height returns the window height as an int32.

func HeightF

func HeightF() float32

HeightF returns the window height 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 Renderer

func Renderer() *sdl.Renderer

Renderer returns the SDL renderer.

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.

func Start

func Start(t string)

Start initializes the window and renderer.

func Stop

func Stop()

Stop destroys the window and renderer. Call this after the game loop has exited.

func Width

func Width() int32

Width returns the window width as an int32.

func WidthF

func WidthF() float32

WidthF returns the window width as a float32.

func Window

func Window() *sdl.Window

Window returns the SDL window.

Types

type Opt

type Opt struct {
	Vsync      bool      `yaml:"vsync"`
	Fullscreen bool      `yaml:"fullscreen"`
	PixelScale int32     `yaml:"pixel_scale"`
	LogLevel   log.Level `yaml:"log_level"`
}

func Options

func Options() *Opt

func (*Opt) Load

func (self *Opt) Load(path string) error

func (*Opt) Save

func (self *Opt) Save(path string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL