Skip to content

Commit

Permalink
Merge pull request stepmania#1960 from Prcuvu/texture_font_generator_fix
Browse files Browse the repository at this point in the history
Fix Texture Font Generator for Windows x64 build
  • Loading branch information
quietly-turning authored Feb 13, 2020
2 parents 2b1de03 + 360db59 commit caf2f65
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/CMakeProject-texture.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ if(NOT WITH_STATIC_LINKING)
sm_add_compile_definition("TextureFontGenerator" _AFXDLL)
endif()

sm_add_compile_definition("TextureFontGenerator" CMAKE_POWERED)

list(APPEND TEXTURE_LINK_LIB "zlib" "png")

target_link_libraries("TextureFontGenerator" ${TEXTURE_LINK_LIB})
Expand All @@ -49,7 +51,8 @@ list(APPEND TEXTURE_INCLUDE_DIRS
"${TEXTURE_DIR}"
"${TEXTURE_DIR}/res"
"${SM_EXTERN_DIR}/zlib"
"${SM_EXTERN_DIR}/libpng/include")
"${SM_EXTERN_DIR}/libpng/include"
"${SM_SRC_DIR}/generated")

target_include_directories("TextureFontGenerator"
PUBLIC ${TEXTURE_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion src/Texture Font Generator/TextureFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void TextureFont::FormatFontPage( int iPage, HDC hDC )
}

++iCol;
if( iCol == pPage->m_iNumFramesY )
if( iCol == pPage->m_iNumFramesX )
{
iCol = 0;
++iRow;
Expand Down
17 changes: 17 additions & 0 deletions src/Texture Font Generator/Utils.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#ifndef UTILS_H
#define UTILS_H

#if defined(CMAKE_POWERED)
#include "config.hpp"
#elif defined(HAVE_CONFIG_H)
#include "config.h"
#endif

#if !defined(HAVE_TRUNCF)
inline float truncf( float f ) { return float(int(f)); };
#endif

#if !defined(HAVE_ROUNDF)
inline float roundf( float f ) { if(f < 0) return truncf(f-0.5f); return truncf(f+0.5f); };
#endif

#if !defined(HAVE_LRINTF)
#if defined(_MSC_VER) && defined(_X86_)
inline long int lrintf( float f )
{
int retval;
Expand All @@ -13,6 +26,10 @@ inline long int lrintf( float f )

return retval;
}
#else
#define lrintf(x) ((int)rint(x))
#endif
#endif

struct Surface
{
Expand Down

0 comments on commit caf2f65

Please sign in to comment.