diff --git a/gfx_es1/CMakeLists.txt b/gfx_es1/CMakeLists.txt index f618a2598c..a0357bae75 100644 --- a/gfx_es1/CMakeLists.txt +++ b/gfx_es1/CMakeLists.txt @@ -1,5 +1,5 @@ set(SRCS - draw_buffer.cpp + lame_buffer.cpp ) set(SRCS ${SRCS}) diff --git a/gfx_es1/draw_buffer.cpp b/gfx_es1/lame_buffer.cpp similarity index 94% rename from gfx_es1/draw_buffer.cpp rename to gfx_es1/lame_buffer.cpp index 8c8b956933..0f2fb8a18e 100644 --- a/gfx_es1/draw_buffer.cpp +++ b/gfx_es1/lame_buffer.cpp @@ -3,20 +3,21 @@ #ifdef ANDROID #include #else +#include #if defined(__APPLE__) #include #else #include #endif #endif + + #include #include -#include "gfx_es1/draw_buffer.h" +#include "gfx_es1/lame_buffer.h" #include "gfx/texture_atlas.h" -#include "main_atlas.h" - LAMEBuffer buffer; LAMEBuffer topbuffer; @@ -167,6 +168,7 @@ void LAMEBuffer::DrawImage2GridH(int atlas_image, float x1, float y1, float x2, } void LAMEBuffer::MeasureText(int font, const char *text, float *w, float *h) { + if (!font) font = defaultFont; const AtlasFont &atlasfont = *atlas->fonts[font]; unsigned char cval; float wacc = 0, maxh = 0; @@ -268,20 +270,20 @@ void LAMEBuffer::RotateSprite(int atlas_entry, float x, float y, float angle, fl } void LAMEBuffer::drawText(const TCHAR *text, int x, int y, Color color, int font) { - DrawText(UBUNTU24, text, x, y+3, color); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color); } void LAMEBuffer::drawTextCenter(const TCHAR *text, int x, int y, Color color, int font) { - DrawText(UBUNTU24, text, x, y+3, color, TEXT_HCENTER); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color, TEXT_HCENTER); } void LAMEBuffer::drawTextShadow(const TCHAR *text, int x, int y, Color color, Color shadowColor, int font) { - DrawText(UBUNTU24, text, x, y+3, color); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color); } void LAMEBuffer::drawTextShadowCenter(const TCHAR *text, int x, int y, Color color, Color shadowColor, int font) { - DrawText(UBUNTU24, text, x, y+3, color, TEXT_HCENTER); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color, TEXT_HCENTER); } void LAMEBuffer::drawTextContrastCenter(const TCHAR *text, int x, int y, Color color, Color shadowColor, int font) { - DrawText(UBUNTU24, text, x, y+3, color, TEXT_HCENTER); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color, TEXT_HCENTER); } void LAMEBuffer::drawTextContrast(const TCHAR *text, int x, int y, Color color, Color shadowColor, int font) { - DrawText(UBUNTU24, text, x, y+3, color); + DrawText(font == 0 ? defaultFont : font, text, x, y+3, color); } diff --git a/gfx_es1/draw_buffer.h b/gfx_es1/lame_buffer.h similarity index 91% rename from gfx_es1/draw_buffer.h rename to gfx_es1/lame_buffer.h index a1ba53f481..9f8e214dfe 100644 --- a/gfx_es1/draw_buffer.h +++ b/gfx_es1/lame_buffer.h @@ -6,7 +6,7 @@ #include "base/basictypes.h" #include "base/color.h" -class Atlas; +struct Atlas; enum { TEXT_LEFT = 0, @@ -61,12 +61,12 @@ class LAMEBuffer { void RotateSprite(int atlas_entry, float x, float y, float angle, float scale, Color color); - void drawText(const TCHAR *text, int x, int y, Color color = 0, int font=0); - void drawTextCenter(const TCHAR *text, int x, int y, Color color, int font=0); - void drawTextShadow(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font=0); - void drawTextShadowCenter(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font=0); - void drawTextContrastCenter(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font=0); - void drawTextContrast(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font=0); + void drawText(const TCHAR *text, int x, int y, Color color = 0, int font = 0); + void drawTextCenter(const TCHAR *text, int x, int y, Color color, int font = 0); + void drawTextShadow(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font = 0); + void drawTextShadowCenter(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font = 0); + void drawTextContrastCenter(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font = 0); + void drawTextContrast(const TCHAR *text, int x, int y, Color color=0xffffffff, Color shadowColor=0xFF000000, int font = 0); void SetFontScale(float xs, float ys) { fontscalex = xs; @@ -93,11 +93,14 @@ class LAMEBuffer { // Draws what we have collected so far, so that we can change blend modes etc. void Flush(); + void SetDefaultFont(int defFont) {defaultFont = defFont;} + private: const Atlas *atlas; float xoffset, yoffset; + int defaultFont; float fontscalex; float fontscaley; diff --git a/native.vcxproj b/native.vcxproj index fbf66942d2..998622508f 100644 --- a/native.vcxproj +++ b/native.vcxproj @@ -127,6 +127,7 @@ + @@ -184,6 +185,7 @@ + diff --git a/native.vcxproj.filters b/native.vcxproj.filters index a27c2d5378..457b2b84ae 100644 --- a/native.vcxproj.filters +++ b/native.vcxproj.filters @@ -175,6 +175,9 @@ net + + gfx + @@ -318,6 +321,9 @@ net + + gfx +