summary refs log tree commit diff stats
path: root/src/translate_font.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/translate_font.cpp')
-rw-r--r--src/translate_font.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/translate_font.cpp b/src/translate_font.cpp new file mode 100644 index 0000000..7eb4c59 --- /dev/null +++ b/src/translate_font.cpp
@@ -0,0 +1,32 @@
1#include "renderer.h"
2#include <cstdio>
3
4#define min(x,y) ((x) > (y) ? (y) : (x))
5
6int main()
7{
8 initRenderer();
9
10 Texture* palette = createTexture(128, 128);
11 fillTexture(palette, NULL, 0, 0, 0);
12
13 Texture* wrong = loadTextureFromBMP("../res/arcadepix_regular_8.bmp");
14
15 FILE* desc = fopen("../res/arcadepix_regular_8.sfl", "r");
16 while (!feof(desc))
17 {
18 int ch;
19 Rectangle srcRect;
20
21 fscanf(desc, "%d %d %d %d %d %*d %*d %*d \n", &ch, &(srcRect.x), &(srcRect.y), &(srcRect.w), &(srcRect.h));
22
23 Rectangle dstRect(ch % 16 * 8, ch / 16 * 8 + (8 - min(srcRect.h,8)), min(srcRect.w, 8), min(srcRect.h, 8));
24 blitTexture(wrong, palette, &srcRect, &dstRect);
25 }
26
27 fclose(desc);
28
29 saveTextureToBMP(palette, "tex.bmp");
30
31 destroyRenderer();
32}