general

package
v0.0.0-...-d471c43 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package general will store all the common functionality that all scenes can use.

Index

Constants

View Source
const (
	// Background is the background image of the stage.
	// In a top down perspective this would be the floor.
	Background float32 = iota - 1
	// Scene contains all scene objects for decoration.
	// This would include a collidable barrel for instance.
	// Or the walls of the scene.
	Scene
	// Enemies stores the enemy characters in the scene
	// that the player can interact with directly.
	Enemies
	// Player contains the playable character itself.
	// This is a high priority render.
	Player
	// Particles holds all the special effect particles.
	// This could include explosions and bullets.
	Particles
	// MenuBackground is for the background of a menu. This could be
	// a flat image for the main menu or a blurry dark half opacity for options.
	MenuBackground
	// MenuGraphics is for the buttons and misc. graphics to go over the menu.
	MenuGraphics
)
View Source
const (
	BtnLeft  = "left"
	BtnRight = "right"
	BtnUp    = "up"
	BtnDown  = "down"
)
View Source
const DrawScale float32 = 4.0

DrawScale is the default multiplier when drawing tiles and objects in the game.

Solid is used for any solid colliders that should have a collision box with the player.

Variables

This section is empty.

Functions

func Apply

func Apply()

Apply initializes controls for the game based on the configuration file.

func ChangeConfig

func ChangeConfig(v *viper.Viper, key string, value interface{})

ChangeConfig takes your viper to the configuration file along with a key you want to change and its new value then will be saved to your config file.

Types

type Basic

type Basic struct {
	// EntityScale controls the size at which
	// the object's entity is rendered at. (multiplier)
	EntityScale float32
	// Spritesheet contains all the drawables used by
	// the engo RenderComponent.
	Spritesheet *common.Spritesheet
	// Ase is used to keep track of what frame
	// is being played animation by animation using jsons.
	Ase *goaseprite.File
}

Basic contains essential pieces to render an object in the game.

type Configuration

type Configuration struct {
	Window   window   `mapstructure:"window"`
	Settings settings `mapstructure:"settings"`
	Controls controls `mapstructure:"controls"`
}

Configuration is the global object used to hold game settings

func LoadViperConfig

func LoadViperConfig() *Configuration

LoadViperConfig loads a configuration file and returns a new copy of the data via a Configuration struct and viper object.

Jump to

Keyboard shortcuts

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