2024-03-26 16:57:23 +01:00
|
|
|
#include <iostream>
|
|
|
|
#include "bloob.h"
|
|
|
|
|
|
|
|
struct my_game : game {
|
2024-04-01 02:09:01 +02:00
|
|
|
my_game(int argc, char** argv) : game(argc, argv) {}
|
2024-03-26 16:57:23 +01:00
|
|
|
void init(settings& settings);
|
|
|
|
void update();
|
|
|
|
void render(image& target);
|
|
|
|
|
2024-03-28 07:50:49 +01:00
|
|
|
image const* img;
|
2024-03-30 20:08:38 +01:00
|
|
|
image const* slime;
|
2024-03-31 12:38:32 +02:00
|
|
|
image const* bg;
|
2024-03-28 07:50:49 +01:00
|
|
|
ini const* ini;
|
|
|
|
|
2024-03-28 09:39:33 +01:00
|
|
|
|
2024-03-28 07:50:49 +01:00
|
|
|
//tileset tileset;
|
2024-03-31 03:56:47 +02:00
|
|
|
font const* font1;
|
|
|
|
font const* font2;
|
2024-03-26 16:57:23 +01:00
|
|
|
double time;
|
|
|
|
};
|
|
|
|
|
|
|
|
void my_game::init(settings& settings) {
|
2024-03-30 20:08:38 +01:00
|
|
|
settings.target_fps = 6000;
|
|
|
|
time = 0.0;
|
2024-03-31 03:56:47 +02:00
|
|
|
settings.scale = 1;
|
|
|
|
settings.size = vec2i(1920, 1080);
|
2024-03-31 12:38:32 +02:00
|
|
|
settings.show_logo = false;
|
2024-03-31 01:03:04 +01:00
|
|
|
//img = get<image>("test.png");
|
|
|
|
//slime = get<image>("slime.png");
|
2024-03-30 20:08:38 +01:00
|
|
|
//slime = slime->upscale_2x();
|
|
|
|
//slime = slime->upscale_2x();
|
|
|
|
//slime = slime->upscale_2x();
|
2024-03-28 09:39:33 +01:00
|
|
|
//ini = get<::ini>("test.ini");
|
2024-03-31 12:38:32 +02:00
|
|
|
bg = get<image>("bg.png");
|
2024-03-31 03:56:47 +02:00
|
|
|
font1 = get<::font>("_/default-font-prop.png");
|
|
|
|
font2 = get<::font>("font.png");
|
2024-03-28 07:50:49 +01:00
|
|
|
//cursor(&font['\\']);
|
2024-03-26 16:57:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void my_game::update() {
|
2024-03-30 20:08:38 +01:00
|
|
|
time = std::fmod(time + 1.0 / 60.0, 1.0);
|
2024-03-26 16:57:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void my_game::render(image& target) {
|
2024-03-31 01:03:04 +01:00
|
|
|
target.clear(0x123456);
|
2024-03-26 16:57:23 +01:00
|
|
|
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)));
|
2024-03-30 20:08:38 +01:00
|
|
|
//for(int i = 0; i < 1; ++i)
|
|
|
|
// target.draw(img, vec2i::zero);
|
|
|
|
|
|
|
|
//target.draw_rot(slime, vec2i(200, 200), time);
|
2024-03-31 01:03:04 +01:00
|
|
|
//target.draw(slime, vec2i(40, 40));
|
2024-03-26 16:57:23 +01:00
|
|
|
//target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff);
|
2024-03-28 09:39:33 +01:00
|
|
|
auto str = "Can only be played if\nthere are no card in\nyour draw pile.\nDeal 50 damage to ALL\nenemies.";
|
2024-03-30 20:08:38 +01:00
|
|
|
//target.draw(str, vec2i(100, 100) + pos, font, 0xffffff, 0);
|
2024-03-31 12:38:32 +02:00
|
|
|
target.draw(bg, vec2i::zero);
|
2024-03-31 03:56:47 +02:00
|
|
|
target.draw(std::format("FPS: {}", fps()), vec2i(10, 10), font1, 0xffffff, 0);
|
|
|
|
|
2024-03-31 12:38:32 +02:00
|
|
|
int xoff = 40;
|
|
|
|
int yoff = 167;
|
|
|
|
int choff = 22 * 8 + 13;
|
|
|
|
for(int i = 0; i < 64; ++i) {
|
|
|
|
auto col_colour = 0x324456;
|
|
|
|
if(i % 4 == 0) col_colour = 0x3a5167;
|
|
|
|
if(i % 16 == 0) col_colour = 0x355777;
|
|
|
|
target.draw(std::format("{:02X}", i), vec2i(-16-5 + xoff, i * 14 + yoff), font2, col_colour);
|
|
|
|
for(int chan = 0; chan < 8; ++chan) {
|
|
|
|
target.draw(i % 4 ? "..." : "C-4", vec2i(chan * choff + 0 + xoff, i * 14 + yoff), font2, 0xcccccc);
|
|
|
|
target.draw("..", vec2i(chan * choff + 24 + xoff, i * 14 + yoff), font2, 0x8888cc);
|
|
|
|
target.draw("..", vec2i(chan * choff + 40 + xoff, i * 14 + yoff), font2, 0x88cc88);
|
|
|
|
target.draw("....", vec2i(chan * choff + 56 + xoff, i * 14 + yoff), font2, 0xccaa88);
|
|
|
|
target.draw("....", vec2i(chan * choff + 88 + xoff, i * 14 + yoff), font2, 0xcc88aa);
|
|
|
|
target.draw("....", vec2i(chan * choff + 120 + xoff, i * 14 + yoff), font2, 0xccaa88);
|
|
|
|
target.draw("....", vec2i(chan * choff + 152 + xoff, i * 14 + yoff), font2, 0xcc88aa);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for(int chan = 0; chan < 8; ++chan)
|
|
|
|
target.draw("Channel", vec2i(xoff + chan * choff, yoff - 15), font2, 0x355777);
|
2024-03-26 18:32:52 +01:00
|
|
|
//target.draw("\\", mouse_pos(), font, 0xffffff, 0);
|
2024-03-26 16:57:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
2024-04-01 02:09:01 +02:00
|
|
|
my_game game(argc, argv);
|
2024-03-26 16:57:23 +01:00
|
|
|
game.run();
|
|
|
|
return 0;
|
|
|
|
}
|