bloobtracker mockup

This commit is contained in:
Squishy Bloob 2024-03-31 10:38:32 +00:00
parent 4f584174a6
commit 82187b9005
5 changed files with 33 additions and 10 deletions

View File

@ -18,3 +18,10 @@ private:
std::map<char, image> _glyphs; std::map<char, image> _glyphs;
int _lineheight; int _lineheight;
}; };
__forceinline image const* font::get(char ch) const {
if(_glyphs.contains(ch))
return &_glyphs.at(ch);
else
return &_glyphs.at(' ');
}

View File

@ -38,13 +38,6 @@ font::font(resource_manager& rm, ini_category const* ini, std::string const& pat
} }
} }
image const* font::get(char ch) const {
if(_glyphs.contains(ch))
return &_glyphs.at(ch);
else
return &_glyphs.at(' ');
}
int font::lineheight() const { int font::lineheight() const {
return _lineheight; return _lineheight;
} }

View File

@ -53,6 +53,7 @@ void game::run() {
ShowWindow(window, SW_SHOWNORMAL); ShowWindow(window, SW_SHOWNORMAL);
ShowCursor(FALSE); ShowCursor(FALSE);
if(settings.show_logo)
play_logo(window, get<image>("_/logo.png"), get<image>("_/logo-slime.png")); play_logo(window, get<image>("_/logo.png"), get<image>("_/logo-slime.png"));
auto window_image = image(settings.size * settings.scale); auto window_image = image(settings.size * settings.scale);

BIN
test/assets/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -8,6 +8,7 @@ struct my_game : game {
image const* img; image const* img;
image const* slime; image const* slime;
image const* bg;
ini const* ini; ini const* ini;
@ -22,12 +23,14 @@ void my_game::init(settings& settings) {
time = 0.0; time = 0.0;
settings.scale = 1; settings.scale = 1;
settings.size = vec2i(1920, 1080); settings.size = vec2i(1920, 1080);
settings.show_logo = false;
//img = get<image>("test.png"); //img = get<image>("test.png");
//slime = get<image>("slime.png"); //slime = get<image>("slime.png");
//slime = slime->upscale_2x(); //slime = slime->upscale_2x();
//slime = slime->upscale_2x(); //slime = slime->upscale_2x();
//slime = slime->upscale_2x(); //slime = slime->upscale_2x();
//ini = get<::ini>("test.ini"); //ini = get<::ini>("test.ini");
bg = get<image>("bg.png");
font1 = get<::font>("_/default-font-prop.png"); font1 = get<::font>("_/default-font-prop.png");
font2 = get<::font>("font.png"); font2 = get<::font>("font.png");
//cursor(&font['\\']); //cursor(&font['\\']);
@ -49,10 +52,29 @@ void my_game::render(image& target) {
//target.draw(tileset[0xda], vec2i(320, 180) + pos, 0xff00ff); //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."; 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(str, vec2i(100, 100) + pos, font, 0xffffff, 0);
target.draw(bg, vec2i::zero);
target.draw(std::format("FPS: {}", fps()), vec2i(10, 10), font1, 0xffffff, 0); target.draw(std::format("FPS: {}", fps()), vec2i(10, 10), font1, 0xffffff, 0);
for(int i = 0; i < 64; ++i) int xoff = 40;
target.draw("C-4", vec2i(100, i * 14), font2, 0xffffff, 0); 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);
//target.draw("\\", mouse_pos(), font, 0xffffff, 0); //target.draw("\\", mouse_pos(), font, 0xffffff, 0);
} }