First pass at documentations.
This commit is contained in:
@@ -11,6 +11,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Config embodies the configuration for a game. These are populated in various
|
||||
// ways (json POSTed to server, config file, constants) and are typically owned
|
||||
// by a Controller.
|
||||
type Config struct {
|
||||
Tick int `json:"tick"` // ms
|
||||
Timescale float32 `json:"timescale"`
|
||||
@@ -23,8 +26,8 @@ type Config struct {
|
||||
}
|
||||
|
||||
const (
|
||||
TICK = 60
|
||||
TIMESCALE = 1.0
|
||||
TICK = 60 // ms, this is how often physics is updated
|
||||
TIMESCALE = 1.0 // this tweaks the temporal duration of a TICK
|
||||
WIDTH = 800
|
||||
HEIGHT = 550
|
||||
OBSTACLES = 5
|
||||
@@ -32,6 +35,10 @@ const (
|
||||
DEFAULT_MODE = "deathmatch"
|
||||
)
|
||||
|
||||
// LoadConfig takes the location of a json file that contains values desired to
|
||||
// be used in the creation of games. Priority is given to values specified at
|
||||
// game cration time using control channel, followed by values in config file,
|
||||
// followed by constants defined above.
|
||||
func LoadConfig(filename string) (Config, error) {
|
||||
c := Config{
|
||||
Tick: TICK,
|
||||
|
||||
Reference in New Issue
Block a user