#include <SDL/SDL.h>

#include "project_controls.h"
#include "project_timer.h"
#include "project_script.h"
#include "project_screen.h"

bool quit = false;
bool show_fps = true;
bool limit_speed = false;

// =============
// ==== Run ====
// =============

void Render()
{
	if (limit_speed) SpeedDown(20);

	if (SDL_MUSTLOCK(screen))
		if (SDL_LockSurface(screen) < 0)
			return;

		Script();

	if (SDL_MUSTLOCK(screen))
		SDL_UnlockSurface(screen);

	SDL_Flip(screen);

	if (show_fps) CountFPS();

	nframe++;
}

void Run()
{
	do{
        Controls();
		Render();
	}while(quit==false);
}
