2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
2009-06-13 22:08:01 +00:00
|
|
|
#include "GLUtil.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2009-10-13 06:12:58 +00:00
|
|
|
#include "RasterFont.h"
|
2008-12-08 05:25:12 +00:00
|
|
|
// globals
|
|
|
|
|
|
|
|
GLubyte rasters[][13] = {
|
|
|
|
{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},
|
|
|
|
{0x00, 0x00, 0x00, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x18, 0x7e, 0xff, 0x1b, 0x1f, 0x7e, 0xf8, 0xd8, 0xff, 0x7e, 0x18},
|
|
|
|
{0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x6e, 0x30, 0x18, 0x0c, 0x76, 0xdb, 0xd8, 0x70},
|
|
|
|
{0x00, 0x00, 0x7f, 0xc6, 0xcf, 0xd8, 0x70, 0x70, 0xd8, 0xcc, 0xcc, 0x6c, 0x38},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x0c, 0x0e},
|
|
|
|
{0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c},
|
|
|
|
{0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x99, 0x5a, 0x3c, 0xff, 0x3c, 0x5a, 0x99, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03},
|
|
|
|
{0x00, 0x00, 0x3c, 0x66, 0xc3, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xc3, 0x66, 0x3c},
|
|
|
|
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18},
|
|
|
|
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0xe7, 0x7e},
|
|
|
|
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0x07, 0x03, 0x03, 0xe7, 0x7e},
|
|
|
|
{0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xcc, 0x6c, 0x3c, 0x1c, 0x0c},
|
|
|
|
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
|
|
|
|
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
|
|
|
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x03, 0x03, 0xff},
|
|
|
|
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
|
|
|
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x03, 0x7f, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
|
|
|
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x1c, 0x1c, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60},
|
|
|
|
{0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x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0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
|
|
|
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
|
|
|
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff},
|
|
|
|
{0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c},
|
|
|
|
{0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60},
|
|
|
|
{0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18},
|
|
|
|
{0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x30, 0x70},
|
|
|
|
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0x7f, 0x03, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
|
|
|
|
{0x00, 0x00, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x03},
|
|
|
|
{0x00, 0x00, 0x7f, 0x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
|
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0xfe, 0x03, 0x03, 0x7e, 0xc0, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x00},
|
|
|
|
{0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0xc0, 0x60, 0x60, 0x30, 0x18, 0x3c, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00},
|
|
|
|
{0x00, 0x00, 0x0f, 0x18, 0x18, 0x18, 0x38, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x0f},
|
|
|
|
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
|
|
|
{0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0},
|
|
|
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00}
|
|
|
|
};
|
|
|
|
|
|
|
|
RasterFont::RasterFont()
|
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
// set GL modes
|
|
|
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
|
|
// create the raster font
|
|
|
|
fontOffset = glGenLists(128);
|
|
|
|
for (int i = 32; i < 127; i++) {
|
|
|
|
glNewList(i + fontOffset, GL_COMPILE);
|
|
|
|
glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i - 32]);
|
|
|
|
glEndList();
|
|
|
|
}
|
2009-07-19 09:15:00 +00:00
|
|
|
|
|
|
|
temp_buffer = new char[TEMP_BUFFER_SIZE];
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RasterFont::~RasterFont()
|
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
glDeleteLists(fontOffset, 128);
|
2009-07-19 09:15:00 +00:00
|
|
|
delete [] temp_buffer;
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RasterFont::printString(const char *s, double x, double y, double z)
|
|
|
|
{
|
2009-06-28 12:30:34 +00:00
|
|
|
int length = (int)strlen(s);
|
2009-06-13 22:08:01 +00:00
|
|
|
if (!length)
|
|
|
|
return;
|
2009-07-19 09:15:00 +00:00
|
|
|
if (length >= TEMP_BUFFER_SIZE)
|
|
|
|
length = TEMP_BUFFER_SIZE - 1;
|
2009-06-13 22:08:01 +00:00
|
|
|
|
|
|
|
// Sanitize string to avoid GL errors.
|
2009-07-19 09:15:00 +00:00
|
|
|
char *s2 = temp_buffer;
|
|
|
|
memcpy(s2, s, length);
|
|
|
|
s2[length] = 0;
|
2009-06-13 22:08:01 +00:00
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
if (s2[i] < 32 || s2[i] > 126)
|
|
|
|
s2[i] = '!';
|
|
|
|
}
|
|
|
|
|
2009-02-28 16:33:59 +00:00
|
|
|
// go to the right spot
|
|
|
|
glRasterPos3d(x, y, z);
|
2009-06-13 22:08:01 +00:00
|
|
|
GL_REPORT_ERRORD();
|
2009-02-28 16:33:59 +00:00
|
|
|
|
|
|
|
glPushAttrib (GL_LIST_BIT);
|
|
|
|
glListBase(fontOffset);
|
2009-06-13 22:08:01 +00:00
|
|
|
glCallLists((GLsizei)strlen(s2), GL_UNSIGNED_BYTE, (GLubyte *) s2);
|
|
|
|
GL_REPORT_ERRORD();
|
|
|
|
glPopAttrib();
|
|
|
|
GL_REPORT_ERRORD();
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z)
|
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
int length = (int)strlen(s);
|
|
|
|
int x = (int)(screen_width/2.0 - (length/2.0)*char_width);
|
|
|
|
printString(s, x, y, z);
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RasterFont::printMultilineText(const char *text, double start_x, double start_y, double z, int bbWidth, int bbHeight)
|
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
double x = start_x;
|
|
|
|
double y = start_y;
|
2009-03-22 11:21:44 +00:00
|
|
|
char temp[1024];
|
2009-02-28 16:33:59 +00:00
|
|
|
char *t = temp;
|
|
|
|
while (*text)
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
if (*text == '\n')
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
*t = 0;
|
|
|
|
printString(temp, x, y, z);
|
|
|
|
y -= char_height * 2.0f / bbHeight;
|
|
|
|
x = start_x;
|
|
|
|
t = temp;
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
2009-02-28 16:33:59 +00:00
|
|
|
else if (*text == '\r')
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
t = temp;
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
2009-02-28 16:33:59 +00:00
|
|
|
else if (*text == '\t')
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
|
|
|
//todo: add tabs every something like 4*char_width
|
2009-02-28 16:33:59 +00:00
|
|
|
*t = 0;
|
2009-01-24 00:45:46 +00:00
|
|
|
int cpos = (int)strlen(temp);
|
2009-02-28 16:33:59 +00:00
|
|
|
int newpos = (cpos + 4) & (~3);
|
|
|
|
printString(temp, x, y, z);
|
|
|
|
x = start_x + (char_width*newpos) * 2.0f / bbWidth;
|
|
|
|
t = temp;
|
|
|
|
*t++ = ' ';
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
|
|
|
else
|
2009-02-28 16:33:59 +00:00
|
|
|
*t++ = *text;
|
2009-04-03 14:35:49 +00:00
|
|
|
|
2008-12-08 05:25:12 +00:00
|
|
|
text++;
|
|
|
|
}
|
2009-02-28 16:33:59 +00:00
|
|
|
|
|
|
|
// ????
|
|
|
|
if (t != text)
|
2008-12-08 05:25:12 +00:00
|
|
|
{
|
2009-02-28 16:33:59 +00:00
|
|
|
*t = 0;
|
|
|
|
printString(temp, x, y, z);
|
2008-12-08 05:25:12 +00:00
|
|
|
}
|
2008-08-24 21:50:41 +00:00
|
|
|
}
|