system

package
v0.0.0-...-7232e10 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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"}
)
View Source
var (

	// GamepadDeadZone movement threshold
	GamepadDeadZone = 0.25

	// GamepadID represents the controller index
	GamepadID int32

	// MouseDelta contains last mouse movement
	MouseDelta [2]int32
)
View Source
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
)
View Source
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 GetAxis

func GetAxis(action string) (rate float32)

GetAxis returns the axis value of an input

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 GetFile

func GetFile(path string, checkGlobalDir bool) []byte

GetFile retrieves a file from a disk

func GetMousePosition

func GetMousePosition() [2]int32

GetMousePosition returns a fixed mouse position

func GetRootFile

func GetRootFile(path string) []byte

GetRootFile retrieves a file inside of game root from a disk

func GetTexture

func GetTexture(texturePath string) *rl.Texture2D

GetTexture retrieves a cached texture from disk

func InitAssets

func InitAssets(archiveNames []string, isDebugMode bool)

InitAssets initializes all asset info

func InitInput

func InitInput()

InitInput initializes the input system

func InitRenderer

func InitRenderer(title string, winW, winH int32)

InitRenderer initializes the renderer and creates the window

func IsKeyDown

func IsKeyDown(action string) bool

IsKeyDown checks whether the key is down

func IsKeyPressed

func IsKeyPressed(action string) bool

IsKeyPressed checks whether the key is pressed

func IsKeyReleased

func IsKeyReleased(action string) bool

IsKeyReleased checks whether the key is released

func PushTag

func PushTag(tag string) uint64

PushTag registers a tag

func UpdateInput

func UpdateInput()

UpdateInput updates the user input

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 FindAsset

func FindAsset(fileName string) *AssetChunk

FindAsset looks for asset by filename

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

type MatchVector struct {
	Tags    []uint64
	Weights []float64
}

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 NewProfiler

func NewProfiler(name string) *Profiler

NewProfiler returns a new profiler

func (*Profiler) GetTime

func (p *Profiler) GetTime(divisor float64) (result float64)

GetTime returns the passed time and resets the profiler

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

type Program struct {
	Shader   rl.Shader
	Uniforms map[string]int32
}

Program describes shader pair

func NewProgram

func NewProgram(vsFileName, fsFileName string) Program

NewProgram creates a new shader program

func NewProgramFromCode

func NewProgramFromCode(vsCode, fsCode string) Program

NewProgramFromCode creates a new shader program from the code

func (*Program) GetShaderLocation

func (prog *Program) GetShaderLocation(locName string) int32

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

func (prog *Program) SetShaderValue(locName string, values []float32, count int32)

SetShaderValue sets shader uniform value (float)

func (*Program) SetShaderValueMatrix

func (prog *Program) SetShaderValueMatrix(locName string, mat rl.Matrix)

SetShaderValueMatrix sets shader uniform value (mat4x4)

func (*Program) SetShaderValuei

func (prog *Program) SetShaderValuei(locName string, values []int32, count int32)

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

Jump to

Keyboard shortcuts

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