2009-10-03 20:49:18 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* 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 for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
#ifndef SCI_GRAPHICS_FONT_H
|
|
|
|
#define SCI_GRAPHICS_FONT_H
|
2009-10-04 20:01:21 +00:00
|
|
|
|
2010-01-05 01:37:57 +00:00
|
|
|
#include "sci/graphics/helpers.h"
|
2009-10-04 22:43:30 +00:00
|
|
|
|
2009-10-03 20:49:18 +00:00
|
|
|
namespace Sci {
|
|
|
|
|
2010-04-16 18:23:50 +00:00
|
|
|
class GfxFont {
|
|
|
|
public:
|
2010-07-17 00:05:27 +00:00
|
|
|
GfxFont() {}
|
|
|
|
virtual ~GfxFont() {}
|
|
|
|
|
|
|
|
virtual GuiResourceId getResourceId() { return 0; }
|
|
|
|
virtual byte getHeight() { return 0; }
|
|
|
|
virtual bool isDoubleByte(uint16 chr) { return false; }
|
|
|
|
virtual byte getCharWidth(uint16 chr) { return 0; }
|
|
|
|
virtual void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput) {}
|
2010-04-16 18:23:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-05 15:48:45 +00:00
|
|
|
/**
|
|
|
|
* Font class, handles loading of font resources and drawing characters to screen
|
|
|
|
* every font resource has its own instance of this class
|
|
|
|
*/
|
2010-04-16 18:23:50 +00:00
|
|
|
class GfxFontFromResource : public GfxFont {
|
2009-10-03 20:49:18 +00:00
|
|
|
public:
|
2010-04-16 18:23:50 +00:00
|
|
|
GfxFontFromResource(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId);
|
|
|
|
~GfxFontFromResource();
|
2009-10-03 20:49:18 +00:00
|
|
|
|
2009-10-05 07:10:01 +00:00
|
|
|
GuiResourceId getResourceId();
|
2009-10-03 20:49:18 +00:00
|
|
|
byte getHeight();
|
2010-04-16 18:23:50 +00:00
|
|
|
byte getCharWidth(uint16 chr);
|
|
|
|
void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput);
|
2009-10-03 20:49:18 +00:00
|
|
|
|
|
|
|
private:
|
2010-04-17 15:16:40 +00:00
|
|
|
byte getCharHeight(uint16 chr);
|
2010-04-16 18:23:50 +00:00
|
|
|
byte *getCharData(uint16 chr);
|
|
|
|
|
2009-10-09 12:04:07 +00:00
|
|
|
ResourceManager *_resMan;
|
2010-01-31 16:49:22 +00:00
|
|
|
GfxScreen *_screen;
|
2009-10-09 12:04:07 +00:00
|
|
|
|
|
|
|
Resource *_resource;
|
2009-10-05 07:10:01 +00:00
|
|
|
GuiResourceId _resourceId;
|
2009-10-03 20:49:18 +00:00
|
|
|
byte *_resourceData;
|
|
|
|
|
2009-10-07 23:21:18 +00:00
|
|
|
struct Charinfo {
|
2009-10-03 20:49:18 +00:00
|
|
|
byte w, h;
|
|
|
|
int16 offset;
|
|
|
|
};
|
2009-10-07 23:21:18 +00:00
|
|
|
byte _fontHeight;
|
|
|
|
uint16 _numChars;
|
|
|
|
Charinfo *_chars;
|
2009-10-03 20:49:18 +00:00
|
|
|
};
|
|
|
|
|
2009-10-04 20:01:21 +00:00
|
|
|
} // End of namespace Sci
|
|
|
|
|
|
|
|
#endif
|