#include <iostream>
#include "bloob.h"

struct my_game : game {
	void init(settings& settings);
	void update();
	void render(image& target);

	image const* img;
	image const* slime;
	ini const* ini;


	//tileset tileset;
	font const* font1;
	font const* font2;
	double time;
};

void my_game::init(settings& settings) {
	settings.target_fps = 6000;
	time = 0.0;
	settings.scale = 1;
	settings.size = vec2i(1920, 1080);
	//img = get<image>("test.png");
	//slime = get<image>("slime.png");
	//slime = slime->upscale_2x();
	//slime = slime->upscale_2x();
	//slime = slime->upscale_2x();
	//ini = get<::ini>("test.ini");
	font1 = get<::font>("_/default-font-prop.png");
	font2 = get<::font>("font.png");
	//cursor(&font['\\']);
}

void my_game::update() {
	time = std::fmod(time + 1.0 / 60.0, 1.0);
}

void my_game::render(image& target) {
	target.clear(0x123456);
	auto pos = vec2i(std::sin(time * TAU / 4) * 100, std::cos(time * TAU / 4) * 100);
	//target.draw(img, vec2i(320, 180) + pos, recti(vec2i(8, 14), vec2i(8 * 4, 14 * 4)));
	//for(int i = 0; i < 1; ++i)
	//	target.draw(img, vec2i::zero);

	//target.draw_rot(slime, vec2i(200, 200), time);
	//target.draw(slime, vec2i(40, 40));
	//target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff);
	auto str = "Can only be played if\nthere are no card in\nyour draw pile.\nDeal 50 damage to ALL\nenemies.";
	//target.draw(str, vec2i(100, 100) + pos, font, 0xffffff, 0);
	target.draw(std::format("FPS: {}", fps()), vec2i(10, 10), font1, 0xffffff, 0);

	for(int i = 0; i < 64; ++i)
		target.draw("C-4", vec2i(100, i * 14), font2, 0xffffff, 0);
	//target.draw("\\", mouse_pos(), font, 0xffffff, 0);
}

int main(int argc, char* argv[]) {
	my_game game;
	game.run();
	return 0;
}
