From bf88e17d552d85cd18bc31757ef9d73049b327c4 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Sat, 1 Feb 2025 14:21:04 +0100 Subject: implement text rendering --- lib/nes/app/graphics/CMakeLists.txt | 4 +- lib/nes/app/graphics/image-view.hh | 2 +- lib/nes/app/graphics/mask-tile.hh | 15 ---- lib/nes/app/graphics/renderer.cc | 80 ++++++++++++++++++++- lib/nes/app/graphics/renderer.hh | 1 + lib/nes/app/graphics/tiles/CMakeLists.txt | 79 ++++++++++++++++++++ lib/nes/app/graphics/tiles/banner.png | Bin 0 -> 1196 bytes lib/nes/app/graphics/tiles/digit_0.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/digit_1.png | Bin 0 -> 151 bytes lib/nes/app/graphics/tiles/digit_2.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/digit_3.png | Bin 0 -> 152 bytes lib/nes/app/graphics/tiles/digit_4.png | Bin 0 -> 156 bytes lib/nes/app/graphics/tiles/digit_5.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/digit_6.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/digit_7.png | Bin 0 -> 149 bytes lib/nes/app/graphics/tiles/digit_8.png | Bin 0 -> 159 bytes lib/nes/app/graphics/tiles/digit_9.png | Bin 0 -> 156 bytes lib/nes/app/graphics/tiles/icon_cartridge.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/icon_directory.png | Bin 0 -> 149 bytes lib/nes/app/graphics/tiles/letter_a.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/letter_b.png | Bin 0 -> 147 bytes lib/nes/app/graphics/tiles/letter_c.png | Bin 0 -> 155 bytes lib/nes/app/graphics/tiles/letter_d.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/letter_e.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/letter_f.png | Bin 0 -> 152 bytes lib/nes/app/graphics/tiles/letter_g.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/letter_h.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/letter_i.png | Bin 0 -> 150 bytes lib/nes/app/graphics/tiles/letter_j.png | Bin 0 -> 148 bytes lib/nes/app/graphics/tiles/letter_k.png | Bin 0 -> 160 bytes lib/nes/app/graphics/tiles/letter_l.png | Bin 0 -> 145 bytes lib/nes/app/graphics/tiles/letter_m.png | Bin 0 -> 156 bytes lib/nes/app/graphics/tiles/letter_n.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/letter_o.png | Bin 0 -> 151 bytes lib/nes/app/graphics/tiles/letter_p.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/letter_q.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/letter_r.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/letter_s.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/letter_t.png | Bin 0 -> 144 bytes lib/nes/app/graphics/tiles/letter_u.png | Bin 0 -> 146 bytes lib/nes/app/graphics/tiles/letter_v.png | Bin 0 -> 155 bytes lib/nes/app/graphics/tiles/letter_w.png | Bin 0 -> 154 bytes lib/nes/app/graphics/tiles/letter_x.png | Bin 0 -> 157 bytes lib/nes/app/graphics/tiles/letter_y.png | Bin 0 -> 151 bytes lib/nes/app/graphics/tiles/letter_z.png | Bin 0 -> 152 bytes lib/nes/app/graphics/tiles/symbol_ampersand.png | Bin 0 -> 158 bytes lib/nes/app/graphics/tiles/symbol_apostrophe.png | Bin 0 -> 140 bytes .../app/graphics/tiles/symbol_bracket_close.png | Bin 0 -> 150 bytes lib/nes/app/graphics/tiles/symbol_bracket_open.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/symbol_colon.png | Bin 0 -> 143 bytes lib/nes/app/graphics/tiles/symbol_comma.png | Bin 0 -> 142 bytes lib/nes/app/graphics/tiles/symbol_dollar.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/symbol_equal.png | Bin 0 -> 139 bytes .../app/graphics/tiles/symbol_exclamation_mark.png | Bin 0 -> 149 bytes lib/nes/app/graphics/tiles/symbol_greater.png | Bin 0 -> 138 bytes lib/nes/app/graphics/tiles/symbol_hashtag.png | Bin 0 -> 153 bytes lib/nes/app/graphics/tiles/symbol_less.png | Bin 0 -> 140 bytes lib/nes/app/graphics/tiles/symbol_minus.png | Bin 0 -> 137 bytes lib/nes/app/graphics/tiles/symbol_paren_close.png | Bin 0 -> 145 bytes lib/nes/app/graphics/tiles/symbol_paren_open.png | Bin 0 -> 147 bytes lib/nes/app/graphics/tiles/symbol_percent.png | Bin 0 -> 155 bytes lib/nes/app/graphics/tiles/symbol_period.png | Bin 0 -> 137 bytes lib/nes/app/graphics/tiles/symbol_plus.png | Bin 0 -> 146 bytes .../app/graphics/tiles/symbol_question_mark.png | Bin 0 -> 155 bytes .../app/graphics/tiles/symbol_quotation_mark.png | Bin 0 -> 141 bytes lib/nes/app/graphics/tiles/symbol_semicolon.png | Bin 0 -> 145 bytes lib/nes/app/graphics/tiles/symbol_slash.png | Bin 0 -> 134 bytes lib/nes/app/graphics/tiles/symbol_star.png | Bin 0 -> 152 bytes lib/nes/app/graphics/tiles/symbol_unknown.png | Bin 0 -> 151 bytes lib/nes/app/ui/screen-title.cc | 9 ++- 70 files changed, 169 insertions(+), 21 deletions(-) create mode 100644 lib/nes/app/graphics/tiles/CMakeLists.txt create mode 100644 lib/nes/app/graphics/tiles/banner.png create mode 100644 lib/nes/app/graphics/tiles/digit_0.png create mode 100644 lib/nes/app/graphics/tiles/digit_1.png create mode 100644 lib/nes/app/graphics/tiles/digit_2.png create mode 100644 lib/nes/app/graphics/tiles/digit_3.png create mode 100644 lib/nes/app/graphics/tiles/digit_4.png create mode 100644 lib/nes/app/graphics/tiles/digit_5.png create mode 100644 lib/nes/app/graphics/tiles/digit_6.png create mode 100644 lib/nes/app/graphics/tiles/digit_7.png create mode 100644 lib/nes/app/graphics/tiles/digit_8.png create mode 100644 lib/nes/app/graphics/tiles/digit_9.png create mode 100644 lib/nes/app/graphics/tiles/icon_cartridge.png create mode 100644 lib/nes/app/graphics/tiles/icon_directory.png create mode 100644 lib/nes/app/graphics/tiles/letter_a.png create mode 100644 lib/nes/app/graphics/tiles/letter_b.png create mode 100644 lib/nes/app/graphics/tiles/letter_c.png create mode 100644 lib/nes/app/graphics/tiles/letter_d.png create mode 100644 lib/nes/app/graphics/tiles/letter_e.png create mode 100644 lib/nes/app/graphics/tiles/letter_f.png create mode 100644 lib/nes/app/graphics/tiles/letter_g.png create mode 100644 lib/nes/app/graphics/tiles/letter_h.png create mode 100644 lib/nes/app/graphics/tiles/letter_i.png create mode 100644 lib/nes/app/graphics/tiles/letter_j.png create mode 100644 lib/nes/app/graphics/tiles/letter_k.png create mode 100644 lib/nes/app/graphics/tiles/letter_l.png create mode 100644 lib/nes/app/graphics/tiles/letter_m.png create mode 100644 lib/nes/app/graphics/tiles/letter_n.png create mode 100644 lib/nes/app/graphics/tiles/letter_o.png create mode 100644 lib/nes/app/graphics/tiles/letter_p.png create mode 100644 lib/nes/app/graphics/tiles/letter_q.png create mode 100644 lib/nes/app/graphics/tiles/letter_r.png create mode 100644 lib/nes/app/graphics/tiles/letter_s.png create mode 100644 lib/nes/app/graphics/tiles/letter_t.png create mode 100644 lib/nes/app/graphics/tiles/letter_u.png create mode 100644 lib/nes/app/graphics/tiles/letter_v.png create mode 100644 lib/nes/app/graphics/tiles/letter_w.png create mode 100644 lib/nes/app/graphics/tiles/letter_x.png create mode 100644 lib/nes/app/graphics/tiles/letter_y.png create mode 100644 lib/nes/app/graphics/tiles/letter_z.png create mode 100644 lib/nes/app/graphics/tiles/symbol_ampersand.png create mode 100644 lib/nes/app/graphics/tiles/symbol_apostrophe.png create mode 100644 lib/nes/app/graphics/tiles/symbol_bracket_close.png create mode 100644 lib/nes/app/graphics/tiles/symbol_bracket_open.png create mode 100644 lib/nes/app/graphics/tiles/symbol_colon.png create mode 100644 lib/nes/app/graphics/tiles/symbol_comma.png create mode 100644 lib/nes/app/graphics/tiles/symbol_dollar.png create mode 100644 lib/nes/app/graphics/tiles/symbol_equal.png create mode 100644 lib/nes/app/graphics/tiles/symbol_exclamation_mark.png create mode 100644 lib/nes/app/graphics/tiles/symbol_greater.png create mode 100644 lib/nes/app/graphics/tiles/symbol_hashtag.png create mode 100644 lib/nes/app/graphics/tiles/symbol_less.png create mode 100644 lib/nes/app/graphics/tiles/symbol_minus.png create mode 100644 lib/nes/app/graphics/tiles/symbol_paren_close.png create mode 100644 lib/nes/app/graphics/tiles/symbol_paren_open.png create mode 100644 lib/nes/app/graphics/tiles/symbol_percent.png create mode 100644 lib/nes/app/graphics/tiles/symbol_period.png create mode 100644 lib/nes/app/graphics/tiles/symbol_plus.png create mode 100644 lib/nes/app/graphics/tiles/symbol_question_mark.png create mode 100644 lib/nes/app/graphics/tiles/symbol_quotation_mark.png create mode 100644 lib/nes/app/graphics/tiles/symbol_semicolon.png create mode 100644 lib/nes/app/graphics/tiles/symbol_slash.png create mode 100644 lib/nes/app/graphics/tiles/symbol_star.png create mode 100644 lib/nes/app/graphics/tiles/symbol_unknown.png (limited to 'lib/nes') diff --git a/lib/nes/app/graphics/CMakeLists.txt b/lib/nes/app/graphics/CMakeLists.txt index 81bd0ff..0f869b7 100644 --- a/lib/nes/app/graphics/CMakeLists.txt +++ b/lib/nes/app/graphics/CMakeLists.txt @@ -6,4 +6,6 @@ target_sources( mask-tile.hh image-tile.hh renderer.hh - renderer.cc) \ No newline at end of file + renderer.cc) + +add_subdirectory(tiles) \ No newline at end of file diff --git a/lib/nes/app/graphics/image-view.hh b/lib/nes/app/graphics/image-view.hh index cde4989..10754d1 100644 --- a/lib/nes/app/graphics/image-view.hh +++ b/lib/nes/app/graphics/image-view.hh @@ -28,6 +28,6 @@ namespace nes::app auto get_data() const -> image_tile const* { return data_; } auto get_width() const -> u32 { return width_; } auto get_height() const -> u32 { return height_; } - auto get(u32 const x, u32 const y) const -> image_tile const& { return data_[y * height_ + x]; } + auto get(u32 const x, u32 const y) const -> image_tile const& { return data_[y * width_ + x]; } }; } // namespace nes::app \ No newline at end of file diff --git a/lib/nes/app/graphics/mask-tile.hh b/lib/nes/app/graphics/mask-tile.hh index deb750a..160a170 100644 --- a/lib/nes/app/graphics/mask-tile.hh +++ b/lib/nes/app/graphics/mask-tile.hh @@ -12,19 +12,4 @@ namespace nes::app { u8 data[8]{}; }; - - namespace tiles - { - inline constexpr auto letter_a = mask_tile - { - 0b00111000, - 0b01101100, - 0b11000110, - 0b11000110, - 0b11111110, - 0b11000110, - 0b11000110, - 0b00000000, - }; - } // namespace tiles } // namespace nes::app \ No newline at end of file diff --git a/lib/nes/app/graphics/renderer.cc b/lib/nes/app/graphics/renderer.cc index 1a4dc4d..6a45b6c 100644 --- a/lib/nes/app/graphics/renderer.cc +++ b/lib/nes/app/graphics/renderer.cc @@ -3,6 +3,7 @@ #include "nes/app/graphics/mask-tile.hh" #include "nes/app/graphics/image-tile.hh" #include "nes/app/graphics/image-view.hh" +#include "nes/app/graphics/tiles/characters.hh" #include "nes/common/display.hh" namespace nes::app @@ -55,11 +56,20 @@ namespace nes::app { for (auto x_img = u32{ 0 }; x_img < image.get_width(); ++x_img) { - render_image_tile(x + x_img, y + y_img, image.get(x, y)); + render_image_tile(x + x_img, y + y_img, image.get(x_img, y_img)); } } } + auto renderer::render_text(u32 const x, u32 const y, std::string_view const str, color const c) -> void + { + for (auto i = u32{ 0 }; i < str.size(); ++i) + { + auto const character = str[i]; + render_mask_tile(x + i, y, resolve_character(str[i]), c); + } + } + auto renderer::render_rect( u32 const x, u32 const y, u32 const width, u32 const height, color const c) -> void { @@ -101,4 +111,72 @@ namespace nes::app return rgb::from_hex(0x000000); } + + auto renderer::resolve_character(u32 const c) const -> mask_tile + { + switch (c) + { + case ' ': return mask_tile{}; + case 'a': case 'A': return tiles::letter_a; + case 'b': case 'B': return tiles::letter_b; + case 'c': case 'C': return tiles::letter_c; + case 'd': case 'D': return tiles::letter_d; + case 'e': case 'E': return tiles::letter_e; + case 'f': case 'F': return tiles::letter_f; + case 'g': case 'G': return tiles::letter_g; + case 'h': case 'H': return tiles::letter_h; + case 'i': case 'I': return tiles::letter_i; + case 'j': case 'J': return tiles::letter_j; + case 'k': case 'K': return tiles::letter_k; + case 'l': case 'L': return tiles::letter_l; + case 'm': case 'M': return tiles::letter_m; + case 'n': case 'N': return tiles::letter_n; + case 'o': case 'O': return tiles::letter_o; + case 'p': case 'P': return tiles::letter_p; + case 'q': case 'Q': return tiles::letter_q; + case 'r': case 'R': return tiles::letter_r; + case 's': case 'S': return tiles::letter_s; + case 't': case 'T': return tiles::letter_t; + case 'u': case 'U': return tiles::letter_u; + case 'v': case 'V': return tiles::letter_v; + case 'w': case 'W': return tiles::letter_w; + case 'x': case 'X': return tiles::letter_x; + case 'y': case 'Y': return tiles::letter_y; + case 'z': case 'Z': return tiles::letter_z; + case '0': return tiles::digit_0; + case '1': return tiles::digit_1; + case '2': return tiles::digit_2; + case '3': return tiles::digit_3; + case '4': return tiles::digit_4; + case '5': return tiles::digit_5; + case '6': return tiles::digit_6; + case '7': return tiles::digit_7; + case '8': return tiles::digit_8; + case '9': return tiles::digit_9; + case '&': return tiles::symbol_ampersand; + case '\'': return tiles::symbol_apostrophe; + case '[': return tiles::symbol_bracket_open; + case ']': return tiles::symbol_bracket_close; + case ':': return tiles::symbol_colon; + case ',': return tiles::symbol_comma; + case '$': return tiles::symbol_dollar; + case '=': return tiles::symbol_equal; + case '!': return tiles::symbol_exclamation_mark; + case '>': return tiles::symbol_greater; + case '#': return tiles::symbol_hashtag; + case '<': return tiles::symbol_less; + case '-': return tiles::symbol_minus; + case '(': return tiles::symbol_paren_open; + case ')': return tiles::symbol_paren_close; + case '%': return tiles::symbol_percent; + case '.': return tiles::symbol_period; + case '+': return tiles::symbol_plus; + case '?': return tiles::symbol_question_mark; + case '"': return tiles::symbol_quotation_mark; + case ';': return tiles::symbol_semicolon; + case '/': return tiles::symbol_slash; + case '*': return tiles::symbol_star; + default: return tiles::symbol_unknown; + } + } } // namespace nes::app \ No newline at end of file diff --git a/lib/nes/app/graphics/renderer.hh b/lib/nes/app/graphics/renderer.hh index 5de3dcd..08e4225 100644 --- a/lib/nes/app/graphics/renderer.hh +++ b/lib/nes/app/graphics/renderer.hh @@ -58,5 +58,6 @@ namespace nes::app private: auto resolve_color(color) const -> rgb; + auto resolve_character(u32) const -> mask_tile; }; } // namespace nes::app \ No newline at end of file diff --git a/lib/nes/app/graphics/tiles/CMakeLists.txt b/lib/nes/app/graphics/tiles/CMakeLists.txt new file mode 100644 index 0000000..144b9da --- /dev/null +++ b/lib/nes/app/graphics/tiles/CMakeLists.txt @@ -0,0 +1,79 @@ +nes_generate_tiles( + nes + characters + TYPE mask + FILES + letter_a.png + letter_b.png + letter_c.png + letter_d.png + letter_e.png + letter_f.png + letter_g.png + letter_h.png + letter_i.png + letter_j.png + letter_k.png + letter_l.png + letter_m.png + letter_n.png + letter_o.png + letter_p.png + letter_q.png + letter_r.png + letter_s.png + letter_t.png + letter_u.png + letter_v.png + letter_w.png + letter_x.png + letter_y.png + letter_z.png + digit_0.png + digit_1.png + digit_2.png + digit_3.png + digit_4.png + digit_5.png + digit_6.png + digit_7.png + digit_8.png + digit_9.png + symbol_ampersand.png + symbol_apostrophe.png + symbol_bracket_open.png + symbol_bracket_close.png + symbol_colon.png + symbol_comma.png + symbol_dollar.png + symbol_equal.png + symbol_exclamation_mark.png + symbol_greater.png + symbol_hashtag.png + symbol_less.png + symbol_minus.png + symbol_paren_open.png + symbol_paren_close.png + symbol_percent.png + symbol_period.png + symbol_plus.png + symbol_question_mark.png + symbol_quotation_mark.png + symbol_semicolon.png + symbol_slash.png + symbol_star.png + symbol_unknown.png) + +nes_generate_tiles( + nes + icons + TYPE mask + FILES + icon_directory.png + icon_cartridge.png) + +nes_generate_tiles( + nes + banner + TYPE image + FILES banner.png) \ No newline at end of file diff --git a/lib/nes/app/graphics/tiles/banner.png b/lib/nes/app/graphics/tiles/banner.png new file mode 100644 index 0000000..6a77097 Binary files /dev/null and b/lib/nes/app/graphics/tiles/banner.png differ diff --git a/lib/nes/app/graphics/tiles/digit_0.png b/lib/nes/app/graphics/tiles/digit_0.png new file mode 100644 index 0000000..54e7750 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_0.png differ diff --git a/lib/nes/app/graphics/tiles/digit_1.png b/lib/nes/app/graphics/tiles/digit_1.png new file mode 100644 index 0000000..0e7f1a1 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_1.png differ diff --git a/lib/nes/app/graphics/tiles/digit_2.png b/lib/nes/app/graphics/tiles/digit_2.png new file mode 100644 index 0000000..fb333e2 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_2.png differ diff --git a/lib/nes/app/graphics/tiles/digit_3.png b/lib/nes/app/graphics/tiles/digit_3.png new file mode 100644 index 0000000..44b4101 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_3.png differ diff --git a/lib/nes/app/graphics/tiles/digit_4.png b/lib/nes/app/graphics/tiles/digit_4.png new file mode 100644 index 0000000..129a7f4 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_4.png differ diff --git a/lib/nes/app/graphics/tiles/digit_5.png b/lib/nes/app/graphics/tiles/digit_5.png new file mode 100644 index 0000000..f98b63a Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_5.png differ diff --git a/lib/nes/app/graphics/tiles/digit_6.png b/lib/nes/app/graphics/tiles/digit_6.png new file mode 100644 index 0000000..385a065 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_6.png differ diff --git a/lib/nes/app/graphics/tiles/digit_7.png b/lib/nes/app/graphics/tiles/digit_7.png new file mode 100644 index 0000000..2afcfc1 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_7.png differ diff --git a/lib/nes/app/graphics/tiles/digit_8.png b/lib/nes/app/graphics/tiles/digit_8.png new file mode 100644 index 0000000..32d27de Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_8.png differ diff --git a/lib/nes/app/graphics/tiles/digit_9.png b/lib/nes/app/graphics/tiles/digit_9.png new file mode 100644 index 0000000..48b93f3 Binary files /dev/null and b/lib/nes/app/graphics/tiles/digit_9.png differ diff --git a/lib/nes/app/graphics/tiles/icon_cartridge.png b/lib/nes/app/graphics/tiles/icon_cartridge.png new file mode 100644 index 0000000..1115c6e Binary files /dev/null and b/lib/nes/app/graphics/tiles/icon_cartridge.png differ diff --git a/lib/nes/app/graphics/tiles/icon_directory.png b/lib/nes/app/graphics/tiles/icon_directory.png new file mode 100644 index 0000000..e40dd4c Binary files /dev/null and b/lib/nes/app/graphics/tiles/icon_directory.png differ diff --git a/lib/nes/app/graphics/tiles/letter_a.png b/lib/nes/app/graphics/tiles/letter_a.png new file mode 100644 index 0000000..25ad686 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_a.png differ diff --git a/lib/nes/app/graphics/tiles/letter_b.png b/lib/nes/app/graphics/tiles/letter_b.png new file mode 100644 index 0000000..f60f93a Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_b.png differ diff --git a/lib/nes/app/graphics/tiles/letter_c.png b/lib/nes/app/graphics/tiles/letter_c.png new file mode 100644 index 0000000..00a5bd7 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_c.png differ diff --git a/lib/nes/app/graphics/tiles/letter_d.png b/lib/nes/app/graphics/tiles/letter_d.png new file mode 100644 index 0000000..58f5aaf Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_d.png differ diff --git a/lib/nes/app/graphics/tiles/letter_e.png b/lib/nes/app/graphics/tiles/letter_e.png new file mode 100644 index 0000000..0288421 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_e.png differ diff --git a/lib/nes/app/graphics/tiles/letter_f.png b/lib/nes/app/graphics/tiles/letter_f.png new file mode 100644 index 0000000..4fdb312 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_f.png differ diff --git a/lib/nes/app/graphics/tiles/letter_g.png b/lib/nes/app/graphics/tiles/letter_g.png new file mode 100644 index 0000000..3758cd4 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_g.png differ diff --git a/lib/nes/app/graphics/tiles/letter_h.png b/lib/nes/app/graphics/tiles/letter_h.png new file mode 100644 index 0000000..07f2baf Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_h.png differ diff --git a/lib/nes/app/graphics/tiles/letter_i.png b/lib/nes/app/graphics/tiles/letter_i.png new file mode 100644 index 0000000..1fd6549 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_i.png differ diff --git a/lib/nes/app/graphics/tiles/letter_j.png b/lib/nes/app/graphics/tiles/letter_j.png new file mode 100644 index 0000000..17f6d57 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_j.png differ diff --git a/lib/nes/app/graphics/tiles/letter_k.png b/lib/nes/app/graphics/tiles/letter_k.png new file mode 100644 index 0000000..7c66c6b Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_k.png differ diff --git a/lib/nes/app/graphics/tiles/letter_l.png b/lib/nes/app/graphics/tiles/letter_l.png new file mode 100644 index 0000000..d35647d Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_l.png differ diff --git a/lib/nes/app/graphics/tiles/letter_m.png b/lib/nes/app/graphics/tiles/letter_m.png new file mode 100644 index 0000000..8a82a18 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_m.png differ diff --git a/lib/nes/app/graphics/tiles/letter_n.png b/lib/nes/app/graphics/tiles/letter_n.png new file mode 100644 index 0000000..c51f068 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_n.png differ diff --git a/lib/nes/app/graphics/tiles/letter_o.png b/lib/nes/app/graphics/tiles/letter_o.png new file mode 100644 index 0000000..95d27e7 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_o.png differ diff --git a/lib/nes/app/graphics/tiles/letter_p.png b/lib/nes/app/graphics/tiles/letter_p.png new file mode 100644 index 0000000..444966b Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_p.png differ diff --git a/lib/nes/app/graphics/tiles/letter_q.png b/lib/nes/app/graphics/tiles/letter_q.png new file mode 100644 index 0000000..d84bac6 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_q.png differ diff --git a/lib/nes/app/graphics/tiles/letter_r.png b/lib/nes/app/graphics/tiles/letter_r.png new file mode 100644 index 0000000..f425d0c Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_r.png differ diff --git a/lib/nes/app/graphics/tiles/letter_s.png b/lib/nes/app/graphics/tiles/letter_s.png new file mode 100644 index 0000000..b9fa683 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_s.png differ diff --git a/lib/nes/app/graphics/tiles/letter_t.png b/lib/nes/app/graphics/tiles/letter_t.png new file mode 100644 index 0000000..b42c8e1 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_t.png differ diff --git a/lib/nes/app/graphics/tiles/letter_u.png b/lib/nes/app/graphics/tiles/letter_u.png new file mode 100644 index 0000000..6e96b78 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_u.png differ diff --git a/lib/nes/app/graphics/tiles/letter_v.png b/lib/nes/app/graphics/tiles/letter_v.png new file mode 100644 index 0000000..265b7a7 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_v.png differ diff --git a/lib/nes/app/graphics/tiles/letter_w.png b/lib/nes/app/graphics/tiles/letter_w.png new file mode 100644 index 0000000..743cea8 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_w.png differ diff --git a/lib/nes/app/graphics/tiles/letter_x.png b/lib/nes/app/graphics/tiles/letter_x.png new file mode 100644 index 0000000..b5979de Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_x.png differ diff --git a/lib/nes/app/graphics/tiles/letter_y.png b/lib/nes/app/graphics/tiles/letter_y.png new file mode 100644 index 0000000..b85df7b Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_y.png differ diff --git a/lib/nes/app/graphics/tiles/letter_z.png b/lib/nes/app/graphics/tiles/letter_z.png new file mode 100644 index 0000000..52c57e8 Binary files /dev/null and b/lib/nes/app/graphics/tiles/letter_z.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_ampersand.png b/lib/nes/app/graphics/tiles/symbol_ampersand.png new file mode 100644 index 0000000..cdee683 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_ampersand.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_apostrophe.png b/lib/nes/app/graphics/tiles/symbol_apostrophe.png new file mode 100644 index 0000000..8c33457 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_apostrophe.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_bracket_close.png b/lib/nes/app/graphics/tiles/symbol_bracket_close.png new file mode 100644 index 0000000..ea88b56 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_bracket_close.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_bracket_open.png b/lib/nes/app/graphics/tiles/symbol_bracket_open.png new file mode 100644 index 0000000..9e394e1 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_bracket_open.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_colon.png b/lib/nes/app/graphics/tiles/symbol_colon.png new file mode 100644 index 0000000..473867e Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_colon.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_comma.png b/lib/nes/app/graphics/tiles/symbol_comma.png new file mode 100644 index 0000000..3f9c206 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_comma.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_dollar.png b/lib/nes/app/graphics/tiles/symbol_dollar.png new file mode 100644 index 0000000..e112684 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_dollar.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_equal.png b/lib/nes/app/graphics/tiles/symbol_equal.png new file mode 100644 index 0000000..047121c Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_equal.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_exclamation_mark.png b/lib/nes/app/graphics/tiles/symbol_exclamation_mark.png new file mode 100644 index 0000000..11b053f Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_exclamation_mark.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_greater.png b/lib/nes/app/graphics/tiles/symbol_greater.png new file mode 100644 index 0000000..c9b558c Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_greater.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_hashtag.png b/lib/nes/app/graphics/tiles/symbol_hashtag.png new file mode 100644 index 0000000..4c3083c Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_hashtag.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_less.png b/lib/nes/app/graphics/tiles/symbol_less.png new file mode 100644 index 0000000..e1d5c66 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_less.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_minus.png b/lib/nes/app/graphics/tiles/symbol_minus.png new file mode 100644 index 0000000..e87b97f Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_minus.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_paren_close.png b/lib/nes/app/graphics/tiles/symbol_paren_close.png new file mode 100644 index 0000000..c829f6f Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_paren_close.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_paren_open.png b/lib/nes/app/graphics/tiles/symbol_paren_open.png new file mode 100644 index 0000000..8980a82 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_paren_open.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_percent.png b/lib/nes/app/graphics/tiles/symbol_percent.png new file mode 100644 index 0000000..b7249e5 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_percent.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_period.png b/lib/nes/app/graphics/tiles/symbol_period.png new file mode 100644 index 0000000..e2eaf0f Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_period.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_plus.png b/lib/nes/app/graphics/tiles/symbol_plus.png new file mode 100644 index 0000000..f46a109 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_plus.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_question_mark.png b/lib/nes/app/graphics/tiles/symbol_question_mark.png new file mode 100644 index 0000000..598d094 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_question_mark.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_quotation_mark.png b/lib/nes/app/graphics/tiles/symbol_quotation_mark.png new file mode 100644 index 0000000..0a37a5d Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_quotation_mark.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_semicolon.png b/lib/nes/app/graphics/tiles/symbol_semicolon.png new file mode 100644 index 0000000..b0f6ce7 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_semicolon.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_slash.png b/lib/nes/app/graphics/tiles/symbol_slash.png new file mode 100644 index 0000000..549ad14 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_slash.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_star.png b/lib/nes/app/graphics/tiles/symbol_star.png new file mode 100644 index 0000000..abc3dc5 Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_star.png differ diff --git a/lib/nes/app/graphics/tiles/symbol_unknown.png b/lib/nes/app/graphics/tiles/symbol_unknown.png new file mode 100644 index 0000000..1ea56ee Binary files /dev/null and b/lib/nes/app/graphics/tiles/symbol_unknown.png differ diff --git a/lib/nes/app/ui/screen-title.cc b/lib/nes/app/ui/screen-title.cc index 2a7bc5c..f1e4f98 100644 --- a/lib/nes/app/ui/screen-title.cc +++ b/lib/nes/app/ui/screen-title.cc @@ -1,7 +1,8 @@ #include "nes/app/ui/screen-title.hh" #include "nes/app/graphics/renderer.hh" #include "nes/app/graphics/color.hh" -#include "nes/app/graphics/mask-tile.hh" +#include "nes/app/graphics/tiles/banner.hh" +#include "nes/app/graphics/tiles/icons.hh" #include "nes/app/input/input-manager.hh" namespace nes::app @@ -14,8 +15,10 @@ namespace nes::app auto screen_title::render(renderer& renderer) -> void { renderer.render_fill(color::background_primary); - renderer.render_rect(2, 4, 28, 8, color::accent_primary); - renderer.render_mask_tile(10, 16, tiles::letter_a, color::foreground_primary); + renderer.render_text(10, 16, "Hello, world!", color::foreground_primary); + renderer.render_mask_tile(14, 18, tiles::icon_directory, color::accent_primary); + renderer.render_mask_tile(16, 18, tiles::icon_cartridge, color::accent_primary); + renderer.render_image(2, 4, tiles::banner); } auto screen_title::process_events() -> action -- cgit v1.3.1