Avoid naming collision

This commit is contained in:
Henrik Rydgard 2012-06-30 22:54:26 +02:00
parent 6e81b46ee0
commit 0c038bb43e
5 changed files with 30 additions and 17 deletions

View file

@ -1,5 +1,5 @@
set(SRCS
draw_buffer.cpp
lame_buffer.cpp
)
set(SRCS ${SRCS})

View file

@ -3,20 +3,21 @@
#ifdef ANDROID
#include <GLES/gl.h>
#else
#include <GL/glew.h>
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
#endif
#include <stdio.h>
#include <stdlib.h>
#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);
}

View file

@ -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;

View file

@ -127,6 +127,7 @@
<ClInclude Include="gfx\texture_gen.h" />
<ClInclude Include="gfx\texture.h" />
<ClInclude Include="gfx\texture_atlas.h" />
<ClInclude Include="gfx_es1\lame_buffer.h" />
<ClInclude Include="gfx_es2\draw_buffer.h" />
<ClInclude Include="gfx_es2\fbo.h" />
<ClInclude Include="gfx_es2\glsl_program.h" />
@ -184,6 +185,7 @@
<ClCompile Include="gfx\texture.cpp" />
<ClCompile Include="gfx\texture_atlas.cpp" />
<ClCompile Include="gfx\texture_gen.cpp" />
<ClCompile Include="gfx_es1\lame_buffer.cpp" />
<ClCompile Include="gfx_es2\draw_buffer.cpp" />
<ClCompile Include="gfx_es2\fbo.cpp" />
<ClCompile Include="gfx_es2\glsl_program.cpp" />

View file

@ -175,6 +175,9 @@
<ClInclude Include="net\resolve.h">
<Filter>net</Filter>
</ClInclude>
<ClInclude Include="gfx_es1\lame_buffer.h">
<Filter>gfx</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="gfx\gl_debug_log.cpp">
@ -318,6 +321,9 @@
<ClCompile Include="net\resolve.cpp">
<Filter>net</Filter>
</ClCompile>
<ClCompile Include="gfx_es1\lame_buffer.cpp">
<Filter>gfx</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="gfx">