|
|
@@ -16,8 +16,6 @@ using WalrusRPG::Graphics::Texture;
|
|
|
namespace
|
|
|
{
|
|
|
|
|
|
- Archive arc("data/haeccity.wrf");
|
|
|
- Texture tex_haeccity(arc.get("haeccity"));
|
|
|
// x, y, width, height, xoffset, yoffset
|
|
|
const int16_t haeccity[][6] = {
|
|
|
///*32*/{0, 0, 0, 0},
|
|
|
@@ -247,7 +245,7 @@ namespace
|
|
|
/*255*/{76, 23, 4, 8, 0, 2}
|
|
|
};
|
|
|
|
|
|
- const char haeccity_kernings[][3] = {
|
|
|
+ const int8_t haeccity_kernings[][3] = {
|
|
|
{66, 74, -1},
|
|
|
{67, 74, -1},
|
|
|
{68, 74, -1},
|
|
|
@@ -337,42 +335,43 @@ namespace
|
|
|
Text::print_format(0, 16, "MAP : W: %d, H:%d", map.get_width(), map.get_height());
|
|
|
}
|
|
|
|
|
|
- void putchar_haeccity(unsigned char c, unsigned x, unsigned y)
|
|
|
- {
|
|
|
- if(c <= 32) return;
|
|
|
- c -= 33;
|
|
|
- Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
|
|
|
- put_sprite(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter);
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
- void putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y, const Pixel& col)
|
|
|
- {
|
|
|
- if(c <= 32) return;
|
|
|
- c -= 33;
|
|
|
- Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
|
|
|
- put_sprite_tint(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter, col);
|
|
|
- }
|
|
|
+void STATEMAP::putchar_haeccity(unsigned char c, unsigned x, unsigned y)
|
|
|
+{
|
|
|
+ if(c <= 32) return;
|
|
|
+ c -= 33;
|
|
|
+ Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
|
|
|
+ put_sprite(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter);
|
|
|
+}
|
|
|
+
|
|
|
+void STATEMAP::putchar_haeccity_tint(unsigned char c, unsigned x, unsigned y, const Pixel& col)
|
|
|
+{
|
|
|
+ if(c <= 32) return;
|
|
|
+ c -= 33;
|
|
|
+ Rect letter{haeccity[c][0], haeccity[c][1], haeccity[c][2], haeccity[c][3]};
|
|
|
+ put_sprite_tint(tex_haeccity, x + haeccity[c][4], y + haeccity[c][5], letter, col);
|
|
|
+}
|
|
|
|
|
|
|
|
|
- void print_haeccity(const char *str, unsigned x, unsigned y, const Pixel& col = White)
|
|
|
+void STATEMAP::print_haeccity(const char *str, unsigned x, unsigned y, const Pixel& col = White)
|
|
|
+{
|
|
|
+ const bool must_tint = (col != White);
|
|
|
+ for(unsigned i = 0; str[i] && x < 320; i++)
|
|
|
{
|
|
|
- const bool must_tint = (col != White);
|
|
|
- for(unsigned i = 0; str[i] && x < 320; i++)
|
|
|
- {
|
|
|
- unsigned char c = str[i];
|
|
|
- if(c < 32) continue;
|
|
|
- if(c == 32) {x+=2; continue;}
|
|
|
- // printf("%c = %d\n", c, c);
|
|
|
- if(must_tint)
|
|
|
- putchar_haeccity_tint(c, x, y, col);
|
|
|
- else
|
|
|
- putchar_haeccity(c, x, y);
|
|
|
- x += haeccity[c-33][2] +1;
|
|
|
- }
|
|
|
+ unsigned char c = str[i];
|
|
|
+ if(c < 32) continue;
|
|
|
+ if(c == 32) {x+=2; continue;}
|
|
|
+ // printf("%c = %d\n", c, c);
|
|
|
+ if(must_tint)
|
|
|
+ putchar_haeccity_tint(c, x, y, col);
|
|
|
+ else
|
|
|
+ putchar_haeccity(c, x, y);
|
|
|
+ x += haeccity[c-33][2] +1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-STATEMAP::StateMap(int x, int y, Map &map) : camera(x, y), map(map)
|
|
|
+STATEMAP::StateMap(int x, int y, Map &map) : camera(x, y), map(map), arc_haeccity("data/haeccity.wrf"), tex_haeccity(arc_haeccity.get("haeccity"))
|
|
|
{
|
|
|
}
|
|
|
|
|
|
@@ -383,8 +382,8 @@ void STATEMAP::update(unsigned dt)
|
|
|
|
|
|
void STATEMAP::render(unsigned dt)
|
|
|
{
|
|
|
- fill(Black);
|
|
|
- // map.render(camera, dt);
|
|
|
+ // fill(Black);
|
|
|
+ map.render(camera, dt);
|
|
|
|
|
|
// print_debug_camera_data(camera);
|
|
|
// print_debug_map_data(map);
|
|
|
@@ -393,15 +392,14 @@ void STATEMAP::render(unsigned dt)
|
|
|
print_haeccity("This is a quick prototype to see if variable-wdith fonts works.", 0, 18);
|
|
|
print_haeccity("Builting it myself allows me to make it work on calc too.", 0, 27, Yellow);
|
|
|
print_haeccity("( I wonder if a conditionnal to tint the text slows down a lot the process. )", 0, 36, Gray);
|
|
|
+ print_haeccity("Oh well, I hope I'll get to do a pretty textbox like in games !", 0, 45);
|
|
|
|
|
|
- print_haeccity("Oh well, I hope I'll get to do a pretty textbox like in games !", 0, 54);
|
|
|
- /*
|
|
|
for (int i = 0; i < 16; ++i)
|
|
|
{
|
|
|
for (int j = 0; j < 16; ++j)
|
|
|
{
|
|
|
- putchar_haeccity(16*j + i+32, 16*i, 16*j);
|
|
|
+ putchar_haeccity_tint(16*j + i+32, 6*i, 9*j + 54, Pixel(i*16, j*16, 255));
|
|
|
}
|
|
|
}
|
|
|
- */
|
|
|
+
|
|
|
}
|