#pragma once

#include "renderer.h"
#include "collision.h"
#include "generic_frame.h"

class GamePlanet;

class GameFrame : public GenericFrame {
public:
	GameFrame();

	void Init();
	void DeInit();
	bool DoUpdate(float time);
	void DoRender();

	void spawn(spSprite sprite);

	void increaseLives();

	shared_ptr<GamePlanet> planet;

private:

	void showMessage(String msg, float t=5.0f);

	void spawnPending(float t);
	void doSpawn(spSprite sprite);

	void stepAllObjects(float t);
	void stepObjects(float t, SpriteList& objs);

	void nextPlanet();

	std::map<int, SpriteList> sprites;
	SpriteList toSpawn;

	Renderer renderer;
	Collision::Checker collision;

	float elapsedTime;

	// Flags
	bool frozen;
	bool debug;
	bool running;
	int planetN;

	bool firstCollected;
	float messageTime;
	String message;
};
