2014-02-19 04:43:06 +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.
|
2015-05-09 13:56:27 +00:00
|
|
|
*
|
2014-02-19 04:43:06 +00:00
|
|
|
* 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.
|
2015-05-09 13:56:27 +00:00
|
|
|
*
|
2014-02-19 04:43:06 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MADS_FONT_H
|
|
|
|
#define MADS_FONT_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
2014-03-17 04:00:22 +00:00
|
|
|
#include "common/hashmap.h"
|
2014-02-19 04:43:06 +00:00
|
|
|
#include "common/endian.h"
|
2014-03-17 04:00:22 +00:00
|
|
|
#include "common/util.h"
|
2014-02-19 04:43:06 +00:00
|
|
|
#include "mads/msurface.h"
|
|
|
|
|
|
|
|
namespace MADS {
|
|
|
|
|
2014-02-22 17:17:37 +00:00
|
|
|
#define FONT_CONVERSATION "*FONTCONV.FF"
|
|
|
|
#define FONT_INTERFACE "*FONTINTR.FF"
|
|
|
|
#define FONT_MAIN "*FONTMAIN.FF"
|
|
|
|
#define FONT_MENU "*FONTMENU.FF" // Not in Rex (uses bitmap files for menu strings)
|
|
|
|
#define FONT_MISC "*FONTMISC.FF"
|
|
|
|
#define FONT_TELE "*FONTTELE.FF" // Not in Phantom
|
|
|
|
#define FONT_PHAN "*FONTPHAN.FF" // Phantom only
|
2014-02-19 04:43:06 +00:00
|
|
|
|
2014-05-08 08:43:23 +00:00
|
|
|
enum SelectionMode {
|
|
|
|
SELMODE_UNSELECTED = 0, SELMODE_HIGHLIGHTED = 1, SELMODE_SELECTED = 2
|
2014-03-25 12:55:29 +00:00
|
|
|
};
|
|
|
|
|
2014-02-19 04:43:06 +00:00
|
|
|
class MADSEngine;
|
|
|
|
|
|
|
|
class Font {
|
2014-03-17 03:40:21 +00:00
|
|
|
private:
|
|
|
|
static uint8 _fontColors[4];
|
|
|
|
static MADSEngine *_vm;
|
2014-03-17 04:00:22 +00:00
|
|
|
static Common::HashMap<Common::String, Font *> *_fonts;
|
2014-03-17 03:40:21 +00:00
|
|
|
public:
|
|
|
|
/**
|
2014-05-26 22:58:25 +00:00
|
|
|
* Initialize the font system
|
2014-03-17 03:40:21 +00:00
|
|
|
*/
|
|
|
|
static void init(MADSEngine *vm);
|
2014-02-19 04:43:06 +00:00
|
|
|
|
2014-03-17 04:00:22 +00:00
|
|
|
/**
|
|
|
|
* Free up the resources used by the font
|
|
|
|
*/
|
|
|
|
static void deinit();
|
|
|
|
|
2014-03-17 03:40:21 +00:00
|
|
|
/**
|
|
|
|
* Returns a new Font instance using the specified font name
|
|
|
|
*/
|
|
|
|
static Font *getFont(const Common::String &fontName);
|
2014-03-17 04:00:22 +00:00
|
|
|
private:
|
2014-02-19 04:43:06 +00:00
|
|
|
uint8 _maxWidth, _maxHeight;
|
|
|
|
uint8 *_charWidths;
|
|
|
|
uint16 *_charOffs;
|
|
|
|
uint8 *_charData;
|
|
|
|
Common::String _filename;
|
|
|
|
|
2014-02-22 05:24:39 +00:00
|
|
|
int getBpp(int charWidth);
|
2014-03-17 04:00:22 +00:00
|
|
|
|
|
|
|
void setFont(const Common::String &filename);
|
2014-02-19 04:43:06 +00:00
|
|
|
public:
|
2014-03-17 03:40:21 +00:00
|
|
|
Font();
|
2014-03-17 04:00:22 +00:00
|
|
|
Font(const Common::String &filename);
|
2014-02-19 04:43:06 +00:00
|
|
|
virtual ~Font();
|
|
|
|
|
2014-02-22 05:24:39 +00:00
|
|
|
void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4);
|
2014-03-25 12:55:29 +00:00
|
|
|
void setColorMode(SelectionMode mode);
|
2014-02-19 04:43:06 +00:00
|
|
|
|
2014-02-22 05:24:39 +00:00
|
|
|
int maxWidth() const { return _maxWidth; }
|
2014-02-19 04:43:06 +00:00
|
|
|
int getWidth(const Common::String &msg, int spaceWidth = -1);
|
|
|
|
int getHeight() const { return _maxHeight; }
|
2014-03-17 03:40:21 +00:00
|
|
|
int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt,
|
|
|
|
int spaceWidth = 0, int width = 0);
|
2014-02-19 04:43:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace MADS
|
|
|
|
|
|
|
|
#endif /* MADS_FONT_H */
|