Documentation ¶
Overview ¶
VoV engine
VoV engine ¶
VoV engine ¶
VoV engine ¶
VoV engine
Index ¶
- Constants
- Variables
- func GetTicks() uint32
- func Pause()
- func StartTimer()
- func StopTimer()
- func Unpause()
- type Config
- type Engine
- func (e *Engine) Clear()
- func (e *Engine) CloseController()
- func (e *Engine) Destroy()
- func (e *Engine) EndFrame()
- func (e *Engine) Fullscreen()
- func (e *Engine) GetDimensions() (width, height int)
- func (e *Engine) Init() (err error)
- func (e *Engine) Quit()
- func (e *Engine) SetAccelerometer()
- func (e *Engine) SetController(mappings []string)
- func (e *Engine) SetHaptic()
- func (e *Engine) SetIcon(icon *sdl.Surface)
- func (e *Engine) StartFrame()
- func (e *Engine) UpdateDimensions()
- type Glyph
- type Resource
- func (r *Resource) DrawText(text string, x, y int32, font int)
- func (r *Resource) Free()
- func (r *Resource) FreeGlyphs()
- func (r *Resource) FreeRocks()
- func (r *Resource) Load()
- func (r *Resource) LoadFont(filename string, size int) (font *ttf.Font)
- func (r *Resource) LoadGlyphs()
- func (r *Resource) LoadMappings()
- func (r *Resource) LoadMusic(filename string) (music *mix.Music)
- func (r *Resource) LoadRocks()
- func (r *Resource) LoadSound(filename string) (sound *mix.Chunk)
- func (r *Resource) LoadSurface(filename string) (image *sdl.Surface)
- func (r *Resource) LoadTexture(filename string) (image *sdl.Texture)
- func (r *Resource) PlayMusic(music *mix.Music, loops int)
- func (r *Resource) PlaySound(sound *mix.Chunk, channel int, loops int)
- func (r *Resource) PlaySoundTimed(sound *mix.Chunk, channel int, loops int, ticks int)
- func (r *Resource) RenderText(font *ttf.Font, text string, color sdl.Color, blended bool, outline int) (image *sdl.Texture)
- type State
- type StateMachine
Constants ¶
View Source
const ( FONT_SMALL = iota FONT_SMALL_RED FONT_MEDIUM FONT_LARGE )
View Source
const (
// Export for window icon
ImageIcon = "icon.png"
)
Variables ¶
View Source
var ( // Paused boolean Paused bool // Started boolean Started bool // WasPaused boolean WasPaused bool // The time when the timer started StartTicks uint32 // The ticks stored when the timer was paused PausedTicks uint32 )
View Source
var ( // Haptic device Haptic *sdl.Haptic )
Functions ¶
Types ¶
type Config ¶
type Config struct { // Enable music MusicEnabled bool // Enable sounds SoundsEnabled bool // Enable accelerometer AccelerometerEnabled bool // Accelerometer threshold AccelThreshold float64 // Touch threshold TouchThreshold float64 // Enable haptic HapticEnabled bool // Show frames per second ShowFps bool // Maximum frames per second MaxFps int // Barrier speed BarrierSpeed float64 // Ship bounciness from screen edges Bounciness float64 // Number of rock prototypes NRocks int // Number of rock structs to allocate MaxRocks int // Number of powups structs to allocate MaxPowups int // How often to generate powups PowupsTimeout int // How much milliseconds powup lasts PowupStateTimeout float64 // Scale powup text PowupTextScale float64 // Powup text timeout PowupTextTimeout float64 // Number of animation sprites NFrames uint32 // Gamespeed GameSpeed float64 // Initial rocks InitialRocks int // Final rocks FinalRocks int // 32s for a speed=1 rock to cross the screen horizontally KH float64 // 24s for a speed=1 rock to cross the screen vertically KV float64 // range for rock dx values (+/-) RDX float64 // range for rock dy values (+/-) RDY float64 // Dust color depth MaxDustDepth float64 // Number of dust motes NDustMotes int // Number od dust arrays NDustArray int // Maximum ship engine dots MaxShipDots int // Number od ship dots arrays NShipDotsArray int // Maximum bang dots MaxBangDots int // Number od bang dots arrays NBangDotsArray int // Ship thruster strength ThrusterStrength float64 // How many engine dots come out of each thruster EngineDots int // Dots heat colors W int M int // Determines how hard dots push the rocks. Set to 0 to disable pushing rocks DotMassUnit float64 // Time (in 1/60ths of a seccond) between when you blow up, and when next ship appears DeadPauseLength float64 // Time (in milliseconds) to be invincible after next ship appears InvinciblePauseLength float64 // Game over state timeout GameOverLength float64 // Time (in milliseconds) to show scores screen after hiscore/gameover ScoresLength float64 // Number of scores NScores int // Window width WinWidth float64 // Window height WinHeight float64 // X scroll XScrollTo float64 // Y scroll YScrollTo float64 // Distance ahead DistAhead float64 // Maximum distance ahead MaxDistAhead float64 // Credits scroll speed ScrollSpeed float64 }
Configuration structure
type Engine ¶
type Engine struct { // Config Cfg *Config // Game state State StateMachine // SDL Window Window *sdl.Window // SDL Renderer Renderer *sdl.Renderer // Game controller Controller *sdl.GameController // Joystick Joystick *sdl.Joystick // Boolean set to true until exit Running bool // Screen X distance ScreenDX float64 // Screen Y distance ScreenDY float64 // Frames counter Frames int // Frames per second Fps float64 // Maximum fps in ms FrameMs uint32 // Start of frame (milliseconds) StartTicks uint32 // End of frame (milliseconds) EndTicks uint32 // Delta time between frames FrameDelta uint32 // Length of frame adjusted for gamespeed TFrame float64 }
SDL engine structure
func (*Engine) GetDimensions ¶
Gets window dimensions based on display aspect ratio
func (*Engine) SetController ¶
Initializes game controller
type Resource ¶
type Resource struct { Engine *Engine DataDir string Mappings []string FontMain *ttf.Font FontSmall *ttf.Font FontTitle *ttf.Font FontMedium *ttf.Font SoundClick *mix.Chunk SoundBounce *mix.Chunk SoundEngine1 *mix.Chunk SoundEngine2 *mix.Chunk SoundEngine3 *mix.Chunk SoundPowup0 *mix.Chunk SoundPowup1 *mix.Chunk SoundPowup2 *mix.Chunk SoundPowup3 *mix.Chunk SoundPowup4 *mix.Chunk SoundPowup5 *mix.Chunk SoundExplosion1 *mix.Chunk SoundExplosion2 *mix.Chunk MusicMenu *mix.Music MusicGame *mix.Music Ship *sdl.Texture ShipSurf *sdl.Surface ShipGlow *sdl.Texture Powup *sdl.Texture PowupSurf *sdl.Surface PowupGlow *sdl.Texture Life *sdl.Texture Background1 *sdl.Texture Background2 *sdl.Texture Background3 *sdl.Texture Explosion1 *sdl.Texture Explosion2 *sdl.Texture LoadingText *sdl.Texture TitleText *sdl.Texture HiScoreText *sdl.Texture HiScoreEnterText *sdl.Texture StartText *sdl.Texture StartTextHi *sdl.Texture ScoresText *sdl.Texture ScoresTextHi *sdl.Texture OptionsText *sdl.Texture OptionsTextHi *sdl.Texture CreditsText *sdl.Texture CreditsTextHi *sdl.Texture ProgrammingText *sdl.Texture ProgrammingCreditText *sdl.Texture MusicAndSoundsText *sdl.Texture MusicAndSoundsCreditText *sdl.Texture GraphicsText *sdl.Texture GraphicsCreditText *sdl.Texture FontText *sdl.Texture FontCreditText *sdl.Texture BasedText *sdl.Texture BasedCreditText *sdl.Texture SDLText *sdl.Texture SDLCreditText *sdl.Texture GoText *sdl.Texture GoCreditText *sdl.Texture VoVText *sdl.Texture VoVCreditText *sdl.Texture MusicText *sdl.Texture MusicTextHi *sdl.Texture SoundsText *sdl.Texture SoundsTextHi *sdl.Texture AccelerometerText *sdl.Texture AccelerometerTextHi *sdl.Texture HapticText *sdl.Texture HapticTextHi *sdl.Texture ShowFpsText *sdl.Texture ShowFpsTextHi *sdl.Texture YesText *sdl.Texture NoText *sdl.Texture FpsText *sdl.Texture TimeText *sdl.Texture ShieldsText *sdl.Texture AttackText *sdl.Texture InvincibleText *sdl.Texture EngineBlastText *sdl.Texture SlowdownText *sdl.Texture LifePowText *sdl.Texture ShieldsPowText *sdl.Texture AttackPowText *sdl.Texture InvinciblePowText *sdl.Texture EngineBlastPowText *sdl.Texture SlowdownPowText *sdl.Texture PausedText *sdl.Texture GameOverText *sdl.Texture Rocks []*sdl.Texture RocksSurf []*sdl.Surface Glyphs []string GlyphMapSmall map[string]*Glyph GlyphMapSmallRed map[string]*Glyph GlyphMapMedium map[string]*Glyph GlyphMapLarge map[string]*Glyph }
Resource structure
func (*Resource) LoadSurface ¶
Loads surface
func (*Resource) LoadTexture ¶
Loads texture
func (*Resource) PlaySoundTimed ¶
Plays sound timed
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
State machine
Click to show internal directories.
Click to hide internal directories.