Documentation ¶
Index ¶
- Constants
- Variables
- func DrawCanvas(win *pixelgl.Window, canvas *pixelgl.Canvas)
- func Render(win *pixelgl.Window)
- func TransitionTo(o Scene)
- type AnyInputMethod
- type ControlScheme
- type ControllerInput
- type Controls
- type DestroyableScene
- type InputMethod
- type JoystickAxisInputMethod
- type JoystickButtonInputMethod
- type JoystickControlSchemeFactory
- type KeyboardInputMethod
- type Player
- type Scene
Constants ¶
View Source
const ( CollisionTypePlayer = 1 << (iota + 1) CollisionTypeEnemy CollisionTypeWall )
View Source
const BoostDelay = 7 * time.Second
View Source
const LevelTitleDelay = 3 * time.Second
View Source
const MaxPlayers = 2
Variables ¶
View Source
var ( GameBounds = pixel.R(-1920/2, -1080/2, 1920/2, 1080/2) PlayerColors = []color.Color{colornames.Gold, colornames.Limegreen} )
View Source
var Players []ControlScheme
Functions ¶
func DrawCanvas ¶ added in v1.11.0
DrawCanvas draws a canvas to the window, properly scaling and moving the canvas to fit within the window.
The aspect ratio of the canvas is maintained when scaled.
func TransitionTo ¶
func TransitionTo(o Scene)
TransitionTo changes the currently active scene, destroying the previous scene if necessary.
Types ¶
type AnyInputMethod ¶ added in v1.6.12
type AnyInputMethod struct {
Methods []InputMethod
}
func (AnyInputMethod) GetInput ¶ added in v1.6.12
func (im AnyInputMethod) GetInput(win *pixelgl.Window) bool
func (AnyInputMethod) String ¶ added in v1.6.12
func (im AnyInputMethod) String() string
type ControlScheme ¶
type ControlScheme struct {
Thrust, Left, Right, Shoot, Boost InputMethod
}
type ControllerInput ¶
type DestroyableScene ¶
type DestroyableScene interface { Scene Destroy() }
DestroyableScene represents a scene that must be explicitly disposed of.
type InputMethod ¶
func AnyInput ¶ added in v1.6.12
func AnyInput(methods ...InputMethod) InputMethod
type JoystickAxisInputMethod ¶
type JoystickAxisInputMethod struct { Joystick pixelgl.Joystick Axis int // Inverse makes GetInput return true when |axis|>threshold && axis < 0. Inverse bool Threshold float64 Alias string }
func (JoystickAxisInputMethod) GetInput ¶
func (im JoystickAxisInputMethod) GetInput(win *pixelgl.Window) bool
func (JoystickAxisInputMethod) String ¶
func (im JoystickAxisInputMethod) String() string
type JoystickButtonInputMethod ¶
func (JoystickButtonInputMethod) GetInput ¶
func (im JoystickButtonInputMethod) GetInput(win *pixelgl.Window) bool
func (JoystickButtonInputMethod) String ¶
func (im JoystickButtonInputMethod) String() string
type JoystickControlSchemeFactory ¶ added in v1.6.12
type JoystickControlSchemeFactory func(pixelgl.Joystick) ControlScheme
type KeyboardInputMethod ¶
func (KeyboardInputMethod) GetInput ¶
func (im KeyboardInputMethod) GetInput(win *pixelgl.Window) bool
func (KeyboardInputMethod) String ¶
func (im KeyboardInputMethod) String() string
type Scene ¶
type Scene interface { // Render is called repeatedly as long as this Scene is the currently active scene (the value of current). Render(win *pixelgl.Window) }
Scene represents a logical division of the game (like a slide in PowerPoint).
func NewLevelScene ¶ added in v1.11.0
func NewMainscreenScene ¶ added in v1.11.0
func NewMainscreenScene() Scene
func NewTitleScene ¶ added in v1.11.0
Click to show internal directories.
Click to hide internal directories.