#include "raylib.h"
#include "image_loading.h"
#include "sound_loading.h"
#include "players.h"
#include "cars.h"
#include "menu.h"
#include "renderer.h"

int state = 0;
float delta = 0;
double ticks = 0;
int gore = 1;
int engine_running = 1;

int main(void)
{
	InitWindow(1280,720, "Chicken Go Splat");
    SetWindowState(FLAG_WINDOW_RESIZABLE);
	SetTargetFPS(60);
	SetExitKey(KEY_NULL);

	load_images();
	load_sounds();
	setup_players();
	setup_cars();

	while(!WindowShouldClose() && engine_running)
	{

		delta = GetFrameTime();
		ticks = GetTime() * 1000;

        BeginTextureMode(renderTexture);
	        ClearBackground(BLACK);
	        DrawTexture(background_texture,0,0,WHITE);
			if (state == 0) 
			{
				process_menu();
			}
			else
			{
				process_players();
				process_cars();
			}
		EndTextureMode();
		render_to_screen();
	}
	unload_images();
	unload_sounds();
	CloseWindow();
}
