diff --git a/blooblib/include/font.h b/blooblib/include/font.h index 7de3a62..b193a66 100644 --- a/blooblib/include/font.h +++ b/blooblib/include/font.h @@ -18,3 +18,10 @@ private: std::map _glyphs; int _lineheight; }; + +__forceinline image const* font::get(char ch) const { + if(_glyphs.contains(ch)) + return &_glyphs.at(ch); + else + return &_glyphs.at(' '); +} \ No newline at end of file diff --git a/blooblib/src/font.cpp b/blooblib/src/font.cpp index 1031a13..e5ae2bf 100644 --- a/blooblib/src/font.cpp +++ b/blooblib/src/font.cpp @@ -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 { return _lineheight; } diff --git a/blooblib/src/game.cpp b/blooblib/src/game.cpp index 7e5ed14..40a0a93 100644 --- a/blooblib/src/game.cpp +++ b/blooblib/src/game.cpp @@ -53,7 +53,8 @@ void game::run() { ShowWindow(window, SW_SHOWNORMAL); ShowCursor(FALSE); - play_logo(window, get("_/logo.png"), get("_/logo-slime.png")); + if(settings.show_logo) + play_logo(window, get("_/logo.png"), get("_/logo-slime.png")); auto window_image = image(settings.size * settings.scale); auto screen = image(settings.size); diff --git a/test/assets/bg.png b/test/assets/bg.png new file mode 100644 index 0000000..c0dd86f Binary files /dev/null and b/test/assets/bg.png differ diff --git a/test/test.cpp b/test/test.cpp index 3dbecea..53aeab9 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -8,6 +8,7 @@ struct my_game : game { image const* img; image const* slime; + image const* bg; ini const* ini; @@ -22,12 +23,14 @@ void my_game::init(settings& settings) { time = 0.0; settings.scale = 1; settings.size = vec2i(1920, 1080); + settings.show_logo = false; //img = get("test.png"); //slime = get("slime.png"); //slime = slime->upscale_2x(); //slime = slime->upscale_2x(); //slime = slime->upscale_2x(); //ini = get<::ini>("test.ini"); + bg = get("bg.png"); font1 = get<::font>("_/default-font-prop.png"); font2 = get<::font>("font.png"); //cursor(&font['\\']); @@ -49,10 +52,29 @@ void my_game::render(image& target) { //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(bg, vec2i::zero); 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); + 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); //target.draw("\\", mouse_pos(), font, 0xffffff, 0); }