فهرست منبع

fix c++ compilation

Sean Barrett 11 سال پیش
والد
کامیت
17647014b3
3فایلهای تغییر یافته به همراه49 افزوده شده و 40 حذف شده
  1. 37 39
      stb_tilemap_editor.h
  2. 7 1
      tests/test_c_compilation.c
  3. 5 0
      tests/test_cpp_compilation.cpp

+ 37 - 39
stb_tilemap_editor.h

@@ -303,9 +303,43 @@ extern void stbte_set_layername(stbte_tilemap *tm, int layer, const char *layern
 #define STBTE_COLOR_LAYERMASK_LOCK       0x5f55ff
 #define STBTE_COLOR_LAYERMASK_SOLO       0xff5f55
 
-#define STBTE__FONT_HEIGHT    9   // UI adjusts to this so it is possible to substitute fonts
-static short stbte__fontdata[762];
+#define STBTE__FONT_HEIGHT    9
 static short stbte__font_offset[95+16];
+static short stbte__fontdata[762] =
+{
+   4,4,4,9,9,9,9,8,9,8,4,9,7,7,7,7,4,2,6,8,6,6,7,3,4,4,8,6,3,6,2,6,6,6,6,6,6,
+   6,6,6,6,6,2,3,5,4,5,6,6,6,6,6,6,6,6,6,6,6,6,7,6,7,7,7,6,7,6,6,6,6,7,7,6,6,
+   6,4,6,4,7,7,3,6,6,5,6,6,5,6,6,4,5,6,4,7,6,6,6,6,6,6,6,6,6,7,6,6,6,5,2,5,8,
+   0,0,0,0,0,0,0,0,0,0,0,0,146,511,146,146,511,146,146,511,146,511,257,341,297,
+   341,297,341,257,511,16,56,124,16,16,16,124,56,16,96,144,270,261,262,136,80,
+   48,224,192,160,80,40,22,14,15,3,448,496,496,240,232,20,10,5,2,112,232,452,
+   450,225,113,58,28,63,30,60,200,455,257,257,0,0,0,257,257,455,120,204,132,
+   132,159,14,4,4,14,159,132,132,204,120,8,24,56,120,56,24,8,32,48,56,60,56,
+   48,32,0,0,0,0,111,111,7,7,0,0,7,7,34,127,127,34,34,127,127,34,36,46,107,107,
+   58,18,99,51,24,12,102,99,48,122,79,93,55,114,80,4,7,3,62,127,99,65,65,99,
+   127,62,8,42,62,28,28,62,42,8,8,8,62,62,8,8,128,224,96,8,8,8,8,8,8,96,96,96,
+   48,24,12,6,3,62,127,89,77,127,62,64,66,127,127,64,64,98,115,89,77,71,66,33,
+   97,73,93,119,35,24,28,22,127,127,16,39,103,69,69,125,57,62,127,73,73,121,
+   48,1,1,113,121,15,7,54,127,73,73,127,54,6,79,73,105,63,30,54,54,128,246,118,
+   8,28,54,99,65,20,20,20,20,65,99,54,28,8,2,3,105,109,7,2,30,63,33,45,47,46,
+   124,126,19,19,126,124,127,127,73,73,127,54,62,127,65,65,99,34,127,127,65,
+   99,62,28,127,127,73,73,73,65,127,127,9,9,9,1,62,127,65,73,121,121,127,127,
+   8,8,127,127,65,65,127,127,65,65,32,96,64,64,127,63,127,127,8,28,54,99,65,
+   127,127,64,64,64,64,127,127,6,12,6,127,127,127,127,6,12,24,127,127,62,127,
+   65,65,65,127,62,127,127,9,9,15,6,62,127,65,81,49,127,94,127,127,9,25,127,
+   102,70,79,73,73,121,49,1,1,127,127,1,1,63,127,64,64,127,63,15,31,48,96,48,
+   31,15,127,127,48,24,48,127,127,99,119,28,28,119,99,7,15,120,120,15,7,97,113,
+   89,77,71,67,127,127,65,65,3,6,12,24,48,96,65,65,127,127,8,12,6,3,6,12,8,64,
+   64,64,64,64,64,64,3,7,4,32,116,84,84,124,120,127,127,68,68,124,56,56,124,
+   68,68,68,56,124,68,68,127,127,56,124,84,84,92,24,8,124,126,10,10,56,380,324,
+   324,508,252,127,127,4,4,124,120,72,122,122,64,256,256,256,506,250,126,126,
+   16,56,104,64,66,126,126,64,124,124,24,56,28,124,120,124,124,4,4,124,120,56,
+   124,68,68,124,56,508,508,68,68,124,56,56,124,68,68,508,508,124,124,4,4,12,
+   8,72,92,84,84,116,36,4,4,62,126,68,68,60,124,64,64,124,124,28,60,96,96,60,
+   28,28,124,112,56,112,124,28,68,108,56,56,108,68,284,316,352,320,508,252,68,
+   100,116,92,76,68,8,62,119,65,65,127,127,65,65,119,62,8,16,24,12,12,24,24,
+   12,4,
+};
 
 typedef struct
 {
@@ -514,7 +548,7 @@ stbte_tilemap *stbte_create_map(int map_x, int map_y, int map_layers, int spacin
       return NULL;
 
    tm->tiles = (stbte__tileinfo *) (tm+1);
-   tm->undo_buffer = (unsigned short *) (tm->tiles + max_tiles);
+   tm->undo_buffer = (short *) (tm->tiles + max_tiles);
    tm->num_layers = map_layers;
    tm->max_x = map_x;
    tm->max_y = map_y;
@@ -2696,40 +2730,4 @@ void stbte_mouse_sdl(stbte_tilemap *tm, const void *sdl_event, float xs, float y
 #endif
 }
 
-static short stbte__fontdata[762] =
-{
-   4,4,4,9,9,9,9,8,9,8,4,9,7,7,7,7,4,2,6,8,6,6,7,3,4,4,8,6,3,6,2,6,6,6,6,6,6,
-   6,6,6,6,6,2,3,5,4,5,6,6,6,6,6,6,6,6,6,6,6,6,7,6,7,7,7,6,7,6,6,6,6,7,7,6,6,
-   6,4,6,4,7,7,3,6,6,5,6,6,5,6,6,4,5,6,4,7,6,6,6,6,6,6,6,6,6,7,6,6,6,5,2,5,8,
-   0,0,0,0,0,0,0,0,0,0,0,0,146,511,146,146,511,146,146,511,146,511,257,341,297,
-   341,297,341,257,511,16,56,124,16,16,16,124,56,16,96,144,270,261,262,136,80,
-   48,224,192,160,80,40,22,14,15,3,448,496,496,240,232,20,10,5,2,112,232,452,
-   450,225,113,58,28,63,30,60,200,455,257,257,0,0,0,257,257,455,120,204,132,
-   132,159,14,4,4,14,159,132,132,204,120,8,24,56,120,56,24,8,32,48,56,60,56,
-   48,32,0,0,0,0,111,111,7,7,0,0,7,7,34,127,127,34,34,127,127,34,36,46,107,107,
-   58,18,99,51,24,12,102,99,48,122,79,93,55,114,80,4,7,3,62,127,99,65,65,99,
-   127,62,8,42,62,28,28,62,42,8,8,8,62,62,8,8,128,224,96,8,8,8,8,8,8,96,96,96,
-   48,24,12,6,3,62,127,89,77,127,62,64,66,127,127,64,64,98,115,89,77,71,66,33,
-   97,73,93,119,35,24,28,22,127,127,16,39,103,69,69,125,57,62,127,73,73,121,
-   48,1,1,113,121,15,7,54,127,73,73,127,54,6,79,73,105,63,30,54,54,128,246,118,
-   8,28,54,99,65,20,20,20,20,65,99,54,28,8,2,3,105,109,7,2,30,63,33,45,47,46,
-   124,126,19,19,126,124,127,127,73,73,127,54,62,127,65,65,99,34,127,127,65,
-   99,62,28,127,127,73,73,73,65,127,127,9,9,9,1,62,127,65,73,121,121,127,127,
-   8,8,127,127,65,65,127,127,65,65,32,96,64,64,127,63,127,127,8,28,54,99,65,
-   127,127,64,64,64,64,127,127,6,12,6,127,127,127,127,6,12,24,127,127,62,127,
-   65,65,65,127,62,127,127,9,9,15,6,62,127,65,81,49,127,94,127,127,9,25,127,
-   102,70,79,73,73,121,49,1,1,127,127,1,1,63,127,64,64,127,63,15,31,48,96,48,
-   31,15,127,127,48,24,48,127,127,99,119,28,28,119,99,7,15,120,120,15,7,97,113,
-   89,77,71,67,127,127,65,65,3,6,12,24,48,96,65,65,127,127,8,12,6,3,6,12,8,64,
-   64,64,64,64,64,64,3,7,4,32,116,84,84,124,120,127,127,68,68,124,56,56,124,
-   68,68,68,56,124,68,68,127,127,56,124,84,84,92,24,8,124,126,10,10,56,380,324,
-   324,508,252,127,127,4,4,124,120,72,122,122,64,256,256,256,506,250,126,126,
-   16,56,104,64,66,126,126,64,124,124,24,56,28,124,120,124,124,4,4,124,120,56,
-   124,68,68,124,56,508,508,68,68,124,56,56,124,68,68,508,508,124,124,4,4,12,
-   8,72,92,84,84,116,36,4,4,62,126,68,68,60,124,64,64,124,124,28,60,96,96,60,
-   28,28,124,112,56,112,124,28,68,108,56,56,108,68,284,316,352,320,508,252,68,
-   100,116,92,76,68,8,62,119,65,65,127,127,65,65,119,62,8,16,24,12,12,24,24,
-   12,4,
-};
-
 #endif // STB_TILEMAP_EDITOR_IMPLEMENTATION

+ 7 - 1
tests/test_c_compilation.c

@@ -14,4 +14,10 @@
 #include "stb_dxt.h"
 #include "stb_c_lexer.h"
 #include "stb_divide.h"
-#include "stb_image_resize.h"
+#include "stb_image_resize.h"
+
+
+#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 0
+#define STBTE_DRAW_TILE(x,y,id,highlight)  0
+#define STB_TILEMAP_EDITOR_IMPLEMENTATION
+#include "stb_tilemap_editor.h"

+ 5 - 0
tests/test_cpp_compilation.cpp

@@ -15,3 +15,8 @@
 #include "stb_divide.h"
 #include "stb_image.h"
 #include "stb_herringbone_wang_tile.h"
+
+#define STBTE_DRAW_RECT(x0,y0,x1,y1,color)
+#define STBTE_DRAW_TILE(x,y,id,highlight)
+#define STB_TILEMAP_EDITOR_IMPLEMENTATION
+#include "stb_tilemap_editor.h"