medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0b210f7b27bc12d7d86e9ff2f3ea55bd95926be5
parent af4203a148a0408c90f72ea3167feff41acd11b6
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Dec 11 14:48:14 +0200

Fix Windows build

Diffstat:
build.bat | 5+++--
text_renderer.cc | 9++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/build.bat b/build.bat @@ -4,7 +4,7 @@ set PATH=C:\Program Files\Microsoft Visual Studio 12.0\VC\bin;C:\Program Files ( set FLAGS=-I include -Z7 -Zo -W4 -Oi -Gm- -GR- -EHa- -nologo -MTd -Od -wd4100 -wd4201 -wd4189 -wd4505 -wd4127 -wd4530 -wd4702 -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -D_USE_MATH_DEFINES -DWIN32_LEAN_AND_MEAN set EXELIBS=glfw3dll.lib user32.lib shell32.lib opengl32.lib gdi32.lib Ws2_32.lib set EXEFLAGS=%EXELIBS% %FLAGS% -set COMMONOBJS=log.obj memory_arena.obj work_queue.obj immediate.obj benchmark.obj stb_truetype.obj strlcpy.obj renderer.obj +set COMMONOBJS=log.obj memory_arena.obj work_queue.obj immediate.obj benchmark.obj stb_truetype.obj strlcpy.obj renderer.obj text_renderer.obj cl benchmark.cc -c %FLAGS% cl btt.cc -c %FLAGS% @@ -27,11 +27,12 @@ cl -Tpstb_image.h -c %FLAGS% -DSTB_IMAGE_IMPLEMENTATION cl -Tpstb_truetype.h -c %FLAGS% -DSTB_TRUETYPE_IMPLEMENTATION cl strlcpy.cc -c %FLAGS% cl terrain_manager.cc -c %FLAGS% +cl text_renderer.cc -c %FLAGS% cl work_queue.cc -c %FLAGS% REM cl -LD %FLAGS% mod_btt.obj btt.obj gpubtt.obj glad.obj heightmap.obj skybox.obj stb_image.obj %COMMONOBJS% -Femod_btt.dll -link -EXPORT:game_init -EXPORT:game_frame REM cl -LD %FLAGS% hm.obj terrain_manager.obj heightmap.obj btt.obj gpubtt.obj lz4.obj skybox.obj glad.obj %COMMONOBJS% glfw3dll.lib -Fehm.dll -link -EXPORT:game_init -EXPORT:game_frame cl main.cc gl.obj glad.obj hm.obj terrain_manager.obj heightmap.obj btt.obj gpubtt.obj lz4.obj skybox.obj -DSTATIC_GAME %COMMONOBJS% %EXEFLAGS% -Femedfall.exe -cl pp.cc stb_image.obj lz4.obj lz4hc.obj memory_arena.obj strlcpy.obj %EXEFLAGS% +cl pp.cc heightmap.obj stb_image.obj lz4.obj lz4hc.obj memory_arena.obj strlcpy.obj %EXEFLAGS% cl launcher\main.cc log.obj http.obj sha2.obj strlcpy.obj Ws2_32.lib -Felauncher.exe %FLAGS% diff --git a/text_renderer.cc b/text_renderer.cc @@ -49,8 +49,7 @@ static u8 * ttf; static stbtt_fontinfo font_info; static const float pixel_sizes[] = { 16.0f, 32.0f, 48.0f }; -static constexpr size_t num_sizes = ARRAY_COUNT( pixel_sizes ); -static FontSize sizes[ num_sizes ]; +static FontSize sizes[ ARRAY_COUNT( pixel_sizes ) ]; static Shader shader; @@ -66,7 +65,7 @@ void text_renderer_init() { int ascent; stbtt_GetFontVMetrics( &font_info, &ascent, NULL, NULL ); - for( size_t i = 0; i < num_sizes; i++ ) { + for( size_t i = 0; i < ARRAY_COUNT( sizes ); i++ ) { const u32 width = 512; const u32 height = 256; u8 texture[ width * height ]; @@ -105,7 +104,7 @@ void draw_text( const char * str, float x, float y, float pixel_size ) { immediate_init( &imm, triangles, ARRAY_COUNT( triangles ) ); size_t size_idx = 0; - for( size_t i = 0; i < num_sizes; i++ ) { + for( size_t i = 0; i < ARRAY_COUNT( sizes ); i++ ) { size_idx = i; if( pixel_size <= sizes[ i ].pixel_size ) { break; @@ -161,7 +160,7 @@ void draw_text( const char * str, float x, float y, float pixel_size ) { void text_renderer_term() { free( ttf ); renderer_delete_shader( shader ); - for( size_t i = 0; i < num_sizes; i++ ) { + for( size_t i = 0; i < ARRAY_COUNT( sizes ); i++ ) { renderer_delete_texture( sizes[ i ].atlas ); } }