summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-09-03 22:54:04 -0400
committerLioncash <mathew1800@gmail.com>2014-09-03 22:59:05 -0400
commit89557f6c2fbc087de538017da46a6fc60e24b86e (patch)
treea28d94509e55833f61dab54be12472c99bd108cb /Source
parent1f6f01e2a0dc8c5d96f2ebf15ee2d6b03a79eeec (diff)
OGL: Fix constant casing in RasterFont
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoBackends/OGL/RasterFont.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/Source/Core/VideoBackends/OGL/RasterFont.cpp b/Source/Core/VideoBackends/OGL/RasterFont.cpp
index 168d661970..6d1fe829fc 100644
--- a/Source/Core/VideoBackends/OGL/RasterFont.cpp
+++ b/Source/Core/VideoBackends/OGL/RasterFont.cpp
@@ -11,12 +11,12 @@
namespace OGL
{
-static const int char_width = 8;
-static const int char_height = 13;
-static const int char_offset = 32;
-static const int char_count = 95;
+static const int CHAR_WIDTH = 8;
+static const int CHAR_HEIGHT = 13;
+static const int CHAR_OFFSET = 32;
+static const int CHAR_COUNT = 95;
-const u8 rasters[char_count][char_height] = {
+const u8 rasters[CHAR_COUNT][CHAR_HEIGHT] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36},
@@ -141,20 +141,20 @@ RasterFont::RasterFont()
glGenTextures(1, &texture);
glActiveTexture(GL_TEXTURE0+8);
glBindTexture(GL_TEXTURE_2D, texture);
- u32* texture_data = new u32[char_width*char_count*char_height];
- for (int y = 0; y < char_height; y++)
+ u32* texture_data = new u32[CHAR_WIDTH * CHAR_COUNT * CHAR_HEIGHT];
+ for (int y = 0; y < CHAR_HEIGHT; y++)
{
- for (int c = 0; c < char_count; c++)
+ for (int c = 0; c < CHAR_COUNT; c++)
{
- for (int x = 0; x < char_width; x++)
+ for (int x = 0; x < CHAR_WIDTH; x++)
{
- bool pixel = (0 != (rasters[c][y] & (1<<(char_width-x-1))));
- texture_data[char_width*char_count*y+char_width*c+x] = pixel ? -1 : 0;
+ bool pixel = (0 != (rasters[c][y] & (1 << (CHAR_WIDTH - x - 1))));
+ texture_data[CHAR_WIDTH * CHAR_COUNT * y + CHAR_WIDTH * c + x] = pixel ? -1 : 0;
}
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, char_width*char_count, char_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CHAR_WIDTH * CHAR_COUNT, CHAR_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture_data);
delete [] texture_data;
// generate shader
@@ -162,7 +162,7 @@ RasterFont::RasterFont()
s_shader.Bind();
// bound uniforms
- glUniform2f(glGetUniformLocation(s_shader.glprogid,"charSize"), 1.0f / GLfloat(char_count), 1.0f);
+ glUniform2f(glGetUniformLocation(s_shader.glprogid,"charSize"), 1.0f / GLfloat(CHAR_COUNT), 1.0f);
uniform_color_id = glGetUniformLocation(s_shader.glprogid,"color");
glUniform4f(uniform_color_id, 1.0f, 1.0f, 1.0f, 1.0f);
cached_color = -1;
@@ -191,10 +191,10 @@ void RasterFont::printMultilineText(const std::string& text, double start_x, dou
GLfloat* vertices = new GLfloat[text.length() * 6 * 4];
int usage = 0;
- GLfloat delta_x = GLfloat(2*char_width)/GLfloat(bbWidth);
- GLfloat delta_y = GLfloat(2*char_height)/GLfloat(bbHeight);
- GLfloat border_x = 2.0f/GLfloat(bbWidth);
- GLfloat border_y = 4.0f/GLfloat(bbHeight);
+ GLfloat delta_x = GLfloat(2 * CHAR_WIDTH) / GLfloat(bbWidth);
+ GLfloat delta_y = GLfloat(2 * CHAR_HEIGHT) / GLfloat(bbHeight);
+ GLfloat border_x = 2.0f / GLfloat(bbWidth);
+ GLfloat border_y = 4.0f / GLfloat(bbHeight);
GLfloat x = GLfloat(start_x);
GLfloat y = GLfloat(start_y);
@@ -215,37 +215,37 @@ void RasterFont::printMultilineText(const std::string& text, double start_x, dou
continue;
}
- if ((u32) c < char_offset || (u32) c >= char_count+char_offset)
+ if ((u32) c < CHAR_OFFSET || (u32) c >= CHAR_COUNT + CHAR_OFFSET)
continue;
vertices[usage++] = x;
vertices[usage++] = y;
- vertices[usage++] = GLfloat(c-char_offset);
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET);
vertices[usage++] = 0.0f;
- vertices[usage++] = x+delta_x;
+ vertices[usage++] = x + delta_x;
vertices[usage++] = y;
- vertices[usage++] = GLfloat(c-char_offset+1);
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET + 1);
vertices[usage++] = 0.0f;
- vertices[usage++] = x+delta_x;
- vertices[usage++] = y+delta_y;
- vertices[usage++] = GLfloat(c-char_offset+1);
+ vertices[usage++] = x + delta_x;
+ vertices[usage++] = y + delta_y;
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET + 1);
vertices[usage++] = 1.0f;
vertices[usage++] = x;
vertices[usage++] = y;
- vertices[usage++] = GLfloat(c-char_offset);
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET);
vertices[usage++] = 0.0f;
- vertices[usage++] = x+delta_x;
- vertices[usage++] = y+delta_y;
- vertices[usage++] = GLfloat(c-char_offset+1);
+ vertices[usage++] = x + delta_x;
+ vertices[usage++] = y + delta_y;
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET + 1);
vertices[usage++] = 1.0f;
vertices[usage++] = x;
- vertices[usage++] = y+delta_y;
- vertices[usage++] = GLfloat(c-char_offset);
+ vertices[usage++] = y + delta_y;
+ vertices[usage++] = GLfloat(c - CHAR_OFFSET);
vertices[usage++] = 1.0f;
x += delta_x + border_x;