Skip to content
Myr

various fixes for compilation test

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parent 0a3dd5a · Browse files · 5 files+59 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+59 added−7 removed

  • tests:+59 added−7 removed

5 files+59 added−7 removed

modified:tests/resize.dsp+1 added-1 removed
63 unmodified lines
64# PROP Output_Dir "Debug"65# PROP Intermediate_Dir "Debug"66# PROP Target_Dir ""67# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c68# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c68# ADD CPP /nologo /W3 /WX /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c69# ADD BASE RSC /l 0x409 /d "_DEBUG"70# ADD RSC /l 0x409 /d "_DEBUG"71BSC32=bscmake.exe72# ADD BASE BSC32 /nologo
21 unmodified lines
modified:tests/stb.dsp+8 added
124 unmodified lines
125SOURCE=..\stb_perlin.h126# End Source File127# Begin Source File128129SOURCE=..\stb_rect_pack.h130# End Source File131# Begin Source File132133SOURCE=..\stb_textedit.h134# End Source File135# Begin Source File136137SOURCE=..\stb_tilemap_editor.h138# End Source File139# Begin Source File140141SOURCE=..\stb_truetype.h142# End Source File143# Begin Source File144
24 unmodified lines
modified:tests/test_c_compilation.c+4 added-3 removed
4 unmodified lines
5#define STB_DIVIDE_IMPLEMENTATION6#define STB_IMAGE_IMPLEMENTATION7#define STB_HERRINGBONE_WANG_TILE_IMEPLEMENTATIOn8#define STB_IMAGE_RESIZE_IMPLEMENTATION9#define STB_RECT_PACK_IMPLEMENTATION1011#include "stb_herringbone_wang_tile.h"12#include "stb_image.h"13#include "stb_image_write.h"
1 unmodified line
15#include "stb_dxt.h"16#include "stb_c_lexer.h"17#include "stb_divide.h"18#include "stb_image_resize.h"19#include "stb_rect_pack.h"201920#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 021#define STBTE_DRAW_TILE(x,y,id,highlight) 021#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) 022#define STBTE_DRAW_TILE(x,y,id,highlight,data) 023#define STB_TILEMAP_EDITOR_IMPLEMENTATION24#include "stb_tilemap_editor.h"
modified:tests/test_cpp_compilation.cpp+4 added-2 removed
4 unmodified lines
5#define STB_C_LEXER_IMPLEMENTATIOn6#define STB_DIVIDE_IMPLEMENTATION7#define STB_IMAGE_IMPLEMENTATION8#define STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION9#define STB_RECT_PACK_IMPLEMENTATION1011#include "stb_truetype.h"12#include "stb_image_write.h"13#include "stb_perlin.h"
1 unmodified line
15#include "stb_c_lexer.h"16#include "stb_divide.h"17#include "stb_image.h"18#include "stb_herringbone_wang_tile.h"19#include "stb_rect_pack.h"2019#define STBTE_DRAW_RECT(x0,y0,x1,y1,color)20#define STBTE_DRAW_TILE(x,y,id,highlight)21#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) do ; while(0)22#define STBTE_DRAW_TILE(x,y,id,highlight,data) do ; while(0)23#define STB_TILEMAP_EDITOR_IMPLEMENTATION24#include "stb_tilemap_editor.h"
modified:tests/test_truetype.c+42 added-1 removed
1#include "stb_rect_pack.h"2#define STB_TRUETYPE_IMPLEMENTATION3#include "stb_truetype.h"4#include "stb_image_write.h"56#include <stdio.h>78char ttf_buffer[1<<25];
9 unmodified lines
1819 stbtt_MakeGlyphBitmap(&font, output, 6, 9, 512, 5.172414E-03f, 5.172414E-03f, 54);20}2122#define BITMAP_W 25623#define BITMAP_H 40024unsigned char temp_bitmap[BITMAP_H][BITMAP_W];25stbtt_bakedchar cdata[256*2]; // ASCII 32..126 is 95 glyphs26int main(int argc, char **argv)27{28 stbtt_fontinfo font;29 unsigned char *bitmap;30 int w,h,i,j,c = (argc > 1 ? atoi(argv[1]) : 34807), s = (argc > 2 ? atoi(argv[2]) : 32);3126 debug();32 //debug();3334 // @TODO: why is minglui.ttc failing? 35 fread(ttf_buffer, 1, 1<<25, fopen(argc > 3 ? argv[3] : "c:/windows/fonts/mingliu.ttc", "rb"));3637 stbtt_BakeFontBitmap(ttf_buffer,stbtt_GetFontOffsetForIndex(ttf_buffer,0), 40.0, temp_bitmap[0],BITMAP_W,BITMAP_H, 32,96, cdata); // no guarantee this fits!38 stbi_write_png("fonttest1.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);3940 stbtt_BakeFontBitmap(ttf_buffer,stbtt_GetFontOffsetForIndex(ttf_buffer,0), 40.0, temp_bitmap[0],BITMAP_W,BITMAP_H, 32,96, cdata); // no guarantee this fits!4142 {43 stbtt_pack_context pc;44 stbtt_PackBegin(&pc, temp_bitmap[0], BITMAP_W, BITMAP_H, 0, NULL);45 stbtt_PackFontRange(&pc, ttf_buffer, 0, 40.0, 32, 95, cdata);46 stbtt_PackFontRange(&pc, ttf_buffer, 0, 40.0, 0xa0, 0x100-0xa0, cdata);47 stbtt_PackEnd(&pc);48 stbi_write_png("fonttest2.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);49 }5051 {52 stbtt_pack_context pc;53 stbtt_pack_range pr[2];54 stbtt_PackBegin(&pc, temp_bitmap[0], BITMAP_W, BITMAP_H, 0, NULL);5556 pr[0].chardata_for_range = cdata;57 pr[0].first_unicode_char_in_range = 32;58 pr[0].num_chars_in_range = 95;59 pr[0].font_size = 40.0;60 pr[1].chardata_for_range = cdata+256;61 pr[1].first_unicode_char_in_range = 0xa0;62 pr[1].num_chars_in_range = 0x100 - 0xa0;63 pr[1].font_size = 40.0;6465 stbtt_PackFontRanges(&pc, ttf_buffer, 0, pr, 2);66 stbtt_PackEnd(&pc);67 stbi_write_png("fonttest3.png", BITMAP_W, BITMAP_H, 1, temp_bitmap, 0);68 }69 return 0;7071 stbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));72 bitmap = stbtt_GetCodepointBitmap(&font, 0,stbtt_ScaleForPixelHeight(&font, (float)s), c, &w, &h, 0,0);7374 for (j=0; j < h; ++j) {
7 unmodified lines