blooblib/test/test.cpp

45 lines
943 B
C++
Raw Normal View History

2024-03-26 16:57:23 +01:00
#include <iostream>
#include "bloob.h"
struct my_game : game {
my_game();
void init(settings& settings);
void update();
void render(image& target);
image img;
tileset tileset;
font font;
double time;
};
my_game::my_game() :
img("test.png"),
tileset("font.png", vec2i(8, 14)),
font("habbo.png", true),
time(0.0) {
}
void my_game::init(settings& settings) {
settings.target_fps = 60;
}
void my_game::update() {
time += 1.0 / 60.0;
}
void my_game::render(image& target) {
target.clear(0xffdddd);
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)));
//target.draw(img, vec2i(320, 180) + pos);
//target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff);
target.draw("hello world!", vec2i(320, 180) + pos, font, 0xffffff, 0);
}
int main(int argc, char* argv[]) {
my_game game;
game.run();
return 0;
}