Documentation ¶
Overview ¶
Package oak is a game engine...
Index ¶
- Constants
- Variables
- func AddCommand(s string, fn func([]string))
- func AddScene(name string, start SceneStart, loop SceneUpdate, end SceneEnd) error
- func BindKey(key string, binding string)
- func ChangeWindow(width, height int)
- func FramesElapsed() int
- func GetKeyBind(key string) string
- func GetScreen() *image.RGBA
- func Init(firstScene string)
- func IsDown(key string) (k bool)
- func IsHeld(key string) (k bool, d time.Duration)
- func LoadConf(fileName string) (err error)
- func SeedRNG(curSeed int64)
- func SetBinaryPayload(payloadFn func(string) ([]byte, error), dirFn func(string) ([]string, error))
- func SetLang(s string)
- func SetScreen(x, y int)
- func SetViewportBounds(x1, y1, x2, y2 int)
- func TransitionFade(rate float32, frames int) func(*image.RGBA, int) bool
- type Assets
- type Debug
- type Font
- type Language
- type Scene
- type SceneEnd
- type SceneResult
- type SceneStart
- type SceneUpdate
- type Screen
Constants ¶
const ( // DefaultSeed is a key int64 sent in to SeedRNG // used to indicate that the seed function should just // do the default operation for seeding, using the current // time. DefaultSeed = iota )
Variables ¶
var ( // ScreenWidth is the width of the screen ScreenWidth int // ScreenHeight is the height of the screen ScreenHeight int // FrameRate is the current logical frame rate. // Changing this won't directly effect frame rate, that // requires changing the LogicTicker, but it will take // effect next scene FrameRate int // DrawFrameRate is the unused equivalent to FrameRate DrawFrameRate int // CurrentScene is the scene currently running in oak CurrentScene string )
var ( // DrawTicker is an unused parallel to LogicTicker to set the draw framerate DrawTicker *timing.DynamicTicker )
var ( // LoadingR is a renderable that is displayed during loading screens. LoadingR render.Renderable )
var ( // LogicTicker is exposed so that games can manually change the speed // at which EnterFrame events are produced LogicTicker *timing.DynamicTicker )
var ( // ViewPos represents the point in the world which the viewport is anchored at. ViewPos = image.Point{} )
Functions ¶
func AddCommand ¶
AddCommand adds a console command to call fn when 'c <s> <args>' is input to the console
func AddScene ¶
func AddScene(name string, start SceneStart, loop SceneUpdate, end SceneEnd) error
AddScene adds a scene with the given name and functions to the scene map
func ChangeWindow ¶
func ChangeWindow(width, height int)
ChangeWindow sets the width and height of the game window. But it doesn't.
func FramesElapsed ¶
func FramesElapsed() int
FramesElapsed returns the number of logical frames that have been processed in the current scene. This value is also passed in to all EnterFrame bindings.
func GetKeyBind ¶
GetKeyBind returns either whatever name has been bound to a key or the key if nothing has been bound to it.
func Init ¶
func Init(firstScene string)
Init initializes the oak engine. It spawns off an event loop of several goroutines and loops through scenes after initialization.
func SeedRNG ¶
func SeedRNG(curSeed int64)
SeedRNG seeds go's random number generator and logs the seed set to file.
func SetBinaryPayload ¶
SetBinaryPayload just sets some public fields on packages that require access to binary functions as alternatives to os file functions. This is no longer necessary, as a single package uses these now.
func SetScreen ¶
func SetScreen(x, y int)
SetScreen sends a signal to the draw loop to set the viewport to be at x,y
func SetViewportBounds ¶
func SetViewportBounds(x1, y1, x2, y2 int)
SetViewportBounds sets the minimum and maximum position of the viewport, including screen dimensions
Types ¶
type Assets ¶
type Assets struct { AssetPath string `json:"assetPath"` AudioPath string `json:"audioPath"` ImagePath string `json:"imagePath"` FontPath string `json:"fontPath"` }
Assets is a json type storing paths to different asset folders
type Font ¶
type Font struct { Hinting string `json:"hinting"` Size float64 `json:"size"` DPI float64 `json:"dpi"` File string `json:"file"` Color string `json:"color"` }
Font is a json type storing the default font settings
type Language ¶
type Language int
Language is hypothetically something games might care about in their text
var ( // Lang is the current langugae Lang Language )
type Scene ¶
type Scene struct {
// contains filtered or unexported fields
}
A Scene is a set of functions defining what needs to happen when a scene starts, loops, and ends.
type SceneEnd ¶
type SceneEnd func() (string, *SceneResult)
SceneEnd is a function returning the next scene and a SceneResult
type SceneResult ¶
type SceneResult struct { NextSceneInput interface{} Transition transitionFunction }
A SceneResult is a set of options for what should be passed into the next scene and how the next scene should be transitioned to.
type SceneStart ¶
type SceneStart func(prevScene string, data interface{})
SceneStart is a function taking in a previous scene and a payload of data from the previous scene's end
type SceneUpdate ¶
type SceneUpdate func() bool
SceneUpdate is a function that returns whether or not the current scene should continue to loop.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package dlog provides logging functions with caller file and line information, logging levels and level and text filters.
|
Package dlog provides logging functions with caller file and line information, logging levels and level and text filters. |
Package event propagates events through entities with given caller IDs.
|
Package event propagates events through entities with given caller IDs. |
examples
|
|
Package mouse handles the propagation of mouse events though clickable regions.
|
Package mouse handles the propagation of mouse events though clickable regions. |
Package render provides several types of renderable entities, methods for loading images from file, and methods for drawing those entities to screen.
|
Package render provides several types of renderable entities, methods for loading images from file, and methods for drawing those entities to screen. |
particle
Package particle provides options for generating renderable particle sources.
|
Package particle provides options for generating renderable particle sources. |