2 Copyright 2004-2005 Chris Tallon
3 Portions copyright 2004 Jon Gettler
5 This file is part of VOMP.
7 VOMP is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 VOMP is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with VOMP; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 Surface* Surface::screen = NULL;
26 osd_font_t* Surface::font = &font_helvB18;
28 Surface::Surface(int id)
30 if (id == SCREEN) screen = this;
37 Surface* Surface::getScreen()
42 int Surface::drawText(char* text, int x, int y, ULONG rgba)
54 unsigned char c = text[i];
55 unsigned long *character = &font->content[font->offset[c]];
56 int w = font->width[c];
63 if ((character[Y] >> (32 - X)) & 0x1)
65 drawPixel(x+X+cx, y+Y, rgba);
75 int Surface::drawTextRJ(char* text, int x, int y, ULONG rgba)
82 for (i = 0; i < n; i++)
84 w += font->width[text[i]];
90 else return drawText(text, x, y, rgba);
93 int Surface::drawTextCentre(char* text, int x, int y, ULONG rgba)
100 for (i = 0; i < n; i++)
102 w += font->width[text[i]];
108 else return drawText(text, x, y, rgba);
111 int Surface::getCharWidth(char c)
113 return font->width[c];
116 int Surface::getFontHeight()
118 return font->spacing;