aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sword25/gfx/bitmap.cpp36
-rw-r--r--engines/sword25/gfx/bitmap.h8
-rw-r--r--engines/sword25/gfx/bitmapresource.cpp5
-rw-r--r--engines/sword25/gfx/bitmapresource.h5
-rw-r--r--engines/sword25/gfx/dynamicbitmap.cpp38
-rw-r--r--engines/sword25/gfx/dynamicbitmap.h25
-rw-r--r--engines/sword25/gfx/fontresource.cpp44
-rw-r--r--engines/sword25/gfx/fontresource.h46
-rw-r--r--engines/sword25/gfx/graphicengine.cpp4
-rw-r--r--engines/sword25/gfx/graphicengine_script.cpp16
-rw-r--r--engines/sword25/gfx/panel.cpp24
-rw-r--r--engines/sword25/gfx/panel.h12
-rw-r--r--engines/sword25/gfx/renderobject.cpp47
-rw-r--r--engines/sword25/gfx/renderobject.h15
-rw-r--r--engines/sword25/gfx/renderobjectmanager.h2
-rw-r--r--engines/sword25/gfx/renderobjectregistry.h12
-rw-r--r--engines/sword25/gfx/screenshot.cpp55
-rw-r--r--engines/sword25/gfx/screenshot.h12
-rw-r--r--engines/sword25/gfx/staticbitmap.cpp36
-rw-r--r--engines/sword25/gfx/staticbitmap.h24
-rw-r--r--engines/sword25/gfx/text.cpp322
-rw-r--r--engines/sword25/gfx/text.h74
-rw-r--r--engines/sword25/gfx/timedrenderobject.h8
23 files changed, 270 insertions, 600 deletions
diff --git a/engines/sword25/gfx/bitmap.cpp b/engines/sword25/gfx/bitmap.cpp
index db48b2d6fa..b5412c8276 100644
--- a/engines/sword25/gfx/bitmap.cpp
+++ b/engines/sword25/gfx/bitmap.cpp
@@ -32,26 +32,14 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/gfx/bitmap.h"
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Logging
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "BITMAP"
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
Bitmap::Bitmap(RenderObjectPtr<RenderObject> parentPtr, TYPES type, uint handle) :
RenderObject(parentPtr, type, handle),
_modulationColor(0xffffffff),
@@ -61,15 +49,9 @@ Bitmap::Bitmap(RenderObjectPtr<RenderObject> parentPtr, TYPES type, uint handle)
_flipV(false) {
}
-// -----------------------------------------------------------------------------
-
Bitmap::~Bitmap() {
}
-// -----------------------------------------------------------------------------
-// Darstellungsart festlegen
-// -----------------------------------------------------------------------------
-
void Bitmap::setAlpha(int alpha) {
if (!isAlphaAllowed()) {
BS_LOG_WARNINGLN("Tried to set alpha value on a bitmap that does not support alpha blending. Call was ignored.");
@@ -94,8 +76,6 @@ void Bitmap::setAlpha(int alpha) {
}
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setModulationColor(uint modulationColor) {
if (!isColorModulationAllowed()) {
BS_LOG_WARNINGLN("Tried to set modulation color of a bitmap that does not support color modulation. Call was ignored.");
@@ -109,15 +89,11 @@ void Bitmap::setModulationColor(uint modulationColor) {
}
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setScaleFactor(float scaleFactor) {
setScaleFactorX(scaleFactor);
setScaleFactorY(scaleFactor);
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setScaleFactorX(float scaleFactorX) {
if (!isScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored.");
@@ -140,8 +116,6 @@ void Bitmap::setScaleFactorX(float scaleFactorX) {
}
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setScaleFactorY(float scaleFactorY) {
if (!isScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored.");
@@ -164,24 +138,16 @@ void Bitmap::setScaleFactorY(float scaleFactorY) {
}
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setFlipH(bool flipH) {
_flipH = flipH;
forceRefresh();
}
-// -----------------------------------------------------------------------------
-
void Bitmap::setFlipV(bool flipV) {
_flipV = flipV;
forceRefresh();
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool Bitmap::persist(OutputPersistenceBlock &writer) {
bool result = true;
@@ -197,8 +163,6 @@ bool Bitmap::persist(OutputPersistenceBlock &writer) {
return result;
}
-// -----------------------------------------------------------------------------
-
bool Bitmap::unpersist(InputPersistenceBlock &reader) {
bool result = true;
diff --git a/engines/sword25/gfx/bitmap.h b/engines/sword25/gfx/bitmap.h
index a00baf37a4..741269c423 100644
--- a/engines/sword25/gfx/bitmap.h
+++ b/engines/sword25/gfx/bitmap.h
@@ -35,19 +35,11 @@
#ifndef SWORD25_BITMAP_H
#define SWORD25_BITMAP_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/gfx/renderobject.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Klassendeklaration
-// -----------------------------------------------------------------------------
-
class Bitmap : public RenderObject {
protected:
Bitmap(RenderObjectPtr<RenderObject> parentPtr, TYPES type, uint handle = 0);
diff --git a/engines/sword25/gfx/bitmapresource.cpp b/engines/sword25/gfx/bitmapresource.cpp
index 46e6ca77ce..1dde736621 100644
--- a/engines/sword25/gfx/bitmapresource.cpp
+++ b/engines/sword25/gfx/bitmapresource.cpp
@@ -42,9 +42,6 @@ namespace Sword25 {
#define BS_LOG_PREFIX "BITMAP"
-// Konstruktion / Destruktion
-// --------------------------
-
BitmapResource::BitmapResource(const Common::String &filename, Image *pImage) :
_valid(false),
_pImage(pImage),
@@ -56,8 +53,6 @@ BitmapResource::~BitmapResource() {
delete _pImage;
}
-// -----------------------------------------------------------------------------
-
uint BitmapResource::getPixel(int x, int y) const {
BS_ASSERT(x >= 0 && x < _pImage->getWidth());
BS_ASSERT(y >= 0 && y < _pImage->getHeight());
diff --git a/engines/sword25/gfx/bitmapresource.h b/engines/sword25/gfx/bitmapresource.h
index 1054770e79..37849f918e 100644
--- a/engines/sword25/gfx/bitmapresource.h
+++ b/engines/sword25/gfx/bitmapresource.h
@@ -35,7 +35,6 @@
#ifndef SWORD25_BITMAP_RESOURCE_H
#define SWORD25_BITMAP_RESOURCE_H
-// Includes
#include "sword25/kernel/common.h"
#include "sword25/kernel/resource.h"
#include "sword25/gfx/image/image.h"
@@ -204,8 +203,8 @@ public:
}
private:
- Image *_pImage;
- bool _valid;
+ Image *_pImage;
+ bool _valid;
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp
index 47ff68b932..2766294d48 100644
--- a/engines/sword25/gfx/dynamicbitmap.cpp
+++ b/engines/sword25/gfx/dynamicbitmap.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/gfx/dynamicbitmap.h"
#include "sword25/gfx/bitmapresource.h"
#include "sword25/package/packagemanager.h"
@@ -43,16 +39,8 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Logging
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "DYNAMICBITMAP"
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
DynamicBitmap::DynamicBitmap(RenderObjectPtr<RenderObject> parentPtr, uint width, uint height) :
Bitmap(parentPtr, TYPE_DYNAMICBITMAP) {
// Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
@@ -61,15 +49,11 @@ DynamicBitmap::DynamicBitmap(RenderObjectPtr<RenderObject> parentPtr, uint width
_initSuccess = createRenderedImage(width, height);
}
-// -----------------------------------------------------------------------------
-
DynamicBitmap::DynamicBitmap(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle) :
Bitmap(parentPtr, TYPE_DYNAMICBITMAP, handle) {
_initSuccess = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::createRenderedImage(uint width, uint height) {
// RenderedImage mit den gewünschten Maßen erstellen
bool result = false;
@@ -81,13 +65,9 @@ bool DynamicBitmap::createRenderedImage(uint width, uint height) {
return result;
}
-// -----------------------------------------------------------------------------
-
DynamicBitmap::~DynamicBitmap() {
}
-// -----------------------------------------------------------------------------
-
uint DynamicBitmap::getPixel(int x, int y) const {
BS_ASSERT(x >= 0 && x < _width);
BS_ASSERT(y >= 0 && y < _height);
@@ -95,8 +75,6 @@ uint DynamicBitmap::getPixel(int x, int y) const {
return _image->getPixel(x, y);
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::doRender() {
// Framebufferobjekt holen
GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
@@ -119,42 +97,26 @@ bool DynamicBitmap::doRender() {
return result;
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::setContent(const byte *pixeldata, uint size, uint offset, uint stride) {
return _image->setContent(pixeldata, size, offset, stride);
}
-// -----------------------------------------------------------------------------
-// Auskunftsmethoden
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::isScalingAllowed() const {
return _image->isScalingAllowed();
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::isAlphaAllowed() const {
return _image->isAlphaAllowed();
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::isColorModulationAllowed() const {
return _image->isColorModulationAllowed();
}
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::isSetContentAllowed() const {
return true;
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool DynamicBitmap::persist(OutputPersistenceBlock &writer) {
bool result = true;
diff --git a/engines/sword25/gfx/dynamicbitmap.h b/engines/sword25/gfx/dynamicbitmap.h
index a02769fb57..1737bdf5fc 100644
--- a/engines/sword25/gfx/dynamicbitmap.h
+++ b/engines/sword25/gfx/dynamicbitmap.h
@@ -35,11 +35,6 @@
#ifndef SWORD25_DYNAMIC_BITMAP_H
#define SWORD25_DYNAMIC_BITMAP_H
-
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/gfx/bitmap.h"
#include "sword25/gfx/image/renderedimage.h"
@@ -48,10 +43,6 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Klassendeklaration
-// -----------------------------------------------------------------------------
-
class DynamicBitmap : public Bitmap {
friend class RenderObject;
@@ -60,18 +51,18 @@ public:
virtual uint getPixel(int x, int y) const;
- virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride);
+ virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride);
- virtual bool isScalingAllowed() const;
- virtual bool isAlphaAllowed() const;
- virtual bool isColorModulationAllowed() const;
- virtual bool isSetContentAllowed() const;
+ virtual bool isScalingAllowed() const;
+ virtual bool isAlphaAllowed() const;
+ virtual bool isColorModulationAllowed() const;
+ virtual bool isSetContentAllowed() const;
- virtual bool persist(OutputPersistenceBlock &writer);
- virtual bool unpersist(InputPersistenceBlock &reader);
+ virtual bool persist(OutputPersistenceBlock &writer);
+ virtual bool unpersist(InputPersistenceBlock &reader);
protected:
- virtual bool doRender();
+ virtual bool doRender();
private:
DynamicBitmap(RenderObjectPtr<RenderObject> parentPtr, uint width, uint height);
diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp
index cdece041db..45acb9f045 100644
--- a/engines/sword25/gfx/fontresource.cpp
+++ b/engines/sword25/gfx/fontresource.cpp
@@ -34,10 +34,6 @@
#define BS_LOG_PREFIX "FONTRESOURCE"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/string.h"
#include "sword25/package/packagemanager.h"
@@ -46,23 +42,15 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Constants
-// -----------------------------------------------------------------------------
-
enum {
DEFAULT_LINEHEIGHT = 20,
DEFAULT_GAPWIDTH = 1
};
-// -----------------------------------------------------------------------------
-// Constructor / destructor
-// -----------------------------------------------------------------------------
-
-FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) :
+FontResource::FontResource(Kernel *pKernel, const Common::String &fileName) :
_pKernel(pKernel),
- _Valid(false),
- Resource(FileName, Resource::TYPE_FONT),
+ _valid(false),
+ Resource(fileName, Resource::TYPE_FONT),
Common::XMLParser() {
// Get a pointer to the package manager
@@ -82,27 +70,25 @@ FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) :
if (!loadBuffer((const byte *)xmlData, fileSize))
return;
- _Valid = parse();
+ _valid = parse();
close();
free(xmlData);
}
-// -----------------------------------------------------------------------------
-
bool FontResource::parserCallback_font(ParserNode *node) {
// Get the attributes of the font
Common::String bitmapFilename = node->values["bitmap"];
- if (!parseIntegerKey(node->values["lineheight"], 1, &_LineHeight)) {
+ if (!parseIntegerKey(node->values["lineheight"], 1, &_lineHeight)) {
BS_LOG_WARNINGLN("Illegal or missing lineheight attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
getFileName().c_str(), DEFAULT_LINEHEIGHT);
- _LineHeight = DEFAULT_LINEHEIGHT;
+ _lineHeight = DEFAULT_LINEHEIGHT;
}
- if (!parseIntegerKey(node->values["gap"], 1, &_GapWidth)) {
+ if (!parseIntegerKey(node->values["gap"], 1, &_gapWidth)) {
BS_LOG_WARNINGLN("Illegal or missing gap attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
getFileName().c_str(), DEFAULT_GAPWIDTH);
- _GapWidth = DEFAULT_GAPWIDTH;
+ _gapWidth = DEFAULT_GAPWIDTH;
}
// Get a reference to the package manager
@@ -111,22 +97,20 @@ bool FontResource::parserCallback_font(ParserNode *node) {
BS_ASSERT(pPackage);
// Get the full path and filename for the bitmap resource
- _BitmapFileName = pPackage->getAbsolutePath(bitmapFilename);
- if (_BitmapFileName == "") {
+ _bitmapFileName = pPackage->getAbsolutePath(bitmapFilename);
+ if (_bitmapFileName == "") {
BS_LOG_ERRORLN("Image file \"%s\" was specified in <font> tag of \"%s\" but could not be found.",
- _BitmapFileName.c_str(), getFileName().c_str());
+ _bitmapFileName.c_str(), getFileName().c_str());
}
// Pre-cache the resource
- if (!_pKernel->GetResourceManager()->PrecacheResource(_BitmapFileName)) {
- BS_LOG_ERRORLN("Could not precache \"%s\".", _BitmapFileName.c_str());
+ if (!_pKernel->GetResourceManager()->PrecacheResource(_bitmapFileName)) {
+ BS_LOG_ERRORLN("Could not precache \"%s\".", _bitmapFileName.c_str());
}
return true;
}
-// -----------------------------------------------------------------------------
-
bool FontResource::parserCallback_character(ParserNode *node) {
// Get the attributes of the character
int charCode, top, left, right, bottom;
@@ -148,7 +132,7 @@ bool FontResource::parserCallback_character(ParserNode *node) {
return parserError("Illegal or missing bottom attribute in <character> tag in \"%s\".", getFileName().c_str());
}
- this->_CharacterRects[charCode] = Common::Rect(left, top, right, bottom);
+ this->_characterRects[charCode] = Common::Rect(left, top, right, bottom);
return true;
}
diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h
index 7ae2cd2c6b..19c44d0ade 100644
--- a/engines/sword25/gfx/fontresource.h
+++ b/engines/sword25/gfx/fontresource.h
@@ -35,10 +35,6 @@
#ifndef SWORD25_FONTRESOURCE_H
#define SWORD25_FONTRESOURCE_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/scummsys.h"
#include "common/rect.h"
#include "common/xmlparser.h"
@@ -47,16 +43,8 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward declarations
-// -----------------------------------------------------------------------------
-
class Kernel;
-// -----------------------------------------------------------------------------
-// Class definition
-// -----------------------------------------------------------------------------
-
class FontResource : public Resource, Common::XMLParser {
public:
/**
@@ -65,15 +53,15 @@ public:
@param FileName der Dateiname der zu ladenen Resource
@remark Wenn der Konstruktor erfolgreich ausgeführt werden konnte gibt die Methode IsValid true zurück.
*/
- FontResource(Kernel *pKernel, const Common::String &FileName);
+ FontResource(Kernel *pKernel, const Common::String &fileName);
/**
@brief Gibt true zurück, wenn das Objekt korrekt initialisiert wurde.
Diese Methode kann dazu benutzt werden um festzustellen, ob der Konstruktor erfolgreich ausgeführt wurde.
*/
- bool IsValid() const {
- return _Valid;
+ bool isValid() const {
+ return _valid;
}
/**
@@ -81,8 +69,8 @@ public:
Die Zeilenhöhe ist der Wert, der zur Y-Koordinate addiert wird, wenn ein Zeilenumbruch auftritt.
*/
- int GetLineHeight() const {
- return _LineHeight;
+ int getLineHeight() const {
+ return _lineHeight;
}
/**
@@ -90,8 +78,8 @@ public:
Der Buchstabenabstand ist der Wert, der zwischen zwei Buchstaben freigelassen wird.
*/
- int GetGapWidth() const {
- return _GapWidth;
+ int getGapWidth() const {
+ return _gapWidth;
}
/**
@@ -99,25 +87,25 @@ public:
@param Character der ASCII-Code des Zeichens
@return Das Bounding-Rect des übergebenen Zeichens auf der Charactermap.
*/
- const Common::Rect &GetCharacterRect(int Character) const {
- BS_ASSERT(Character >= 0 && Character < 256);
- return _CharacterRects[Character];
+ const Common::Rect &getCharacterRect(int character) const {
+ BS_ASSERT(character >= 0 && character < 256);
+ return _characterRects[character];
}
/**
@brief Gibt den Dateinamen der Charactermap zurück.
*/
- const Common::String &GetCharactermapFileName() const {
- return _BitmapFileName;
+ const Common::String &getCharactermapFileName() const {
+ return _bitmapFileName;
}
private:
Kernel *_pKernel;
- bool _Valid;
- Common::String _BitmapFileName;
- int _LineHeight;
- int _GapWidth;
- Common::Rect _CharacterRects[256];
+ bool _valid;
+ Common::String _bitmapFileName;
+ int _lineHeight;
+ int _gapWidth;
+ Common::Rect _characterRects[256];
// Parser
CUSTOM_XML_PARSER(FontResource) {
diff --git a/engines/sword25/gfx/graphicengine.cpp b/engines/sword25/gfx/graphicengine.cpp
index 0a8638a5ec..e16876ddba 100644
--- a/engines/sword25/gfx/graphicengine.cpp
+++ b/engines/sword25/gfx/graphicengine.cpp
@@ -350,7 +350,7 @@ Resource *GraphicEngine::loadResource(const Common::String &filename) {
// Load font
if (filename.hasSuffix("_fnt.xml")) {
FontResource *pResource = new FontResource(Kernel::GetInstance(), filename);
- if (pResource->IsValid())
+ if (pResource->isValid())
return pResource;
else {
delete pResource;
@@ -418,7 +418,7 @@ bool doSaveScreenshot(GraphicEngine &graphicEngine, const Common::String &filena
return false;
}
- bool result = Screenshot::SaveToFile(data, stream);
+ bool result = Screenshot::saveToFile(data, stream);
delete stream;
return result;
diff --git a/engines/sword25/gfx/graphicengine_script.cpp b/engines/sword25/gfx/graphicengine_script.cpp
index e197a40337..97359252db 100644
--- a/engines/sword25/gfx/graphicengine_script.cpp
+++ b/engines/sword25/gfx/graphicengine_script.cpp
@@ -1162,14 +1162,14 @@ static RenderObjectPtr<Text> checkText(lua_State *L) {
static int t_setFont(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- textPtr->SetFont(luaL_checkstring(L, 2));
+ textPtr->setFont(luaL_checkstring(L, 2));
return 0;
}
static int t_setText(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- textPtr->SetText(luaL_checkstring(L, 2));
+ textPtr->setText(luaL_checkstring(L, 2));
return 0;
}
@@ -1190,28 +1190,28 @@ static int t_setColor(lua_State *L) {
static int t_setAutoWrap(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- textPtr->SetAutoWrap(lua_tobooleancpp(L, 2));
+ textPtr->setAutoWrap(lua_tobooleancpp(L, 2));
return 0;
}
static int t_setAutoWrapThreshold(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- textPtr->SetAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
+ textPtr->setAutoWrapThreshold(static_cast<uint>(luaL_checknumber(L, 2)));
return 0;
}
static int t_getText(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- lua_pushstring(L, textPtr->GetText().c_str());
+ lua_pushstring(L, textPtr->getText().c_str());
return 1;
}
static int t_getFont(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- lua_pushstring(L, textPtr->GetFont().c_str());
+ lua_pushstring(L, textPtr->getFont().c_str());
return 1;
}
@@ -1232,14 +1232,14 @@ static int t_getColor(lua_State *L) {
static int t_isAutoWrap(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- lua_pushbooleancpp(L, textPtr->IsAutoWrapActive());
+ lua_pushbooleancpp(L, textPtr->isAutoWrapActive());
return 1;
}
static int t_getAutoWrapThreshold(lua_State *L) {
RenderObjectPtr<Text> textPtr = checkText(L);
BS_ASSERT(textPtr.isValid());
- lua_pushnumber(L, textPtr->GetAutoWrapThreshold());
+ lua_pushnumber(L, textPtr->getAutoWrapThreshold());
return 1;
}
diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp
index 888f6f7468..1e2921fd56 100644
--- a/engines/sword25/gfx/panel.cpp
+++ b/engines/sword25/gfx/panel.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/gfx/panel.h"
#include "sword25/kernel/inputpersistenceblock.h"
@@ -45,14 +41,8 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "PANEL"
-// -----------------------------------------------------------------------------
-// Construction/Destruction
-// -----------------------------------------------------------------------------
-
Panel::Panel(RenderObjectPtr<RenderObject> parentPtr, int width, int height, uint color) :
RenderObject(parentPtr, RenderObject::TYPE_PANEL),
_color(color) {
@@ -74,22 +64,14 @@ Panel::Panel(RenderObjectPtr<RenderObject> parentPtr, int width, int height, uin
_initSuccess = true;
}
-// -----------------------------------------------------------------------------
-
Panel::Panel(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle) :
RenderObject(parentPtr, RenderObject::TYPE_PANEL, handle) {
_initSuccess = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
Panel::~Panel() {
}
-// -----------------------------------------------------------------------------
-// Rendern
-// -----------------------------------------------------------------------------
-
bool Panel::doRender() {
// Falls der Alphawert 0 ist, ist das Panel komplett durchsichtig und es muss nichts gezeichnet werden.
if (_color >> 24 == 0)
@@ -101,10 +83,6 @@ bool Panel::doRender() {
return gfxPtr->fill(&_bbox, _color);
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool Panel::persist(OutputPersistenceBlock &writer) {
bool result = true;
@@ -116,8 +94,6 @@ bool Panel::persist(OutputPersistenceBlock &writer) {
return result;
}
-// -----------------------------------------------------------------------------
-
bool Panel::unpersist(InputPersistenceBlock &reader) {
bool result = true;
diff --git a/engines/sword25/gfx/panel.h b/engines/sword25/gfx/panel.h
index 5fbcec5f34..6fe96369a6 100644
--- a/engines/sword25/gfx/panel.h
+++ b/engines/sword25/gfx/panel.h
@@ -35,19 +35,11 @@
#ifndef SWORD25_PANEL_H
#define SWORD25_PANEL_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/gfx/renderobject.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Class Definition
-// -----------------------------------------------------------------------------
-
class Panel : public RenderObject {
friend class RenderObject;
@@ -58,10 +50,10 @@ private:
public:
virtual ~Panel();
- uint getColor() const {
+ uint getColor() const {
return _color;
}
- void setColor(uint color) {
+ void setColor(uint color) {
_color = color;
forceRefresh();
}
diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp
index ae8fc8cba1..77af0bee92 100644
--- a/engines/sword25/gfx/renderobject.cpp
+++ b/engines/sword25/gfx/renderobject.cpp
@@ -53,8 +53,6 @@ namespace Sword25 {
#define BS_LOG_PREFIX "RENDEROBJECT"
-// Konstruktion / Destruktion
-// --------------------------
RenderObject::RenderObject(RenderObjectPtr<RenderObject> parentPtr, TYPES type, uint handle) :
_managerPtr(0),
_parentPtr(parentPtr),
@@ -113,8 +111,6 @@ RenderObject::~RenderObject() {
RenderObjectRegistry::instance().deregisterObject(this);
}
-// Rendern
-// -------
bool RenderObject::render() {
// Objektänderungen validieren
validateObject();
@@ -141,9 +137,6 @@ bool RenderObject::render() {
return true;
}
-// Objektverwaltung
-// ----------------
-
void RenderObject::validateObject() {
// Die Veränderungen in den Objektvariablen aufheben
_oldBbox = _bbox;
@@ -222,9 +215,6 @@ int RenderObject::calcAbsoluteY() const {
return _y;
}
-// Baumverwaltung
-// --------------
-
void RenderObject::deleteAllChildren() {
// Es ist nicht notwendig die Liste zu iterieren, da jedes Kind für sich DetatchChildren an diesem Objekt aufruft und sich somit
// selber entfernt. Daher muss immer nur ein beliebiges Element (hier das letzte) gelöscht werden, bis die Liste leer ist.
@@ -275,17 +265,12 @@ void RenderObject::updateAbsolutePos() {
(*it)->updateAbsolutePos();
}
-// Get-Methoden
-// ------------
-
bool RenderObject::getObjectIntersection(RenderObjectPtr<RenderObject> pObject, Common::Rect &result) {
result = pObject->getBbox();
result.clip(_bbox);
return result.isValidRect();
}
-// Set-Methoden
-// ------------
void RenderObject::setPos(int x, int y) {
_x = x;
_y = y;
@@ -313,10 +298,6 @@ void RenderObject::setVisible(bool visible) {
_visible = visible;
}
-// -----------------------------------------------------------------------------
-// Objekterzeuger
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Animation> RenderObject::addAnimation(const Common::String &filename) {
RenderObjectPtr<Animation> aniPtr((new Animation(this->getHandle(), filename))->getHandle());
if (aniPtr.isValid() && aniPtr->getInitSuccess())
@@ -328,9 +309,6 @@ RenderObjectPtr<Animation> RenderObject::addAnimation(const Common::String &file
}
}
-
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Animation> RenderObject::addAnimation(const AnimationTemplate &animationTemplate) {
Animation *aniPtr = new Animation(this->getHandle(), animationTemplate);
if (aniPtr && aniPtr->getInitSuccess())
@@ -341,8 +319,6 @@ RenderObjectPtr<Animation> RenderObject::addAnimation(const AnimationTemplate &a
}
}
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Bitmap> RenderObject::addBitmap(const Common::String &filename) {
RenderObjectPtr<Bitmap> bitmapPtr((new StaticBitmap(this->getHandle(), filename))->getHandle());
if (bitmapPtr.isValid() && bitmapPtr->getInitSuccess())
@@ -354,8 +330,6 @@ RenderObjectPtr<Bitmap> RenderObject::addBitmap(const Common::String &filename)
}
}
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Bitmap> RenderObject::addDynamicBitmap(uint width, uint height) {
RenderObjectPtr<Bitmap> bitmapPtr((new DynamicBitmap(this->getHandle(), width, height))->getHandle());
if (bitmapPtr.isValid() && bitmapPtr->getInitSuccess())
@@ -367,8 +341,6 @@ RenderObjectPtr<Bitmap> RenderObject::addDynamicBitmap(uint width, uint height)
}
}
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Panel> RenderObject::addPanel(int width, int height, uint color) {
RenderObjectPtr<Panel> panelPtr((new Panel(this->getHandle(), width, height, color))->getHandle());
if (panelPtr.isValid() && panelPtr->getInitSuccess())
@@ -380,12 +352,10 @@ RenderObjectPtr<Panel> RenderObject::addPanel(int width, int height, uint color)
}
}
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<Text> RenderObject::addText(const Common::String &font, const Common::String &text) {
RenderObjectPtr<Text> textPtr((new Text(this->getHandle()))->getHandle());
- if (textPtr.isValid() && textPtr->getInitSuccess() && textPtr->SetFont(font)) {
- textPtr->SetText(text);
+ if (textPtr.isValid() && textPtr->getInitSuccess() && textPtr->setFont(font)) {
+ textPtr->setText(text);
return textPtr;
} else {
if (textPtr.isValid())
@@ -394,9 +364,6 @@ RenderObjectPtr<Text> RenderObject::addText(const Common::String &font, const Co
}
}
-// Persistenz-Methoden
-// -------------------
-
bool RenderObject::persist(OutputPersistenceBlock &writer) {
// Typ und Handle werden als erstes gespeichert, damit beim Laden ein Objekt vom richtigen Typ mit dem richtigen Handle erzeugt werden kann.
writer.write(static_cast<uint>(_type));
@@ -431,8 +398,6 @@ bool RenderObject::persist(OutputPersistenceBlock &writer) {
return true;
}
-// -----------------------------------------------------------------------------
-
bool RenderObject::unpersist(InputPersistenceBlock &reader) {
// Typ und Handle wurden schon von RecreatePersistedRenderObject() ausgelesen. Jetzt werden die restlichen Objekteigenschaften ausgelesen.
reader.read(_x);
@@ -468,8 +433,6 @@ bool RenderObject::unpersist(InputPersistenceBlock &reader) {
return reader.isGood();
}
-// -----------------------------------------------------------------------------
-
bool RenderObject::persistChildren(OutputPersistenceBlock &writer) {
bool result = true;
@@ -486,8 +449,6 @@ bool RenderObject::persistChildren(OutputPersistenceBlock &writer) {
return result;
}
-// -----------------------------------------------------------------------------
-
bool RenderObject::unpersistChildren(InputPersistenceBlock &reader) {
bool result = true;
@@ -506,8 +467,6 @@ bool RenderObject::unpersistChildren(InputPersistenceBlock &reader) {
return result && reader.isGood();
}
-// -----------------------------------------------------------------------------
-
RenderObjectPtr<RenderObject> RenderObject::recreatePersistedRenderObject(InputPersistenceBlock &reader) {
RenderObjectPtr<RenderObject> result;
@@ -547,8 +506,6 @@ RenderObjectPtr<RenderObject> RenderObject::recreatePersistedRenderObject(InputP
return result;
}
-// Hilfs-Methoden
-// --------------
bool RenderObject::greater(const RenderObjectPtr<RenderObject> lhs, const RenderObjectPtr<RenderObject> rhs) {
// Das Objekt mit dem kleinem Z-Wert müssen zuerst gerendert werden.
if (lhs->_z != rhs->_z)
diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h
index 9d11c46b80..7b7b9047f7 100644
--- a/engines/sword25/gfx/renderobject.h
+++ b/engines/sword25/gfx/renderobject.h
@@ -45,7 +45,6 @@
#ifndef SWORD25_RENDEROBJECT_H
#define SWORD25_RENDEROBJECT_H
-// Includes
#include "sword25/kernel/common.h"
#include "sword25/kernel/persistable.h"
#include "common/rect.h"
@@ -55,10 +54,6 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward Declarations
-// -----------------------------------------------------------------------------
-
class Kernel;
class RenderObjectManager;
class Bitmap;
@@ -462,11 +457,11 @@ private:
@param pObject ein Pointer auf das zu entfernende Objekt
@return Gibt false zurück, falls das zu entfernende Objekt nicht in der Liste gefunden werden konnte.
*/
- bool detatchChildren(RenderObjectPtr<RenderObject> pObject);
+ bool detatchChildren(RenderObjectPtr<RenderObject> pObject);
/**
@brief Berechnet die Bounding-Box und registriert das Dirty-Rect beim BS_RenderObjectManager.
*/
- void updateBoxes();
+ void updateBoxes();
/**
@brief Berechnet die Bounding-Box des Objektes.
@return Gibt die Bounding-Box des Objektes in Bildschirmkoordinaten zurück.
@@ -496,7 +491,7 @@ private:
/**
@brief Validiert den Zustand eines Objektes nachdem die durch die Veränderung verursachten Folgen abgearbeitet wurden.
*/
- void validateObject();
+ void validateObject();
/**
@brief Berechnet die absolute Position des Objektes und aller seiner Kinderobjekte neu.
@@ -508,7 +503,7 @@ private:
@brief Teilt dem Objekt mit, dass sich eines seiner Kinderobjekte dahingehend verändert hat, die eine erneute Bestimmung der
Rendereihenfolge verlangt.
*/
- void signalChildChange() {
+ void signalChildChange() {
_childChanged = true;
}
/**
@@ -517,7 +512,7 @@ private:
@param Result das Ergebnisrechteck
@return Gibt false zurück, falls sich die Objekte gar nicht schneiden.
*/
- bool getObjectIntersection(RenderObjectPtr<RenderObject> pObject, Common::Rect &result);
+ bool getObjectIntersection(RenderObjectPtr<RenderObject> pObject, Common::Rect &result);
/**
@brief Vergleichsoperator der auf Objektpointern basiert statt auf Objekten.
@remark Diese Methode wird fürs Sortieren der Kinderliste nach der Rendereihenfolge benutzt.
diff --git a/engines/sword25/gfx/renderobjectmanager.h b/engines/sword25/gfx/renderobjectmanager.h
index 05bba37cd0..8511382d6e 100644
--- a/engines/sword25/gfx/renderobjectmanager.h
+++ b/engines/sword25/gfx/renderobjectmanager.h
@@ -45,7 +45,6 @@
#ifndef SWORD25_RENDEROBJECTMANAGER_H
#define SWORD25_RENDEROBJECTMANAGER_H
-// Includes
#include "common/rect.h"
#include "sword25/kernel/common.h"
#include "sword25/gfx/renderobjectptr.h"
@@ -53,7 +52,6 @@
namespace Sword25 {
-// Klassendefinition
class Kernel;
class RenderObject;
class TimedRenderObject;
diff --git a/engines/sword25/gfx/renderobjectregistry.h b/engines/sword25/gfx/renderobjectregistry.h
index ff5d8997ec..357d041068 100644
--- a/engines/sword25/gfx/renderobjectregistry.h
+++ b/engines/sword25/gfx/renderobjectregistry.h
@@ -35,10 +35,6 @@
#ifndef SWORD25_RENDEROBJECTREGISTRY_H
#define SWORD25_RENDEROBJECTREGISTRY_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/kernel/objectregistry.h"
@@ -46,16 +42,8 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward Deklarationen
-// -----------------------------------------------------------------------------
-
class RenderObject;
-// -----------------------------------------------------------------------------
-// Klassendeklaration
-// -----------------------------------------------------------------------------
-
class RenderObjectRegistry :
public ObjectRegistry<RenderObject>,
public Common::Singleton<RenderObjectRegistry> {
diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index 941efbdf3c..74174cbcd9 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -34,10 +34,6 @@
#define BS_LOG_PREFIX "SCREENSHOT"
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "common/system.h"
#include "common/savefile.h"
#include "sword25/gfx/screenshot.h"
@@ -46,13 +42,11 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-
#include "common/pack-start.h"
struct RGB_PIXEL {
- byte Red;
- byte Green;
- byte Blue;
+ byte red;
+ byte green;
+ byte blue;
} PACKED_STRUCT;
#include "common/pack-end.h"
@@ -63,22 +57,21 @@ void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) {
void userFlushFn(png_structp png_ptr) {
}
-
-bool Screenshot::SaveToFile(Graphics::Surface *Data, Common::WriteStream *Stream) {
+bool Screenshot::saveToFile(Graphics::Surface *data, Common::WriteStream *stream) {
// Reserve buffer space
- RGB_PIXEL *pixelBuffer = new RGB_PIXEL[Data->w * Data->h];
+ RGB_PIXEL *pixelBuffer = new RGB_PIXEL[data->w * data->h];
// Convert the RGBA data to RGB
- const byte *pSrc = (const byte *)Data->getBasePtr(0, 0);
+ const byte *pSrc = (const byte *)data->getBasePtr(0, 0);
RGB_PIXEL *pDest = pixelBuffer;
- for (uint y = 0; y < Data->h; y++) {
- for (uint x = 0; x < Data->w; x++) {
+ for (uint y = 0; y < data->h; y++) {
+ for (uint x = 0; x < data->w; x++) {
uint32 srcPixel = READ_LE_UINT32(pSrc);
pSrc += sizeof(uint32);
- pDest->Red = (srcPixel >> 16) & 0xff;
- pDest->Green = (srcPixel >> 8) & 0xff;
- pDest->Blue = srcPixel & 0xff;
+ pDest->red = (srcPixel >> 16) & 0xff;
+ pDest->green = (srcPixel >> 8) & 0xff;
+ pDest->blue = srcPixel & 0xff;
++pDest;
}
}
@@ -91,30 +84,30 @@ bool Screenshot::SaveToFile(Graphics::Surface *Data, Common::WriteStream *Stream
if (!info_ptr)
error("Could not create PNG info-struct.");
- // The compression buffer must be large enough to the entire image.
+ // The compression buffer must be large enough to the entire image.
// This ensures that only an IDAT chunk is created.
// When buffer size is used 110% of the raw data size to be sure.
- png_set_compression_buffer_size(png_ptr, (Data->w * Data->h * 3 * 110) / 100);
+ png_set_compression_buffer_size(png_ptr, (data->w * data->h * 3 * 110) / 100);
// Initialise PNG-Info structure
png_set_IHDR(png_ptr, info_ptr,
- Data->w, // Width
- Data->h, // Height
- 8, // Bits depth
+ data->w, // Width
+ data->h, // Height
+ 8, // Bits depth
PNG_COLOR_TYPE_RGB, // Colour type
PNG_INTERLACE_NONE, // No interlacing
PNG_COMPRESSION_TYPE_DEFAULT, // Compression type
PNG_FILTER_TYPE_DEFAULT); // Filter Type
// Rowpointer erstellen
- png_bytep *rowPointers = new png_bytep[Data->h];
- for (uint i = 0; i < Data->h; i++) {
- rowPointers[i] = (png_bytep)&pixelBuffer[Data->w * i];
+ png_bytep *rowPointers = new png_bytep[data->h];
+ for (uint i = 0; i < data->h; i++) {
+ rowPointers[i] = (png_bytep)&pixelBuffer[data->w * i];
}
png_set_rows(png_ptr, info_ptr, &rowPointers[0]);
// Write out the png data to the file
- png_set_write_fn(png_ptr, (void *)Stream, userWriteFn, userFlushFn);
+ png_set_write_fn(png_ptr, (void *)stream, userWriteFn, userFlushFn);
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
@@ -127,14 +120,14 @@ bool Screenshot::SaveToFile(Graphics::Surface *Data, Common::WriteStream *Stream
// -----------------------------------------------------------------------------
-Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *Data) {
+Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *data) {
// This method takes a screen image with a dimension of 800x600, and creates a screenshot with a dimension of 200x125.
// First 50 pixels are cut off the top and bottom (the interface boards in the game). The remaining image of 800x500
// will be on a 16th of its size, reduced by being handed out in 4x4 pixel blocks and the average of each block
// generates a pixel of the target image. Finally, the result as a PNG file is stored as a file.
// The source image must be 800x600.
- if (Data->w != 800 || Data->h != 600 || Data->bytesPerPixel != 4) {
+ if (data->w != 800 || data->h != 600 || data->bytesPerPixel != 4) {
BS_LOG_ERRORLN("The sreenshot dimensions have to be 800x600 in order to be saved as a thumbnail.");
return false;
}
@@ -152,7 +145,7 @@ Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *Data) {
int alpha, red, green, blue;
alpha = red = green = blue = 0;
for (int j = 0; j < 4; ++j) {
- const uint32 *srcP = (const uint32 *)Data->getBasePtr(x * 4, y * 4 + j + 50);
+ const uint32 *srcP = (const uint32 *)data->getBasePtr(x * 4, y * 4 + j + 50);
for (int i = 0; i < 4; ++i) {
uint32 pixel = READ_LE_UINT32(srcP + i);
alpha += (pixel >> 24);
@@ -178,7 +171,7 @@ Common::MemoryReadStream *Screenshot::createThumbnail(Graphics::Surface *Data) {
// Create a PNG representation of the thumbnail data
Common::MemoryWriteStreamDynamic *stream = new Common::MemoryWriteStreamDynamic();
- SaveToFile(&thumbnail, stream);
+ saveToFile(&thumbnail, stream);
// Output a MemoryReadStream that encompasses the written data
Common::MemoryReadStream *result = new Common::MemoryReadStream(stream->getData(), stream->size(),
diff --git a/engines/sword25/gfx/screenshot.h b/engines/sword25/gfx/screenshot.h
index d328130b3f..eefaa1bca6 100644
--- a/engines/sword25/gfx/screenshot.h
+++ b/engines/sword25/gfx/screenshot.h
@@ -35,23 +35,15 @@
#ifndef SWORD25_SCREENSHOT_H
#define SWORD25_SCREENSHOT_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "graphics/surface.h"
#include "sword25/kernel/common.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Class declaration
-// -----------------------------------------------------------------------------
-
class Screenshot {
public:
- static bool SaveToFile(Graphics::Surface *Data, Common::WriteStream *Stream);
- static Common::MemoryReadStream *createThumbnail(Graphics::Surface *Data);
+ static bool saveToFile(Graphics::Surface *data, Common::WriteStream *stream);
+ static Common::MemoryReadStream *createThumbnail(Graphics::Surface *data);
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/staticbitmap.cpp b/engines/sword25/gfx/staticbitmap.cpp
index 3184e4f971..43e9ef73c6 100644
--- a/engines/sword25/gfx/staticbitmap.cpp
+++ b/engines/sword25/gfx/staticbitmap.cpp
@@ -32,10 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/gfx/staticbitmap.h"
#include "sword25/gfx/bitmapresource.h"
#include "sword25/package/packagemanager.h"
@@ -44,16 +40,8 @@
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Logging
-// -----------------------------------------------------------------------------
-
#define BS_LOG_PREFIX "STATICBITMAP"
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
StaticBitmap::StaticBitmap(RenderObjectPtr<RenderObject> parentPtr, const Common::String &filename) :
Bitmap(parentPtr, TYPE_STATICBITMAP) {
// Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden.
@@ -63,15 +51,11 @@ StaticBitmap::StaticBitmap(RenderObjectPtr<RenderObject> parentPtr, const Common
_initSuccess = initBitmapResource(filename);
}
-// -----------------------------------------------------------------------------
-
StaticBitmap::StaticBitmap(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle) :
Bitmap(parentPtr, TYPE_STATICBITMAP, handle) {
_initSuccess = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::initBitmapResource(const Common::String &filename) {
// Bild-Resource laden
Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(filename);
@@ -99,13 +83,9 @@ bool StaticBitmap::initBitmapResource(const Common::String &filename) {
return true;
}
-// -----------------------------------------------------------------------------
-
StaticBitmap::~StaticBitmap() {
}
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::doRender() {
// Bitmap holen
Resource *resourcePtr = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
@@ -137,8 +117,6 @@ bool StaticBitmap::doRender() {
return result;
}
-// -----------------------------------------------------------------------------
-
uint StaticBitmap::getPixel(int x, int y) const {
BS_ASSERT(x >= 0 && x < _width);
BS_ASSERT(y >= 0 && y < _height);
@@ -151,17 +129,11 @@ uint StaticBitmap::getPixel(int x, int y) const {
return result;
}
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::setContent(const byte *pixeldata, uint size, uint offset, uint stride) {
BS_LOG_ERRORLN("SetContent() ist not supported with this object.");
return false;
}
-// -----------------------------------------------------------------------------
-// Auskunftsmethoden
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::isAlphaAllowed() const {
Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
@@ -170,8 +142,6 @@ bool StaticBitmap::isAlphaAllowed() const {
return result;
}
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::isColorModulationAllowed() const {
Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
@@ -180,8 +150,6 @@ bool StaticBitmap::isColorModulationAllowed() const {
return result;
}
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::isScalingAllowed() const {
Resource *pResource = Kernel::GetInstance()->GetResourceManager()->RequestResource(_resourceFilename);
BS_ASSERT(pResource->GetType() == Resource::TYPE_BITMAP);
@@ -190,10 +158,6 @@ bool StaticBitmap::isScalingAllowed() const {
return result;
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool StaticBitmap::persist(OutputPersistenceBlock &writer) {
bool result = true;
diff --git a/engines/sword25/gfx/staticbitmap.h b/engines/sword25/gfx/staticbitmap.h
index a325487213..b5b4c4f5a2 100644
--- a/engines/sword25/gfx/staticbitmap.h
+++ b/engines/sword25/gfx/staticbitmap.h
@@ -35,19 +35,11 @@
#ifndef SWORD25_STATIC_BITMAP_H
#define SWORD25_STATIC_BITMAP_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/gfx/bitmap.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Klassendeklaration
-// -----------------------------------------------------------------------------
-
class StaticBitmap : public Bitmap {
friend class RenderObject;
@@ -63,20 +55,20 @@ public:
virtual uint getPixel(int x, int y) const;
- virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride);
+ virtual bool setContent(const byte *pixeldata, uint size, uint offset, uint stride);
- virtual bool isScalingAllowed() const;
- virtual bool isAlphaAllowed() const;
- virtual bool isColorModulationAllowed() const;
- virtual bool isSetContentAllowed() const {
+ virtual bool isScalingAllowed() const;
+ virtual bool isAlphaAllowed() const;
+ virtual bool isColorModulationAllowed() const;
+ virtual bool isSetContentAllowed() const {
return false;
}
- virtual bool persist(OutputPersistenceBlock &writer);
- virtual bool unpersist(InputPersistenceBlock &reader);
+ virtual bool persist(OutputPersistenceBlock &writer);
+ virtual bool unpersist(InputPersistenceBlock &reader);
protected:
- virtual bool doRender();
+ virtual bool doRender();
private:
Common::String _resourceFilename;
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index 7b54170a26..69e0818503 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -36,10 +36,6 @@
// Entweder Fontfile absolut abspeichern, oder Verzeichniswechseln verbieten
// Eine relative Fontfile-Angabe könnte verwandt werden nachdem das Verzeichnis bereits gewechselt wurde und die Datei würde nicht mehr gefunden
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/kernel.h"
#include "sword25/kernel/outputpersistenceblock.h"
#include "sword25/kernel/inputpersistenceblock.h"
@@ -52,65 +48,49 @@ namespace Sword25 {
#define BS_LOG_PREFIX "TEXT"
-// -----------------------------------------------------------------------------
-// Konstanten
-// -----------------------------------------------------------------------------
-
namespace {
const uint AUTO_WRAP_THRESHOLD_DEFAULT = 300;
}
-// -----------------------------------------------------------------------------
-// Konstruktion / Destruktion
-// -----------------------------------------------------------------------------
-
-Text::Text(RenderObjectPtr<RenderObject> ParentPtr) :
- RenderObject(ParentPtr, RenderObject::TYPE_TEXT),
+Text::Text(RenderObjectPtr<RenderObject> parentPtr) :
+ RenderObject(parentPtr, RenderObject::TYPE_TEXT),
_modulationColor(0xffffffff),
- m_AutoWrap(false),
- m_AutoWrapThreshold(AUTO_WRAP_THRESHOLD_DEFAULT) {
+ _autoWrap(false),
+ _autoWrapThreshold(AUTO_WRAP_THRESHOLD_DEFAULT) {
}
-// -----------------------------------------------------------------------------
-
-Text::Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle) :
- RenderObject(ParentPtr, TYPE_TEXT, Handle),
+Text::Text(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle) :
+ RenderObject(parentPtr, TYPE_TEXT, handle),
// Temporarily set fields prior to unpersisting actual values
_modulationColor(0xffffffff),
- m_AutoWrap(false),
- m_AutoWrapThreshold(AUTO_WRAP_THRESHOLD_DEFAULT) {
+ _autoWrap(false),
+ _autoWrapThreshold(AUTO_WRAP_THRESHOLD_DEFAULT) {
// Unpersist the fields
- _initSuccess = unpersist(Reader);
+ _initSuccess = unpersist(reader);
}
-// -----------------------------------------------------------------------------
-
-bool Text::SetFont(const Common::String &Font) {
+bool Text::setFont(const Common::String &font) {
// Font precachen.
- if (GetResourceManager()->PrecacheResource(Font)) {
- m_Font = Font;
- UpdateFormat();
+ if (getResourceManager()->PrecacheResource(font)) {
+ _font = font;
+ updateFormat();
forceRefresh();
return true;
} else {
- BS_LOG_ERRORLN("Could not precache font \"%s\". Font probably does not exist.", Font.c_str());
+ BS_LOG_ERRORLN("Could not precache font \"%s\". Font probably does not exist.", font.c_str());
return false;
}
}
-// -----------------------------------------------------------------------------
-
-void Text::SetText(const Common::String &text) {
- m_Text = text;
- UpdateFormat();
+void Text::setText(const Common::String &text) {
+ _text = text;
+ updateFormat();
forceRefresh();
}
-// -----------------------------------------------------------------------------
-
void Text::setColor(uint modulationColor) {
uint newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000);
if (newModulationColor != _modulationColor) {
@@ -119,8 +99,6 @@ void Text::setColor(uint modulationColor) {
}
}
-// -----------------------------------------------------------------------------
-
void Text::setAlpha(int alpha) {
BS_ASSERT(alpha >= 0 && alpha < 256);
uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24;
@@ -130,225 +108,215 @@ void Text::setAlpha(int alpha) {
}
}
-// -----------------------------------------------------------------------------
-
-void Text::SetAutoWrap(bool AutoWrap) {
- if (AutoWrap != m_AutoWrap) {
- m_AutoWrap = AutoWrap;
- UpdateFormat();
+void Text::setAutoWrap(bool autoWrap) {
+ if (autoWrap != _autoWrap) {
+ _autoWrap = autoWrap;
+ updateFormat();
forceRefresh();
}
}
-// -----------------------------------------------------------------------------
-
-void Text::SetAutoWrapThreshold(uint AutoWrapThreshold) {
- if (AutoWrapThreshold != m_AutoWrapThreshold) {
- m_AutoWrapThreshold = AutoWrapThreshold;
- UpdateFormat();
+void Text::setAutoWrapThreshold(uint autoWrapThreshold) {
+ if (autoWrapThreshold != _autoWrapThreshold) {
+ _autoWrapThreshold = autoWrapThreshold;
+ updateFormat();
forceRefresh();
}
}
-// -----------------------------------------------------------------------------
-
bool Text::doRender() {
// Font-Resource locken.
- FontResource *FontPtr = LockFontResource();
- if (!FontPtr) return false;
+ FontResource *fontPtr = lockFontResource();
+ if (!fontPtr)
+ return false;
// Charactermap-Resource locken.
- ResourceManager *RMPtr = GetResourceManager();
- BitmapResource *CharMapPtr;
+ ResourceManager *rmPtr = getResourceManager();
+ BitmapResource *charMapPtr;
{
- Resource *pResource = RMPtr->RequestResource(FontPtr->GetCharactermapFileName());
+ Resource *pResource = rmPtr->RequestResource(fontPtr->getCharactermapFileName());
if (!pResource) {
- BS_LOG_ERRORLN("Could not request resource \"%s\".", FontPtr->GetCharactermapFileName().c_str());
+ BS_LOG_ERRORLN("Could not request resource \"%s\".", fontPtr->getCharactermapFileName().c_str());
return false;
}
if (pResource->GetType() != Resource::TYPE_BITMAP) {
- BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", FontPtr->GetCharactermapFileName().c_str());
+ BS_LOG_ERRORLN("Requested resource \"%s\" is not a bitmap.", fontPtr->getCharactermapFileName().c_str());
return false;
}
- CharMapPtr = static_cast<BitmapResource *>(pResource);
+ charMapPtr = static_cast<BitmapResource *>(pResource);
}
// Framebufferobjekt holen.
- GraphicEngine *GfxPtr = Kernel::GetInstance()->GetGfx();
- BS_ASSERT(GfxPtr);
+ GraphicEngine *gfxPtr = Kernel::GetInstance()->GetGfx();
+ BS_ASSERT(gfxPtr);
- bool Result = true;
- Common::Array<LINE>::iterator Iter = m_Lines.begin();
- for (; Iter != m_Lines.end(); ++Iter) {
+ bool result = true;
+ Common::Array<Line>::iterator iter = _lines.begin();
+ for (; iter != _lines.end(); ++iter) {
// Feststellen, ob überhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind.
- Common::Rect CheckRect = (*Iter).BBox;
- CheckRect.translate(_absoluteX, _absoluteY);
+ Common::Rect checkRect = (*iter).bbox;
+ checkRect.translate(_absoluteX, _absoluteY);
// Jeden Buchstaben einzeln Rendern.
- int CurX = _absoluteX + (*Iter).BBox.left;
- int CurY = _absoluteY + (*Iter).BBox.top;
- for (uint i = 0; i < (*Iter).Text.size(); ++i) {
- Common::Rect CurRect = FontPtr->GetCharacterRect((byte)(*Iter).Text[i]);
-
- Common::Rect RenderRect(CurX, CurY, CurX + CurRect.width(), CurY + CurRect.height());
- int RenderX = CurX + (RenderRect.left - RenderRect.left);
- int RenderY = CurY + (RenderRect.top - RenderRect.top);
- RenderRect.translate(CurRect.left - CurX, CurRect.top - CurY);
- Result = CharMapPtr->blit(RenderX, RenderY, Image::FLIP_NONE, &RenderRect, _modulationColor);
- if (!Result) break;
-
- CurX += CurRect.width() + FontPtr->GetGapWidth();
+ int curX = _absoluteX + (*iter).bbox.left;
+ int curY = _absoluteY + (*iter).bbox.top;
+ for (uint i = 0; i < (*iter).text.size(); ++i) {
+ Common::Rect curRect = fontPtr->getCharacterRect((byte)(*iter).text[i]);
+
+ Common::Rect renderRect(curX, curY, curX + curRect.width(), curY + curRect.height());
+ int renderX = curX + (renderRect.left - renderRect.left);
+ int renderY = curY + (renderRect.top - renderRect.top);
+ renderRect.translate(curRect.left - curX, curRect.top - curY);
+ result = charMapPtr->blit(renderX, renderY, Image::FLIP_NONE, &renderRect, _modulationColor);
+ if (!result)
+ break;
+
+ curX += curRect.width() + fontPtr->getGapWidth();
}
}
// Charactermap-Resource freigeben.
- CharMapPtr->release();
+ charMapPtr->release();
// Font-Resource freigeben.
- FontPtr->release();
+ fontPtr->release();
- return Result;
+ return result;
}
-// -----------------------------------------------------------------------------
-
-ResourceManager *Text::GetResourceManager() {
+ResourceManager *Text::getResourceManager() {
// Pointer auf den Resource-Manager holen.
return Kernel::GetInstance()->GetResourceManager();
}
-// -----------------------------------------------------------------------------
-
-FontResource *Text::LockFontResource() {
- ResourceManager *RMPtr = GetResourceManager();
+FontResource *Text::lockFontResource() {
+ ResourceManager *rmPtr = getResourceManager();
// Font-Resource locken.
- FontResource *FontPtr;
+ FontResource *fontPtr;
{
- Resource *ResourcePtr = RMPtr->RequestResource(m_Font);
- if (!ResourcePtr) {
- BS_LOG_ERRORLN("Could not request resource \"%s\".", m_Font.c_str());
+ Resource *resourcePtr = rmPtr->RequestResource(_font);
+ if (!resourcePtr) {
+ BS_LOG_ERRORLN("Could not request resource \"%s\".", _font.c_str());
return NULL;
}
- if (ResourcePtr->GetType() != Resource::TYPE_FONT) {
- BS_LOG_ERRORLN("Requested resource \"%s\" is not a font.", m_Font.c_str());
+ if (resourcePtr->GetType() != Resource::TYPE_FONT) {
+ BS_LOG_ERRORLN("Requested resource \"%s\" is not a font.", _font.c_str());
return NULL;
}
- FontPtr = static_cast<FontResource *>(ResourcePtr);
+ fontPtr = static_cast<FontResource *>(resourcePtr);
}
- return FontPtr;
+ return fontPtr;
}
-// -----------------------------------------------------------------------------
-
-void Text::UpdateFormat() {
- FontResource *FontPtr = LockFontResource();
- BS_ASSERT(FontPtr);
+void Text::updateFormat() {
+ FontResource *fontPtr = lockFontResource();
+ BS_ASSERT(fontPtr);
- UpdateMetrics(*FontPtr);
+ updateMetrics(*fontPtr);
- m_Lines.resize(1);
- if (m_AutoWrap && (uint) _width >= m_AutoWrapThreshold && m_Text.size() >= 2) {
+ _lines.resize(1);
+ if (_autoWrap && (uint) _width >= _autoWrapThreshold && _text.size() >= 2) {
_width = 0;
- uint CurLineWidth = 0;
- uint CurLineHeight = 0;
- uint CurLine = 0;
- uint TempLineWidth = 0;
- uint LastSpace = 0; // we need at least 1 space character to start a new line...
- m_Lines[0].Text = "";
- for (uint i = 0; i < m_Text.size(); ++i) {
+ uint curLineWidth = 0;
+ uint curLineHeight = 0;
+ uint curLine = 0;
+ uint tempLineWidth = 0;
+ uint lastSpace = 0; // we need at least 1 space character to start a new line...
+ _lines[0].text = "";
+ for (uint i = 0; i < _text.size(); ++i) {
uint j;
- TempLineWidth = 0;
- LastSpace = 0;
- for (j = i; j < m_Text.size(); ++j) {
- if ((byte)m_Text[j] == ' ') LastSpace = j;
+ tempLineWidth = 0;
+ lastSpace = 0;
+ for (j = i; j < _text.size(); ++j) {
+ if ((byte)_text[j] == ' ')
+ lastSpace = j;
- const Common::Rect &CurCharRect = FontPtr->GetCharacterRect((byte)m_Text[j]);
- TempLineWidth += CurCharRect.width();
- TempLineWidth += FontPtr->GetGapWidth();
+ const Common::Rect &curCharRect = fontPtr->getCharacterRect((byte)_text[j]);
+ tempLineWidth += curCharRect.width();
+ tempLineWidth += fontPtr->getGapWidth();
- if ((TempLineWidth >= m_AutoWrapThreshold) && (LastSpace > 0))
+ if ((tempLineWidth >= _autoWrapThreshold) && (lastSpace > 0))
break;
}
- if (j == m_Text.size()) LastSpace = m_Text.size(); // everything in 1 line.
+ if (j == _text.size()) // everything in 1 line.
+ lastSpace = _text.size();
- CurLineWidth = 0;
- CurLineHeight = 0;
- for (j = i; j < LastSpace; ++j) {
- m_Lines[CurLine].Text += m_Text[j];
+ curLineWidth = 0;
+ curLineHeight = 0;
+ for (j = i; j < lastSpace; ++j) {
+ _lines[curLine].text += _text[j];
- const Common::Rect &CurCharRect = FontPtr->GetCharacterRect((byte)m_Text[j]);
- CurLineWidth += CurCharRect.width();
- CurLineWidth += FontPtr->GetGapWidth();
- if ((uint) CurCharRect.height() > CurLineHeight) CurLineHeight = CurCharRect.height();
+ const Common::Rect &curCharRect = fontPtr->getCharacterRect((byte)_text[j]);
+ curLineWidth += curCharRect.width();
+ curLineWidth += fontPtr->getGapWidth();
+ if ((uint)curCharRect.height() > curLineHeight)
+ curLineHeight = curCharRect.height();
}
- m_Lines[CurLine].BBox.right = CurLineWidth;
- m_Lines[CurLine].BBox.bottom = CurLineHeight;
- if ((uint) _width < CurLineWidth) _width = CurLineWidth;
+ _lines[curLine].bbox.right = curLineWidth;
+ _lines[curLine].bbox.bottom = curLineHeight;
+ if ((uint)_width < curLineWidth)
+ _width = curLineWidth;
- if (LastSpace < m_Text.size()) {
- ++CurLine;
- BS_ASSERT(CurLine == m_Lines.size());
- m_Lines.resize(CurLine + 1);
- m_Lines[CurLine].Text = "";
+ if (lastSpace < _text.size()) {
+ ++curLine;
+ BS_ASSERT(curLine == _lines.size());
+ _lines.resize(curLine + 1);
+ _lines[curLine].text = "";
}
- i = LastSpace;
+ i = lastSpace;
}
// Bounding-Box der einzelnen Zeilen relativ zur ersten festlegen (vor allem zentrieren).
_height = 0;
- Common::Array<LINE>::iterator Iter = m_Lines.begin();
- for (; Iter != m_Lines.end(); ++Iter) {
- Common::Rect &BBox = (*Iter).BBox;
- BBox.left = (_width - BBox.right) / 2;
- BBox.right = BBox.left + BBox.right;
- BBox.top = (Iter - m_Lines.begin()) * FontPtr->GetLineHeight();
- BBox.bottom = BBox.top + BBox.bottom;
- _height += BBox.height();
+ Common::Array<Line>::iterator iter = _lines.begin();
+ for (; iter != _lines.end(); ++iter) {
+ Common::Rect &bbox = (*iter).bbox;
+ bbox.left = (_width - bbox.right) / 2;
+ bbox.right = bbox.left + bbox.right;
+ bbox.top = (iter - _lines.begin()) * fontPtr->getLineHeight();
+ bbox.bottom = bbox.top + bbox.bottom;
+ _height += bbox.height();
}
} else {
// Keine automatische Formatierung, also wird der gesamte Text in nur eine Zeile kopiert.
- m_Lines[0].Text = m_Text;
- m_Lines[0].BBox = Common::Rect(0, 0, _width, _height);
+ _lines[0].text = _text;
+ _lines[0].bbox = Common::Rect(0, 0, _width, _height);
}
- FontPtr->release();
+ fontPtr->release();
}
-// -----------------------------------------------------------------------------
-
-void Text::UpdateMetrics(FontResource &fontResource) {
+void Text::updateMetrics(FontResource &fontResource) {
_width = 0;
_height = 0;
- for (uint i = 0; i < m_Text.size(); ++i) {
- const Common::Rect &CurRect = fontResource.GetCharacterRect((byte)m_Text[i]);
- _width += CurRect.width();
- if (i != m_Text.size() - 1) _width += fontResource.GetGapWidth();
- if (_height < CurRect.height()) _height = CurRect.height();
+ for (uint i = 0; i < _text.size(); ++i) {
+ const Common::Rect &curRect = fontResource.getCharacterRect((byte)_text[i]);
+ _width += curRect.width();
+ if (i != _text.size() - 1)
+ _width += fontResource.getGapWidth();
+ if (_height < curRect.height())
+ _height = curRect.height();
}
}
-// -----------------------------------------------------------------------------
-// Persistenz
-// -----------------------------------------------------------------------------
-
bool Text::persist(OutputPersistenceBlock &writer) {
bool result = true;
result &= RenderObject::persist(writer);
writer.write(_modulationColor);
- writer.write(m_Font);
- writer.write(m_Text);
- writer.write(m_AutoWrap);
- writer.write(m_AutoWrapThreshold);
+ writer.write(_font);
+ writer.write(_text);
+ writer.write(_autoWrap);
+ writer.write(_autoWrapThreshold);
result &= RenderObject::persistChildren(writer);
@@ -366,21 +334,21 @@ bool Text::unpersist(InputPersistenceBlock &reader) {
// Beim Laden der anderen Member werden die Set-Methoden benutzt statt der tatsächlichen Member.
// So wird das Layout automatisch aktualisiert und auch alle anderen notwendigen Methoden ausgeführt.
- Common::String Font;
- reader.read(Font);
- SetFont(Font);
+ Common::String font;
+ reader.read(font);
+ setFont(font);
Common::String text;
reader.read(text);
- SetText(text);
+ setText(text);
- bool AutoWrap;
- reader.read(AutoWrap);
- SetAutoWrap(AutoWrap);
+ bool autoWrap;
+ reader.read(autoWrap);
+ setAutoWrap(autoWrap);
- uint AutoWrapThreshold;
- reader.read(AutoWrapThreshold);
- SetAutoWrapThreshold(AutoWrapThreshold);
+ uint autoWrapThreshold;
+ reader.read(autoWrapThreshold);
+ setAutoWrapThreshold(autoWrapThreshold);
result &= RenderObject::unpersistChildren(reader);
diff --git a/engines/sword25/gfx/text.h b/engines/sword25/gfx/text.h
index 407cd3c1cb..42c1cd7c5d 100644
--- a/engines/sword25/gfx/text.h
+++ b/engines/sword25/gfx/text.h
@@ -35,28 +35,16 @@
#ifndef SWORD25_TEXT_H
#define SWORD25_TEXT_H
-// -----------------------------------------------------------------------------
-// Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "common/rect.h"
#include "sword25/gfx/renderobject.h"
namespace Sword25 {
-// -----------------------------------------------------------------------------
-// Forward Declarations
-// -----------------------------------------------------------------------------
-
class Kernel;
class FontResource;
class ResourceManager;
-// -----------------------------------------------------------------------------
-// Klassendefinition
-// -----------------------------------------------------------------------------
-
class Text : public RenderObject {
friend class RenderObject;
@@ -66,13 +54,13 @@ public:
@param Font der Dateiname der Fontdatei.
@return Gibt false zurück, wenn der Font nicht gefunden wurde.
*/
- bool SetFont(const Common::String &Font);
+ bool setFont(const Common::String &font);
/**
@brief Setzt den darzustellenden Text.
@param Text der darzustellende Text
*/
- void SetText(const Common::String &text);
+ void setText(const Common::String &text);
/**
@brief Setzt den Alphawert des Textes.
@@ -88,27 +76,27 @@ public:
@param AutoWrap gibt an, ob der automatische Umbruch aktiviert oder deaktiviert werden soll.
@remark Dieses Attribut wird mit dem Wert false initialisiert.
*/
- void SetAutoWrap(bool AutoWrap);
+ void setAutoWrap(bool autoWrap);
/**
@brief Legt die Längengrenze des Textes in Pixeln fest, ab der ein automatischer Zeilenumbruch vorgenommen wird.
@remark Dieses Attribut wird mit dem Wert 300 initialisiert.
@remark Eine automatische Formatierung wird nur vorgenommen, wenn diese durch einen Aufruf von SetAutoWrap() aktiviert wurde.
*/
- void SetAutoWrapThreshold(uint AutoWrapThreshold);
+ void setAutoWrapThreshold(uint autoWrapThreshold);
/**
@brief Gibt den dargestellten Text zurück.
*/
- const Common::String &GetText() {
- return m_Text;
+ const Common::String &getText() {
+ return _text;
}
/**
@brief Gibt den Namen das momentan benutzten Fonts zurück.
*/
- const Common::String &GetFont() {
- return m_Font;
+ const Common::String &getFont() {
+ return _font;
}
/**
@@ -136,44 +124,44 @@ public:
/**
@brief Gibt zurück, ob die automatische Formatierung aktiviert ist.
*/
- bool IsAutoWrapActive() const {
- return m_AutoWrap;
+ bool isAutoWrapActive() const {
+ return _autoWrap;
}
/**
@brief Gibt die Längengrenze des Textes in Pixeln zurück, ab der eine automatische Formatierung vorgenommen wird.
*/
- uint GetAutoWrapThreshold() const {
- return m_AutoWrapThreshold;
+ uint getAutoWrapThreshold() const {
+ return _autoWrapThreshold;
}
- virtual bool persist(OutputPersistenceBlock &writer);
- virtual bool unpersist(InputPersistenceBlock &reader);
+ virtual bool persist(OutputPersistenceBlock &writer);
+ virtual bool unpersist(InputPersistenceBlock &reader);
protected:
virtual bool doRender();
private:
- Text(RenderObjectPtr<RenderObject> ParentPtr);
- Text(InputPersistenceBlock &Reader, RenderObjectPtr<RenderObject> ParentPtr, uint Handle);
-
- uint _modulationColor;
- Common::String m_Font;
- Common::String m_Text;
- bool m_AutoWrap;
- uint m_AutoWrapThreshold;
-
- struct LINE {
- Common::Rect BBox;
- Common::String Text;
+ Text(RenderObjectPtr<RenderObject> parentPtr);
+ Text(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle);
+
+ uint _modulationColor;
+ Common::String _font;
+ Common::String _text;
+ bool _autoWrap;
+ uint _autoWrapThreshold;
+
+ struct Line {
+ Common::Rect bbox;
+ Common::String text;
};
- Common::Array<LINE> m_Lines;
+ Common::Array<Line> _lines;
- void UpdateFormat();
- void UpdateMetrics(FontResource &fontResource);
- ResourceManager *GetResourceManager();
- FontResource *LockFontResource();
+ void updateFormat();
+ void updateMetrics(FontResource &fontResource);
+ ResourceManager *getResourceManager();
+ FontResource *lockFontResource();
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/timedrenderobject.h b/engines/sword25/gfx/timedrenderobject.h
index 94d882d18e..6fee19882a 100644
--- a/engines/sword25/gfx/timedrenderobject.h
+++ b/engines/sword25/gfx/timedrenderobject.h
@@ -32,14 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// System Includes
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
-// Engine Includes
-// -----------------------------------------------------------------------------
-
#include "sword25/kernel/common.h"
#include "sword25/gfx/renderobject.h"