#ifndef WINDOW_H
#define WINDOW_H

#include <SDL2/SDL.h>

struct window {
	SDL_Window *ptr;
	int32_t h;
	int32_t w;
	int32_t hw;
	int32_t hh;
};

#define WINDOW_UP_SIZE(win) \
	do {							\
		SDL_GetWindowSize(win.ptr, &win.w, &win.h);	\
		win.hw = win.w / 2;				\
		win.hh = win.h / 2;				\
	} while(0)

struct window window_create(const char *win_title);


#if defined(WINDOW_IMP) || defined(IMP)

#include "sc.h"

struct window
window_create(const char *win_title)
{
	struct window win = {
		.ptr = SDL_CreateWindow(
			win_title,
			SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
			600, 800,
			SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL),
	};
	SCP(win.ptr);

	WINDOW_UP_SIZE(win);

	return win;
}

#endif /* defined(WINDOW_IMP) || defined(IMP) */


#endif
