Created
September 22, 2012 02:25
-
-
Save sevvie/3764917 to your computer and use it in GitHub Desktop.
Useless example in Go, for the $GB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import( "fmt"; "time" ) | |
// type Board | |
// The game board | |
type Board struct { | |
tiles [][]int | |
} | |
type Tile struct { | |
id int | |
terrain int | |
} | |
// type Gear | |
// Gears are the abstract 'parts' of an Engine, that may or may not | |
// require updating each tick. | |
type Gear struct { | |
} | |
// type Engine | |
// The engine runs the system. Simple enough. | |
type Engine struct { | |
isRunning bool | |
gears []Gear | |
} | |
func (e Engine) Run() { | |
e.Startup() | |
for e.isRunning { | |
// Update everything and redraw. | |
} | |
e.Teardown() | |
} | |
func (e Engine) EnableRunning() { | |
e.isRunning = true | |
} | |
func (e Engine) DisableRunning() { | |
e.isRunning = false | |
} | |
func (e Engine) ToggleRunning() { | |
e.isRunning = !e.isRunning | |
} | |
func (e Engine) Startup() { | |
} | |
func (e Engine) Teardown() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment