//  _   _ '  _     _
// (-/)(///)(- .  ( 
//    _/            

// i guess i am just re-writing shit now

/* includes */
#include "include/globl.h"

/* vars */
pthread_t thread;

int e_resolution[2] = { 1080, 720 };
bool run = true;

int e_fpstarget = 120;
int e_tickrate = 48;

SDL_Window * window;
SDL_Renderer * renderer;
SDL_Event event;

typedef struct {
	int position[3];
	int direction[2];
} e_placement;

typedef struct {
	bool moving;
	struct {
		int global[3];
		int realitive[3];
	} speed;
	e_placement placement;
} e_entity;

/* functions */
int e_init (void) {
	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		SDL_LogError(
				SDL_LOG_CATEGORY_APPLICATION,
				"could not initialize sdl: %s",
				SDL_GetError()
			    );
		return 1;
	}

	if (SDL_CreateWindowAndRenderer(
				e_resolution[0],
				e_resolution[1],
				0, //flags
				&window, &renderer
				)) {
		SDL_LogError(
				SDL_LOG_CATEGORY_APPLICATION,
				"could not create window and renderer: %s",
				SDL_GetError()
			    );
		return 1;
	}
	return 0;
} //init

void e_cleanup(void) {
	SDL_DestroyRenderer(renderer);
	SDL_DestroyWindow(window);
	SDL_Quit();
}
