XEEN: Fix use of globally constructed object

This commit is contained in:
Paul Gilbert 2018-03-10 07:54:28 -05:00
parent 3bec5a7f9d
commit 5b731a1f44
3 changed files with 9 additions and 4 deletions

View file

@ -27,18 +27,19 @@
namespace Xeen {
const byte *FontData::_fontData;
Common::Point FontData::_writePos;
Common::Point *FontData::_fontWritePos;
byte FontData::_textColors[4];
byte FontData::_bgColor;
bool FontData::_fontReduced;
Justify FontData::_fontJustify;
FontSurface::FontSurface() : XSurface(), _msgWraps(false), _displayString(nullptr) {
FontSurface::FontSurface() : XSurface(), _msgWraps(false), _displayString(nullptr),
_writePos(*FontData::_fontWritePos) {
setTextColor(0);
}
FontSurface::FontSurface(int wv, int hv) : XSurface(wv, hv),
_msgWraps(false), _displayString(nullptr) {
_msgWraps(false), _displayString(nullptr), _writePos(*FontData::_fontWritePos) {
create(w, h);
setTextColor(0);
}

View file

@ -35,7 +35,7 @@ enum Justify { JUSTIFY_NONE = 0, JUSTIFY_CENTER = 1, JUSTIFY_RIGHT = 2 };
struct FontData {
static const byte *_fontData;
static Common::Point _writePos;
static Common::Point *_fontWritePos;
static byte _textColors[4];
static byte _bgColor;
static bool _fontReduced;
@ -76,6 +76,8 @@ private:
* Wrie a character to the surface
*/
void writeChar(char c, const Common::Rect &clipRect);
public:
Common::Point &_writePos;
public:
FontSurface();
FontSurface(int wv, int hv);

View file

@ -31,6 +31,7 @@ Windows::Windows() {
byte *data = new byte[f.size()];
f.read(data, f.size());
_fontData = data;
_fontWritePos = new Common::Point();
Common::fill(&_textColors[0], &_textColors[4], 0);
_bgColor = DEFAULT_BG_COLOR;
@ -87,6 +88,7 @@ Windows::Windows() {
Windows::~Windows() {
delete[] _fontData;
delete _fontWritePos;
}
void Windows::closeAll() {