Esempio n. 1
0
// Init initializes this gamestate
func (is *IntroState) Init() {
	// Create colors
	is.bgColor = sdl.MapRGB(gamecontext.GContext.PixelFormat, 60, 160, 60)
	is.fontNormalColor = sdl.Color{R: 255, G: 255, B: 255, A: 255}
	is.fontHighlightColor = sdl.Color{R: 255, G: 255, B: 0, A: 255}

	is.assetManager = assetmanager.New()

	err := is.assetManager.LoadJSON("introassets.json")
	if err != nil {
		panic(fmt.Sprintf("introassets.json: %v", err))
	}

	is.buildScene()
}
Esempio n. 2
0
// Init initializes this gamestate
func (ps *PlayState) Init() {
	ps.initChix()
	ps.initEggs()

	// Create colors
	ps.bgColor = sdl.MapRGB(gamecontext.GContext.PixelFormat, 133, 187, 234)
	ps.fontNormalColor = sdl.Color{R: 255, G: 255, B: 255, A: 255}
	ps.fontHighlightColor = sdl.Color{R: 255, G: 255, B: 0, A: 255}

	ps.assetManager = assetmanager.New()
	ps.assetManager.SetOuterSurface(gamecontext.GContext.MainSurface)

	err := ps.assetManager.LoadJSON("playassets.json")
	if err != nil {
		panic(fmt.Sprintf("playassets.json: %v", err))
	}
	ps.buildScene()
}