Documentation
¶
Index ¶
- Variables
- func BindInputAction(name string, action InputAction)
- func CopyToRenderTarget(source, dest RenderTarget, flipY bool)
- func CreateRenderTarget(screenW, screenH int32) rl.RenderTexture2D
- func GetAnimData(animPath string) goaseprite.File
- func GetAxis(action string) (rate float32)
- func GetBestAnimData(vec MatchVector) goaseprite.File
- func GetBestTexture(vec MatchVector) *rl.Texture2D
- func GetFile(path string, checkGlobalDir bool) []byte
- func GetMousePosition() [2]int32
- func GetRootFile(path string) []byte
- func GetTexture(texturePath string) *rl.Texture2D
- func InitAssets(archiveNames []string, isDebugMode bool)
- func InitInput()
- func InitRenderer(title string, winW, winH int32)
- func IsKeyDown(action string) bool
- func IsKeyPressed(action string) bool
- func IsKeyReleased(action string) bool
- func PushTag(tag string) uint64
- func UpdateInput()
- type AssetArchive
- type AssetChunk
- type InputAction
- type MatchVector
- type Profiler
- type Program
- func (prog *Program) GetShaderLocation(locName string) int32
- func (prog *Program) RenderToTexture(source, target RenderTarget)
- func (prog *Program) SetShaderValue(locName string, values []float32, count int32)
- func (prog *Program) SetShaderValueMatrix(locName string, mat rl.Matrix)
- func (prog *Program) SetShaderValuei(locName string, values []int32, count int32)
- func (prog *Program) UpdateDefaultUniforms()
- type RenderTarget
- type ShaderPipeline
Constants ¶
This section is empty.
Variables ¶
var ( // MapName represents the currently loaded map name MapName string // AssetDatabase contains all the parsed data we use in game AssetDatabase []AssetArchive // ArchiveEncryptionKey is the key we use to access our assets ArchiveEncryptionKey = "letmein123" // RegisteredTags contains a list of all tags usable for assets RegisteredTags = []string{"none"} )
var ( // GamepadDeadZone movement threshold GamepadDeadZone = 0.25 // GamepadID represents the controller index GamepadID int32 // MouseDelta contains last mouse movement MouseDelta [2]int32 )
var ( //ScreenWidth render target width ScreenWidth int32 //ScreenHeight render target height ScreenHeight int32 //WindowWidth window width WindowWidth int32 //WindowHeight window height WindowHeight int32 // ScaleRatio between window and screen resolution ScaleRatio float32 // FrameTime is the target update time FrameTime float32 = 1 / 60.0 )
var ( // Profilers consists of list of all profilers Profilers []*Profiler )
Functions ¶
func BindInputAction ¶
func BindInputAction(name string, action InputAction)
BindInputAction registers a new input action used by the game
func CopyToRenderTarget ¶
func CopyToRenderTarget(source, dest RenderTarget, flipY bool)
CopyToRenderTarget copies one target to another
func CreateRenderTarget ¶
func CreateRenderTarget(screenW, screenH int32) rl.RenderTexture2D
CreateRenderTarget generates a render target used by the game
func GetAnimData ¶
func GetAnimData(animPath string) goaseprite.File
GetAnimData retrieves a cached Aseprite anim data from a disk
func GetBestAnimData ¶
func GetBestAnimData(vec MatchVector) goaseprite.File
GetBestAnimData retrieves a animation data matching specs
func GetBestTexture ¶
func GetBestTexture(vec MatchVector) *rl.Texture2D
GetBestTexture retrieves a texture matching specs
func GetMousePosition ¶
func GetMousePosition() [2]int32
GetMousePosition returns a fixed mouse position
func GetRootFile ¶
GetRootFile retrieves a file inside of game root from a disk
func GetTexture ¶
GetTexture retrieves a cached texture from disk
func InitAssets ¶
InitAssets initializes all asset info
func InitRenderer ¶
InitRenderer initializes the renderer and creates the window
func IsKeyPressed ¶
IsKeyPressed checks whether the key is pressed
func IsKeyReleased ¶
IsKeyReleased checks whether the key is released
Types ¶
type AssetArchive ¶
type AssetArchive struct {
Name string
Author string
Version string
Description string
Chunks []AssetChunk
}
AssetArchive describes the game data
type AssetChunk ¶
type AssetChunk struct {
FileName string
Name string
Author string
Description string
Type uint16
Data []byte
Tags []uint64
TagValues []float64
ExtraData []byte
}
AssetChunk describes an asset file
func GetBestAsset ¶
func GetBestAsset(vec MatchVector) *AssetChunk
GetBestAsset retrieves an asset closest to the MatchVector's description
type InputAction ¶
type InputAction struct {
PositiveKeys []int32
NegativeKeys []int32
AllKeys []int32
JoyAxis int32
JoyButtons []int32
}
InputAction defines an action tagged by input
type MatchVector ¶
MatchVector specifies matching tags and their weights for asset lookup
type Profiler ¶
type Profiler struct {
ProfilerName string
StartTime float64
PassedTime float64
InvocationCount int32
DisplayString string
IsCollapsed bool
}
Profiler tracks the timing of particular operations.
func (*Profiler) StartInvocation ¶
func (p *Profiler) StartInvocation()
StartInvocation start timing this block
func (*Profiler) StopInvocation ¶
func (p *Profiler) StopInvocation()
StopInvocation stops timing this block
type Program ¶
Program describes shader pair
func NewProgram ¶
NewProgram creates a new shader program
func NewProgramFromCode ¶
NewProgramFromCode creates a new shader program from the code
func (*Program) GetShaderLocation ¶
GetShaderLocation retrieves the uniform location
func (*Program) RenderToTexture ¶
func (prog *Program) RenderToTexture(source, target RenderTarget)
RenderToTexture renders the current render target to an output
func (*Program) SetShaderValue ¶
SetShaderValue sets shader uniform value (float)
func (*Program) SetShaderValueMatrix ¶
SetShaderValueMatrix sets shader uniform value (mat4x4)
func (*Program) SetShaderValuei ¶
SetShaderValuei sets shader uniform value (int)
func (*Program) UpdateDefaultUniforms ¶
func (prog *Program) UpdateDefaultUniforms()
UpdateDefaultUniforms updates the shader with default game engine values
type RenderTarget ¶
type RenderTarget = rl.RenderTexture2D
RenderTarget describes our render texture
type ShaderPipeline ¶
type ShaderPipeline interface {
Apply()
}
ShaderPipeline describes the pipeline used for drawing things