From 7bdd1257f46adac09a817d1cffa8bb1f22930d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Mon, 10 Dec 2012 22:57:06 -0300 Subject: [PATCH] Fixed eeclamp. Added a little tweak for texture fonts to support tabs. --- Makefile | 6 +++--- include/eepp/declares.hpp | 4 ++-- projects/linux/ee.creator.user | 2 +- src/eepp/graphics/ctexturefont.cpp | 15 ++++++++++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 954d36a10..ba0ffb97e 100644 --- a/Makefile +++ b/Makefile @@ -147,11 +147,11 @@ os: objdir: @echo $(OBJDIR) -test: dirs $(EXETEST) +test: dirs libeepp.a $(EXETEST) -ew: dirs $(EXEEMPTYWINDOW) +ew: dirs libeepp.a $(EXEEMPTYWINDOW) -es: dirs $(EXEEXTSHADER) +es: dirs libeepp.a $(EXEEXTSHADER) docs: doxygen ./Doxyfile diff --git a/include/eepp/declares.hpp b/include/eepp/declares.hpp index ec05d95f7..f2e31c3f1 100644 --- a/include/eepp/declares.hpp +++ b/include/eepp/declares.hpp @@ -272,12 +272,12 @@ namespace EE { template T eeclamp( T val, T min, T max ) { - return ( val < min ) ? min : max; + return ( val < min ) ? min : ( ( val > max ) ? max : val ); } template void eeclamp( T* val, T min, T max ) { - ( *val < min ) ? *val = min : *val = max; + ( *val < min ) ? *val = min : ( ( *val > max ) ? *val = max : *val ); } typedef SOPHIST_int8 Int8; diff --git a/projects/linux/ee.creator.user b/projects/linux/ee.creator.user index 213165a69..ff3c8c698 100644 --- a/projects/linux/ee.creator.user +++ b/projects/linux/ee.creator.user @@ -1,6 +1,6 @@ - + ProjectExplorer.Project.ActiveTarget diff --git a/src/eepp/graphics/ctexturefont.cpp b/src/eepp/graphics/ctexturefont.cpp index 4f906d165..a2ef90f0c 100755 --- a/src/eepp/graphics/ctexturefont.cpp +++ b/src/eepp/graphics/ctexturefont.cpp @@ -61,10 +61,19 @@ void cTextureFont::BuildFont() { cTextureFactory::instance()->Bind( mTexId ); + int c = 0; + for (eeUint i = 0; i < mNumChars; i++) { - if ( i >= mStartChar ) { - cX = (eeFloat)( (i-mStartChar) % mTexColumns ) / (eeFloat)mTexColumns; - cY = (eeFloat)( (i-mStartChar) / mTexColumns ) / (eeFloat)mTexRows; + if ( i >= mStartChar || ( mStartChar <= 32 && i == 9 ) ) { + c = i; + + // Little hack to always provide a tab + if ( 9 == i ) { + c = 32; + } + + cX = (eeFloat)( (c-mStartChar) % mTexColumns ) / (eeFloat)mTexColumns; + cY = (eeFloat)( (c-mStartChar) / mTexColumns ) / (eeFloat)mTexRows; mGlyphs[i].Advance = mSpacing;