From 82187b9005e70d29c573ca15260237e66f5c4e8f Mon Sep 17 00:00:00 2001 From: squishy Date: Sun, 31 Mar 2024 10:38:32 +0000 Subject: [PATCH] bloobtracker mockup --- blooblib/include/font.h | 7 +++++++ blooblib/src/font.cpp | 7 ------- blooblib/src/game.cpp | 3 ++- test/assets/bg.png | Bin 0 -> 12245 bytes test/test.cpp | 26 ++++++++++++++++++++++++-- 5 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 test/assets/bg.png 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 0000000000000000000000000000000000000000..c0dd86fdd4bde51b93410f114f91219dcf56388d GIT binary patch literal 12245 zcmeHN3s4hB7~UgbP*kvJu@s55txnsNSm{U@5tKryqoegP1tv0_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UyeX$&67zK?NN3fU|UmiElUD zI)Z9vighCxU7@FUwfv&x=uW(2y5TIqzrC4Waf|52-?{(77T9^nY=EX7Ab`X#Ees6? zOYkA7P)j&(HatsQ5jMlaGgI4s-VrwXf+ID7-~JI7tY|SyhAD3m!N@WTLxVy4lYEC! z?cZ*e3LDvMVXtjHLt`+UNziEwW8}Fd&j4T@(pQxDLYvL+4Xt@#W8E7B@>)W=zm!=#+I2}Ppce5#fS{4qBGk?HrAHm&a`hns)_UZSefUbjds$1mggN^;niIGHSo5&dNHVu5MCh z{}>%+4AoKX2B(dW4eH|`9q^`%ch=EUwcSnUIL--a`WTdvG=yT{3+2``5YV^M&nkY_ z+Fj-t&b9+^v740)t13|PQZ{O56X<}9klMuXP Z{ed3$EfGh(dUS?{4S|~jiv1af{{n>?2I~L- literal 0 HcmV?d00001 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); }