Documentation ¶
Index ¶
- Constants
- func BuildProgram(vsrc string, fsrc string) (program uint32, err error)
- func CompileShader(stype uint32, source string) (shader uint32, err error)
- func CreateVAO() (array uint32, err error)
- func CreateVBO(size int, data interface{}, usage uint32) (buffer uint32, err error)
- func GetGLTexture(img image.Image, smoothing TextureSmoothing) (t uint32, err error)
- func GetInteger4(pname uint32) (v0, v1, v2, v3 int)
- func GetInverseMatrix(m mgl32.Mat4) (out mgl32.Mat4, err error)
- func GetVectorDeterminantEquation(a, b Point) func(Point) float32
- func LinkProgram(vertex uint32, fragment uint32) (program uint32, err error)
- func MusicIsPaused() bool
- func MusicIsPlaying() bool
- func PauseMusic()
- func Project(proj mgl32.Mat4, x float32, y float32) (sx, sy float32)
- func ResumeMusic()
- func Unproject(invproj mgl32.Mat4, x float32, y float32) (wx, wy float32)
- func WritePNG(path string, img image.Image) (err error)
- type Action
- type Animating
- type AnimatingEntity
- type Animation
- type AnimationCallback
- type Animator
- type AnimatorCallback
- type BackMenuItem
- type BaseEntity
- type BasicGameEvent
- type Batch
- type BatchRenderer
- type BoundValueMenuItem
- type BoundedAnimation
- type Camera
- type ChainedAnimation
- type Context
- func (c *Context) CreateWindow(w, h int, name string) (err error)
- func (c *Context) Delete()
- func (c *Context) Fullscreen() bool
- func (c *Context) SetCursor(val bool)
- func (c *Context) SetFullscreen(val bool)
- func (c *Context) SetResizable(val bool)
- func (c *Context) SetSwapInterval(val int)
- func (c *Context) ShouldClose() bool
- func (c *Context) SwapBuffers()
- type ContinuousAnimation
- type ContinuousFunc
- type Counter
- type EaseOutAnimation
- type Entity
- type Event
- type EventHandler
- type FontFace
- type FrameAnimation
- type FrameConfig
- type GETyper
- type GameEventCallback
- type GameEventHandler
- type GameEventType
- type GameEventTypeObservers
- type GlowRenderer
- func (r *GlowRenderer) Bind() error
- func (r *GlowRenderer) Delete() error
- func (r *GlowRenderer) DisableOutput()
- func (r *GlowRenderer) Draw() (err error)
- func (r *GlowRenderer) EnableOutput()
- func (r *GlowRenderer) GetError() error
- func (r *GlowRenderer) SetStrength(s float32)
- func (r *GlowRenderer) Unbind() error
- type Grid
- func (g *Grid) CanSee(from, to mgl32.Vec2) bool
- func (g *Grid) FixMove(bounds mgl32.Vec4, move mgl32.Vec2) (out mgl32.Vec2)
- func (g *Grid) Get(x, y int32) GridItem
- func (g *Grid) GetImage(fg, bg color.Color) *image.NRGBA
- func (g *Grid) GetIndex(index int32) GridItem
- func (g *Grid) GetPath(x1, y1, x2, y2 int32) (out []GridPoint, err error)
- func (g *Grid) GridAligned(x float32) float32
- func (g *Grid) GridPosition(v float32) int32
- func (g *Grid) Index(x, y int32) int32
- func (g *Grid) InversePosition(i int32) float32
- func (g *Grid) Set(x, y int32, val GridItem)
- func (g *Grid) SetIndex(index int32, val GridItem)
- type GridItem
- type GridPoint
- type GroupedAnimation
- type InterpolationType
- type Joystick
- type KeyCode
- type KeyEvent
- type KeyValueMenuItem
- type Layer
- type Layers
- type LineGeometry
- type LineStyle
- type LinearAnimation
- type LinesRenderer
- type Menu
- type MenuItem
- type MenuItemData
- type ModelViewConfig
- type MouseButton
- type MouseButtonEvent
- type MouseMoveEvent
- type Music
- type Normal
- type ParentMenuItem
- type Point
- type Rectangle
- type Renderer
- type Scripting
- type SoundEffect
- type SpriteConfig
- type SpriteRenderer
- type Spritesheet
- type SpritesheetFrame
- type SpritesheetFrameConfig
- type TextCache
- type TextRenderer
- type Texture
- type TextureSmoothing
- type TexturedPoint
- type TexturedTile
- type TileMetadata
Constants ¶
View Source
const ( Step60Hz = time.Duration(16666) * time.Microsecond Step30Hz = Step60Hz * 2 Step20Hz = time.Duration(50000) * time.Microsecond Step15Hz = Step30Hz * 2 Step10Hz = Step20Hz * 2 Step5Hz = Step10Hz * 2 )
View Source
const ( KeyUp = KeyCode(glfw.KeyUp) KeyDown = KeyCode(glfw.KeyDown) KeyLeft = KeyCode(glfw.KeyLeft) KeyRight = KeyCode(glfw.KeyRight) KeyEnter = KeyCode(glfw.KeyEnter) KeyEscape = KeyCode(glfw.KeyEscape) KeySpace = KeyCode(glfw.KeySpace) KeyA = KeyCode(glfw.KeyA) KeyB = KeyCode(glfw.KeyB) KeyC = KeyCode(glfw.KeyC) KeyD = KeyCode(glfw.KeyD) KeyE = KeyCode(glfw.KeyE) KeyF = KeyCode(glfw.KeyF) KeyG = KeyCode(glfw.KeyG) KeyH = KeyCode(glfw.KeyH) KeyI = KeyCode(glfw.KeyI) KeyJ = KeyCode(glfw.KeyJ) KeyK = KeyCode(glfw.KeyK) KeyL = KeyCode(glfw.KeyL) KeyM = KeyCode(glfw.KeyM) KeyN = KeyCode(glfw.KeyN) KeyO = KeyCode(glfw.KeyO) KeyP = KeyCode(glfw.KeyP) KeyQ = KeyCode(glfw.KeyQ) KeyR = KeyCode(glfw.KeyR) KeyS = KeyCode(glfw.KeyS) KeyT = KeyCode(glfw.KeyT) KeyU = KeyCode(glfw.KeyU) KeyV = KeyCode(glfw.KeyV) KeyW = KeyCode(glfw.KeyW) KeyX = KeyCode(glfw.KeyX) KeyY = KeyCode(glfw.KeyY) KeyZ = KeyCode(glfw.KeyZ) Key1 = KeyCode(glfw.Key1) Key2 = KeyCode(glfw.Key2) Key3 = KeyCode(glfw.Key3) Key4 = KeyCode(glfw.Key4) Key5 = KeyCode(glfw.Key5) Key6 = KeyCode(glfw.Key6) Key7 = KeyCode(glfw.Key7) Key8 = KeyCode(glfw.Key8) Key9 = KeyCode(glfw.Key9) Key0 = KeyCode(glfw.Key0) )
View Source
const ( Release = Action(glfw.Release) Press = Action(glfw.Press) Repeat = Action(glfw.Repeat) )
View Source
const ( MouseButton1 = MouseButton(glfw.MouseButton1) MouseButton2 = MouseButton(glfw.MouseButton2) MouseButton3 = MouseButton(glfw.MouseButton3) MouseButton4 = MouseButton(glfw.MouseButton4) MouseButton5 = MouseButton(glfw.MouseButton5) MouseButton6 = MouseButton(glfw.MouseButton6) MouseButton7 = MouseButton(glfw.MouseButton7) MouseButton8 = MouseButton(glfw.MouseButton8) MouseButtonLast = MouseButton(glfw.MouseButtonLast) MouseButtonLeft = MouseButton(glfw.MouseButtonLeft) MouseButtonRight = MouseButton(glfw.MouseButtonRight) MouseButtonMiddle = MouseButton(glfw.MouseButtonMiddle) )
View Source
const ( LinearInterpolation = InterpolationType(gl.LINEAR) NearestInterpolation = InterpolationType(gl.NEAREST) )
View Source
const BATCH_FRAGMENT = `#version 150
precision mediump float;
uniform sampler2D u_TextureUnit;
uniform vec2 u_TextureOffset;
in vec2 v_TextureCoordinates;
out vec4 v_FragData;
void main()
{
vec2 texcoords = v_TextureCoordinates + u_TextureOffset;
v_FragData = texture(u_TextureUnit, texcoords);
//v_FragData = vec4(1.0,0.0,0.0,1.0);
}` + "\x00"
View Source
const BATCH_VERTEX = `#version 150
in vec4 a_Position;
in vec2 a_TextureCoordinates;
uniform mat4 m_ModelViewMatrix;
uniform mat4 m_ProjectionMatrix;
out vec2 v_TextureCoordinates;
void main()
{
v_TextureCoordinates = a_TextureCoordinates;
gl_Position = m_ProjectionMatrix * m_ModelViewMatrix * a_Position;
}` + "\x00"
View Source
const GLOW_FRAGMENT = `#version 150
precision mediump float;
uniform sampler2D u_TextureUnit;
in vec2 v_TextureCoordinates;
uniform int Orientation;
uniform int BlurAmount;
uniform float BlurScale;
uniform float BlurStrength;
uniform vec2 BufferDimensions;
out vec4 v_FragData;
vec2 TexelSize = vec2(1.0 / BufferDimensions.x, 1.0 / BufferDimensions.y);
float Gaussian (float x, float deviation) {
return (1.0 / sqrt(2.0 * 3.141592 * deviation)) * exp(-((x * x) / (2.0 * deviation)));
}
void main() {
// Locals
float halfBlur = float(BlurAmount) * 0.5;
vec4 colour = vec4(0.0);
vec4 texColour = vec4(0.0);
// Gaussian deviation
float deviation = halfBlur * 0.35;
deviation *= deviation;
float strength = 1.0 - BlurStrength;
if ( Orientation == 0 ) {
// Horizontal blur
for (int i = 0; i < 10; ++i) {
if ( i >= BlurAmount ) {
break;
}
float offset = float(i) - halfBlur;
texColour = texture(
u_TextureUnit,
v_TextureCoordinates + vec2(offset * TexelSize.x * BlurScale, 0.0)) * Gaussian(offset * strength, deviation);
colour += texColour;
}
} else {
// Vertical blur
for (int i = 0; i < 10; ++i) {
if ( i >= BlurAmount ) {
break;
}
float offset = float(i) - halfBlur;
texColour = texture(
u_TextureUnit,
v_TextureCoordinates + vec2(0.0, offset * TexelSize.y * BlurScale)) * Gaussian(offset * strength, deviation);
colour += texColour;
}
}
// Apply colour
v_FragData = clamp(colour, 0.0, 1.0);
v_FragData.w = 1.0;
}` + "\x00"
View Source
const GLOW_VERTEX = `#version 150
in vec4 a_Position;
in vec2 a_TextureCoordinates;
out vec2 v_TextureCoordinates;
void main() {
v_TextureCoordinates = a_TextureCoordinates;
gl_Position = a_Position;
}` + "\x00"
View Source
const (
Joystick1 = Joystick(glfw.Joystick1)
)
View Source
const LINES_FRAGMENT = `#version 150
precision mediump float;
in float f_Edge;
uniform float f_Inner;
uniform vec4 v_Color;
out vec4 v_FragData;
void main() {
float v = 1.0 - abs(f_Edge);
v = smoothstep(0.65, 0.7, v * f_Inner);
v_FragData = mix(v_Color, vec4(0.0), v);
}` + "\x00"
View Source
const LINES_VERTEX = `#version 150
in vec2 v_Position;
in vec2 v_Normal;
in float f_Miter;
uniform float f_Thickness;
uniform mat4 m_ModelView;
uniform mat4 m_Projection;
out float f_Edge;
void main() {
f_Edge = sign(f_Miter);
//push the point along its normal by half thickness
vec2 position = v_Position.xy + vec2(v_Normal * f_Thickness/2.0 * f_Miter);
gl_Position = m_Projection * m_ModelView * vec4(position, 0.0, 1.0);
}` + "\x00"
View Source
const SPRITE_FRAGMENT = `#version 150
precision mediump float;
uniform sampler2D TextureUnit;
in vec2 v_TextureCoordinates;
in vec4 v_BaseColor;
out vec4 v_FragData;
void main() {
vec4 color = texture(TextureUnit, v_TextureCoordinates);
//if (color.a < 0.1) {
// discard;
//}
// This is really hacky
if (v_BaseColor.a > 0.1 && color.r == 1.0 && color.g == 100.0/255.0 && color.b == 1.0) {
v_FragData = v_BaseColor;
} else {
v_FragData = color;
}
}` + "\x00"
View Source
const SPRITE_VERTEX = `#version 150
in vec3 v_Translation;
in vec3 v_Rotation;
in vec3 v_Scale;
in vec4 v_Color;
in mat4 m_PointAdjustment;
in mat4 m_TextureAdjustment;
uniform mat4 m_ProjectionMatrix;
out vec4 v_BaseColor;
out vec2 v_TextureCoordinates;
const vec2 Points[] = vec2[6](
vec2(-0.5, -0.5),
vec2( 0.5, 0.5),
vec2(-0.5, 0.5),
vec2(-0.5, -0.5),
vec2( 0.5, -0.5),
vec2( 0.5, 0.5)
);
const vec2 TexturePoints[] = vec2[6](
vec2(0.0, 0.0),
vec2(1.0, 1.0),
vec2(0.0, 1.0),
vec2(0.0, 0.0),
vec2(1.0, 0.0),
vec2(1.0, 1.0)
);
void main() {
mat4 Translation = mat4(
vec4(1.0, 0.0, 0.0, v_Translation.x),
vec4(0.0, 1.0, 0.0, v_Translation.y),
vec4(0.0, 0.0, 1.0, v_Translation.z),
vec4(0.0, 0.0, 0.0, 1.0)
);
mat4 Scale = mat4(
vec4(v_Scale.x, 0.0, 0.0, 0.0),
vec4( 0.0, v_Scale.y, 0.0, 0.0),
vec4( 0.0, 0.0, v_Scale.z, 0.0),
vec4( 0.0, 0.0, 0.0, 1.0)
);
float rotCos = float(cos(v_Rotation.x));
float rotSin = float(sin(v_Rotation.x));
mat4 Rotation = mat4(
vec4(rotCos, -rotSin, 0.0, 0.0),
vec4(rotSin, rotCos, 0.0, 0.0),
vec4( 0.0, 0.0, 1.0, 0.0),
vec4( 0.0, 0.0, 0.0, 1.0)
);
v_BaseColor = v_Color;
v_TextureCoordinates = (vec4(TexturePoints[gl_VertexID], 0.0, 1.0) *
m_TextureAdjustment).xy;
gl_Position = m_ProjectionMatrix *
(vec4(Points[gl_VertexID], 0.0, 1.0) *
m_PointAdjustment *
Scale *
Rotation *
Translation);
}` + "\x00"
View Source
const TEXT_FRAGMENT = `#version 150
precision mediump float;
uniform sampler2D u_TextureUnit;
in vec2 v_TextureCoordinates;
out vec4 v_FragData;
void main()
{
v_FragData = texture(u_TextureUnit, v_TextureCoordinates);
}` + "\x00"
View Source
const TEXT_VERTEX = `#version 150
in vec4 a_Position;
in vec2 a_TextureCoordinates;
uniform mat4 m_ProjectionMatrix;
uniform vec3 v_Trans;
uniform vec3 v_Scale;
out vec2 v_TextureCoordinates;
void main()
{
mat4 trans;
trans[0] = vec4(1,0,0,0);
trans[1] = vec4(0,1,0,0);
trans[2] = vec4(0,0,1,0);
trans[3] = vec4(v_Trans.x,v_Trans.y,v_Trans.z,1);
mat4 scale;
scale[0] = vec4(v_Scale.x,0,0,0);
scale[1] = vec4(0,v_Scale.y,0,0);
scale[2] = vec4(0,0,v_Scale.z,0);
scale[3] = vec4(0,0,0,1);
v_TextureCoordinates = a_TextureCoordinates;
gl_Position = m_ProjectionMatrix * trans * scale * a_Position;
}` + "\x00"
Variables ¶
This section is empty.
Functions ¶
func GetGLTexture ¶
func GetGLTexture(img image.Image, smoothing TextureSmoothing) (t uint32, err error)
func GetInteger4 ¶
Convenience function for glGetIntegerv
func MusicIsPaused ¶
func MusicIsPaused() bool
func MusicIsPlaying ¶
func MusicIsPlaying() bool
func PauseMusic ¶
func PauseMusic()
func ResumeMusic ¶
func ResumeMusic()
Types ¶
type Animating ¶
type Animating interface { Update(elapsed time.Duration) (done bool) SetCallback(callback AnimationCallback) HasCallback() bool Reset() }
type AnimatingEntity ¶
type AnimatingEntity struct { *BaseEntity // contains filtered or unexported fields }
func NewAnimatingEntity ¶
func NewAnimatingEntity(x, y, w, h, r float32, l time.Duration, f []int) *AnimatingEntity
func (*AnimatingEntity) Frame ¶
func (e *AnimatingEntity) Frame() int
func (*AnimatingEntity) OffsetFrame ¶
func (e *AnimatingEntity) OffsetFrame(offset int) int
func (*AnimatingEntity) SetCallback ¶
func (e *AnimatingEntity) SetCallback(callback AnimationCallback)
func (*AnimatingEntity) SetFrames ¶
func (e *AnimatingEntity) SetFrames(f []int)
func (*AnimatingEntity) Update ¶
func (e *AnimatingEntity) Update(elapsed time.Duration)
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
func NewAnimation ¶
func NewAnimation() *Animation
func (*Animation) HasCallback ¶
func (*Animation) SetCallback ¶
func (a *Animation) SetCallback(callback AnimationCallback)
type AnimationCallback ¶
type AnimationCallback func()
type AnimatorCallback ¶
type AnimatorCallback func()
type BackMenuItem ¶
type BackMenuItem struct {
// contains filtered or unexported fields
}
func NewBackMenuItem ¶
func NewBackMenuItem(label string) (item *BackMenuItem)
func (*BackMenuItem) Highlighted ¶
func (mi *BackMenuItem) Highlighted() bool
type BaseEntity ¶
type BaseEntity struct {
// contains filtered or unexported fields
}
func NewBaseEntity ¶
func NewBaseEntity(x, y, w, h, r float32, frame int) *BaseEntity
func (*BaseEntity) Bounds ¶
func (e *BaseEntity) Bounds() Rectangle
func (*BaseEntity) Frame ¶
func (e *BaseEntity) Frame() int
func (*BaseEntity) MoveTo ¶
func (e *BaseEntity) MoveTo(pt Point)
func (*BaseEntity) MoveToCoords ¶
func (e *BaseEntity) MoveToCoords(x, y float32)
func (*BaseEntity) Pos ¶
func (e *BaseEntity) Pos() Point
func (*BaseEntity) Rotation ¶
func (e *BaseEntity) Rotation() float32
func (*BaseEntity) Update ¶
func (e *BaseEntity) Update(elapsed time.Duration)
type BasicGameEvent ¶
type BasicGameEvent struct {
// contains filtered or unexported fields
}
func NewBasicGameEvent ¶
func NewBasicGameEvent(t GameEventType) *BasicGameEvent
func (*BasicGameEvent) GEType ¶
func (e *BasicGameEvent) GEType() GameEventType
type Batch ¶
type Batch struct { Buffer uint32 Texture *Texture Count int // contains filtered or unexported fields }
func LoadBatch ¶
func LoadBatch(tiles []TexturedTile, metadata TileMetadata) (b *Batch, err error)
func (*Batch) SetTextureOffsetPx ¶
type BatchRenderer ¶
type BatchRenderer struct { *Renderer Program uint32 PositionLoc uint32 TextureLoc uint32 TextureUnitLoc int32 ModelViewLoc int32 ProjectionLoc int32 TexOffsetLoc int32 }
func NewBatchRenderer ¶
func NewBatchRenderer(camera *Camera) (tr *BatchRenderer, err error)
func (*BatchRenderer) Bind ¶
func (r *BatchRenderer) Bind() error
func (*BatchRenderer) Delete ¶
func (tr *BatchRenderer) Delete() error
func (*BatchRenderer) Unbind ¶
func (tr *BatchRenderer) Unbind() error
type BoundValueMenuItem ¶
type BoundValueMenuItem struct { KeyValueMenuItem // contains filtered or unexported fields }
func NewBoundValueMenuItem ¶
func NewBoundValueMenuItem(label string, val int32, dest *int32) *BoundValueMenuItem
func (*BoundValueMenuItem) Highlighted ¶
func (mi *BoundValueMenuItem) Highlighted() bool
func (*BoundValueMenuItem) IsSameAsDest ¶
func (mi *BoundValueMenuItem) IsSameAsDest() bool
func (*BoundValueMenuItem) SetDest ¶
func (mi *BoundValueMenuItem) SetDest()
type BoundedAnimation ¶
type BoundedAnimation struct { Elapsed time.Duration Duration time.Duration Callback AnimatorCallback }
func (*BoundedAnimation) Delete ¶
func (a *BoundedAnimation) Delete()
func (*BoundedAnimation) IsDone ¶
func (a *BoundedAnimation) IsDone() bool
func (*BoundedAnimation) Reset ¶
func (a *BoundedAnimation) Reset()
func (*BoundedAnimation) SetCallback ¶
func (a *BoundedAnimation) SetCallback(Callback AnimatorCallback)
type Camera ¶
type Camera struct { WorldBounds Rectangle ScreenBounds Rectangle Projection mgl32.Mat4 Inverse mgl32.Mat4 }
func (*Camera) ScreenToWorldCoords ¶
func (*Camera) SetScreenBounds ¶
func (*Camera) SetWorldBounds ¶
func (*Camera) WorldToScreenCoords ¶
type ChainedAnimation ¶
type ChainedAnimation struct { Callback AnimatorCallback // contains filtered or unexported fields }
func (*ChainedAnimation) Delete ¶
func (a *ChainedAnimation) Delete()
func (*ChainedAnimation) IsDone ¶
func (a *ChainedAnimation) IsDone() bool
func (*ChainedAnimation) Reset ¶
func (a *ChainedAnimation) Reset()
func (*ChainedAnimation) SetCallback ¶
func (a *ChainedAnimation) SetCallback(Callback AnimatorCallback)
type Context ¶
type Context struct { Events *EventHandler OpenGLVersion string ShaderVersion string VAO uint32 // contains filtered or unexported fields }
func NewContext ¶
func (*Context) Fullscreen ¶
func (*Context) SetFullscreen ¶
func (*Context) SetResizable ¶
func (*Context) SetSwapInterval ¶
func (*Context) ShouldClose ¶
func (*Context) SwapBuffers ¶
func (c *Context) SwapBuffers()
type ContinuousAnimation ¶
type ContinuousAnimation struct { *Animation // contains filtered or unexported fields }
func NewContinuousAnimation ¶
func NewContinuousAnimation(f ContinuousFunc) *ContinuousAnimation
func (*ContinuousAnimation) Value ¶
func (a *ContinuousAnimation) Value() float32
type ContinuousFunc ¶
func SineDecayFunc ¶
func SineDecayFunc(duration time.Duration, amplitude, frequency, decay float32, callback AnimationCallback) ContinuousFunc
type Counter ¶
func NewCounter ¶
func NewCounter() *Counter
type EaseOutAnimation ¶
type EaseOutAnimation struct { BoundedAnimation // contains filtered or unexported fields }
func NewEaseOutAnimation ¶
func NewEaseOutAnimation(target *float32, from, to float32, duration time.Duration) *EaseOutAnimation
type EventHandler ¶
type EventHandler struct { Events chan Event // contains filtered or unexported fields }
func NewEventHandler ¶
func NewEventHandler(w *glfw.Window) (e *EventHandler)
func (*EventHandler) GetKey ¶
func (e *EventHandler) GetKey(code KeyCode) Action
func (*EventHandler) JoystickAxes ¶
func (e *EventHandler) JoystickAxes(joystick Joystick) []float32
func (*EventHandler) JoystickButtons ¶
func (e *EventHandler) JoystickButtons(joystick Joystick) []byte
func (*EventHandler) JoystickPresent ¶
func (e *EventHandler) JoystickPresent(joystick Joystick) bool
func (*EventHandler) Poll ¶
func (e *EventHandler) Poll()
type FontFace ¶
type FontFace struct {
// contains filtered or unexported fields
}
func NewFontFace ¶
type FrameAnimation ¶
func NewFrameAnimation ¶
func NewFrameAnimation(length time.Duration, frames []int) *FrameAnimation
func (*FrameAnimation) OffsetFrame ¶
func (a *FrameAnimation) OffsetFrame(offset int) int
func (*FrameAnimation) SetSequence ¶
func (a *FrameAnimation) SetSequence(seq []int)
type FrameConfig ¶
type GETyper ¶
type GETyper interface {
GEType() GameEventType
}
type GameEventCallback ¶
type GameEventCallback func(GETyper)
type GameEventHandler ¶
type GameEventHandler struct {
// contains filtered or unexported fields
}
func NewGameEventHandler ¶
func NewGameEventHandler(numGameEventTypes int) (h *GameEventHandler)
func (*GameEventHandler) AddObserver ¶
func (h *GameEventHandler) AddObserver(t GameEventType, c GameEventCallback) (id int)
func (*GameEventHandler) Enqueue ¶
func (h *GameEventHandler) Enqueue(e GETyper)
func (*GameEventHandler) Poll ¶
func (h *GameEventHandler) Poll()
func (*GameEventHandler) RemoveObserver ¶
func (h *GameEventHandler) RemoveObserver(t GameEventType, id int)
type GameEventType ¶
type GameEventType int
type GameEventTypeObservers ¶
type GameEventTypeObservers map[int]GameEventCallback
type GlowRenderer ¶
type GlowRenderer struct { GlowFb uint32 GlowTex uint32 BlurFb uint32 BlurTex uint32 // contains filtered or unexported fields }
func NewGlowRenderer ¶
func (*GlowRenderer) Bind ¶
func (r *GlowRenderer) Bind() error
func (*GlowRenderer) Delete ¶
func (r *GlowRenderer) Delete() error
func (*GlowRenderer) DisableOutput ¶
func (r *GlowRenderer) DisableOutput()
func (*GlowRenderer) Draw ¶
func (r *GlowRenderer) Draw() (err error)
func (*GlowRenderer) EnableOutput ¶
func (r *GlowRenderer) EnableOutput()
func (*GlowRenderer) GetError ¶
func (r *GlowRenderer) GetError() error
func (*GlowRenderer) SetStrength ¶
func (r *GlowRenderer) SetStrength(s float32)
func (*GlowRenderer) Unbind ¶
func (r *GlowRenderer) Unbind() error
type Grid ¶
type Grid struct { Width int32 Height int32 BlockSize float32 // contains filtered or unexported fields }
func (*Grid) GetPath ¶
Pretty much a direct A* implementation from http://theory.stanford.edu/~amitp/GameProgramming/ImplementationNotes.html
func (*Grid) GridAligned ¶
func (*Grid) GridPosition ¶
func (*Grid) InversePosition ¶
type GroupedAnimation ¶
type GroupedAnimation struct { Callback AnimatorCallback // contains filtered or unexported fields }
func (*GroupedAnimation) Delete ¶
func (a *GroupedAnimation) Delete()
func (*GroupedAnimation) IsDone ¶
func (a *GroupedAnimation) IsDone() bool
func (*GroupedAnimation) Reset ¶
func (a *GroupedAnimation) Reset()
func (*GroupedAnimation) SetCallback ¶
func (a *GroupedAnimation) SetCallback(Callback AnimatorCallback)
type InterpolationType ¶
type InterpolationType uint32
type KeyValueMenuItem ¶
type KeyValueMenuItem struct {
// contains filtered or unexported fields
}
func NewKeyValueMenuItem ¶
func NewKeyValueMenuItem(label string, key, value int32) *KeyValueMenuItem
func (*KeyValueMenuItem) Data ¶
func (mi *KeyValueMenuItem) Data() *MenuItemData
func (*KeyValueMenuItem) Highlighted ¶
func (mi *KeyValueMenuItem) Highlighted() bool
type Layers ¶
type Layers struct {
// contains filtered or unexported fields
}
func (*Layers) HandleEvent ¶
type LineGeometry ¶
type LineGeometry struct { Points []TexturedPoint Vertices []TexturedPoint Indices []uint32 }
func NewLineGeometry ¶
func NewLineGeometry(path []mgl32.Vec2, closed bool) (out *LineGeometry)
type LinearAnimation ¶
type LinearAnimation struct { BoundedAnimation // contains filtered or unexported fields }
func NewLinearAnimation ¶
func NewLinearAnimation(target *float32, from, to float32, duration time.Duration) *LinearAnimation
type LinesRenderer ¶
type LinesRenderer struct { *Renderer // contains filtered or unexported fields }
func NewLinesRenderer ¶
func NewLinesRenderer(camera *Camera) (lr *LinesRenderer, err error)
func (*LinesRenderer) Bind ¶
func (lr *LinesRenderer) Bind() (err error)
func (*LinesRenderer) Delete ¶
func (lr *LinesRenderer) Delete() (err error)
func (*LinesRenderer) Draw ¶
func (lr *LinesRenderer) Draw(line *LineGeometry, mv mgl32.Mat4, style *LineStyle) (err error)
func (*LinesRenderer) Unbind ¶
func (lr *LinesRenderer) Unbind() (err error)
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
func (*Menu) HighlightItem ¶
func (*Menu) Select ¶
func (m *Menu) Select() *MenuItemData
func (*Menu) SelectItem ¶
func (m *Menu) SelectItem(item MenuItem) *MenuItemData
type MenuItemData ¶
type ModelViewConfig ¶
type MouseButton ¶
type MouseButton int
type MouseButtonEvent ¶
type MouseButtonEvent struct { Button MouseButton Type Action }
type MouseMoveEvent ¶
type ParentMenuItem ¶
type ParentMenuItem struct {
// contains filtered or unexported fields
}
func NewParentMenuItem ¶
func NewParentMenuItem(label string, children []MenuItem) (item *ParentMenuItem)
func (*ParentMenuItem) Children ¶
func (mi *ParentMenuItem) Children() []MenuItem
func (*ParentMenuItem) Highlighted ¶
func (mi *ParentMenuItem) Highlighted() bool
type Point ¶
func (Point) DistanceTo ¶
type Rectangle ¶
func (Rectangle) ContainsPoint ¶
func (Rectangle) IntersectedBy ¶
Returns true if r is intersection by the line a, b.
type Scripting ¶
type Scripting struct {
// contains filtered or unexported fields
}
func NewScripting ¶
func (*Scripting) LoadScript ¶
func (*Scripting) TriggerEvent ¶
type SoundEffect ¶
type SoundEffect struct {
// contains filtered or unexported fields
}
func NewSoundEffect ¶
func NewSoundEffect(path string) (s *SoundEffect, err error)
func (*SoundEffect) Delete ¶
func (s *SoundEffect) Delete()
func (*SoundEffect) IsPlaying ¶
func (s *SoundEffect) IsPlaying(channel int) int
func (*SoundEffect) Play ¶
func (s *SoundEffect) Play(times int)
func (*SoundEffect) PlayChannel ¶
func (s *SoundEffect) PlayChannel(channel int, times int)
func (*SoundEffect) SetVolume ¶
func (s *SoundEffect) SetVolume(volume int)
type SpriteConfig ¶
type SpriteConfig struct { View ModelViewConfig Frame FrameConfig Color mgl32.Vec4 }
type SpriteRenderer ¶
type SpriteRenderer struct { *Renderer // contains filtered or unexported fields }
func NewSpriteRenderer ¶
func NewSpriteRenderer(camera *Camera) (tr *SpriteRenderer, err error)
func (*SpriteRenderer) Delete ¶
func (tr *SpriteRenderer) Delete() error
func (*SpriteRenderer) Draw ¶
func (tr *SpriteRenderer) Draw(instances []SpriteConfig) error
type Spritesheet ¶
type Spritesheet struct { TexturePath string // contains filtered or unexported fields }
func NewSpritesheet ¶
func NewSpritesheet(path string) *Spritesheet
func ParseTexturePackerJSONArrayString ¶
func ParseTexturePackerJSONArrayString(contents string, pxPerUnit float32) (s *Spritesheet, err error)
func (*Spritesheet) AddFrame ¶
func (s *Spritesheet) AddFrame(name string, config SpritesheetFrameConfig)
func (*Spritesheet) GetFrame ¶
func (s *Spritesheet) GetFrame(name string) *SpritesheetFrame
type SpritesheetFrame ¶
type SpritesheetFrame struct { Frame FrameConfig Width float32 // In units Height float32 // In units }
type SpritesheetFrameConfig ¶
type SpritesheetFrameConfig struct {
// contains filtered or unexported fields
}
func (SpritesheetFrameConfig) ToSpritesheetFrame ¶
func (c SpritesheetFrameConfig) ToSpritesheetFrame() *SpritesheetFrame
type TextCache ¶
func NewTextCache ¶
type TextRenderer ¶
type TextRenderer struct { *Renderer VBO uint32 Program uint32 Texture uint32 PositionLoc uint32 TextureLoc uint32 ScaleLoc int32 TransLoc int32 ProjectionLoc int32 TextureUnitLoc int32 Width float32 Height float32 // contains filtered or unexported fields }
func NewTextRenderer ¶
func NewTextRenderer(camera *Camera) (tr *TextRenderer, err error)
func (*TextRenderer) Bind ¶
func (tr *TextRenderer) Bind() error
func (*TextRenderer) Delete ¶
func (tr *TextRenderer) Delete() error
func (*TextRenderer) Draw ¶
func (tr *TextRenderer) Draw(tex *Texture, x, y, scale float32) (err error)
func (*TextRenderer) Unbind ¶
func (tr *TextRenderer) Unbind() error
type Texture ¶
func GetTexture ¶
func GetTexture(img image.Image, smoothing TextureSmoothing) (texture *Texture, err error)
func GetTruncatedTexture ¶
func LoadTexture ¶
func LoadTexture(path string, smoothing TextureSmoothing) (texture *Texture, err error)
type TextureSmoothing ¶
type TextureSmoothing int
const ( Nearest TextureSmoothing = gl.NEAREST Linear TextureSmoothing = gl.LINEAR )
type TexturedPoint ¶
type TexturedTile ¶
type TileMetadata ¶
Source Files ¶
- a_star.go
- animation.go
- animation_animator.go
- camera.go
- context.go
- core_interfaces.go
- counter.go
- entity.go
- events.go
- gameevents.go
- geometry.go
- grid.go
- image.go
- layers.go
- lines.go
- matrix.go
- menu.go
- render_structs.go
- renderer.go
- renderer_batch.go
- renderer_glow.go
- renderer_lines.go
- renderer_sprite.go
- renderer_text.go
- script.go
- sound.go
- soundeffect.go
- spritesheet.go
- text.go
- texture.go
Click to show internal directories.
Click to hide internal directories.