1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

Build fixes for Linux, some warnings and compatibility fixes for C++17 and up

This commit is contained in:
fgenesis 2023-05-25 16:58:08 +02:00
parent 924bc058b4
commit 74ad8f7804
36 changed files with 126 additions and 225 deletions

View file

@ -137,8 +137,8 @@ class Avatar : public Entity, public ActionMapper
public:
Avatar();
virtual ~Avatar();
void destroy();
void action(int actionID, int state, int source, InputDevice device);
void destroy() OVERRIDE;
void action(int actionID, int state, int source, InputDevice device) OVERRIDE;
AvatarState state;
float burst, burstTimer;
float burstDelay;
@ -151,8 +151,7 @@ public:
void revive();
bool canWarp;
void entityDied(Entity *e);
void onCollide(Entity *e);
void entityDied(Entity *e) OVERRIDE;
bool zoomOverriden;
void clampPosition();
@ -170,8 +169,8 @@ public:
void refreshDualFormModel();
void switchDualFormMode();
void enableInput();
void disableInput();
void enableInput() OVERRIDE;
void disableInput() OVERRIDE;
void clearTargets();
bool singing;
@ -226,7 +225,7 @@ public:
int getBurstDistance();
int getStopDistance();
int looking;
std::string getIdleAnimName();
std::string getIdleAnimName() OVERRIDE;
bool isRolling() { return rolling; }
int rollDir;
std::string getBurstAnimName();
@ -253,7 +252,7 @@ public:
Vector headPosition;
void updatePosition();
float quickSongCastDelay;
void onAnimationKeyPassed(int key);
void onAnimationKeyPassed(int key) OVERRIDE;
bool isSwimming();
@ -301,7 +300,7 @@ public:
Web *web;
float rollDelay;
bool canSetBoneLock();
bool canSetBoneLock() OVERRIDE;
void revert();
void doBindSong();
@ -341,8 +340,8 @@ protected:
void checkUpgradeForShot(Shot *s);
size_t getNumShots();
void lockToWallCommon();
void onSetBoneLock();
void onUpdateBoneLock();
void onSetBoneLock() OVERRIDE;
void onUpdateBoneLock() OVERRIDE;
void adjustHeadRot();
std::string lastHeadTexture;
@ -375,8 +374,8 @@ protected:
Vector fallGravity;
int lastOutOfWaterMaxSpeed;
void onIdle();
void onHeal(int type);
void onIdle() OVERRIDE;
void onHeal(int type) OVERRIDE;
ParticleEffect biteLeftEmitter, biteRightEmitter, swimEmitter, auraHitEmitter;
ParticleEffect auraEmitter, auraLowEmitter, wakeEmitter, healEmitter, hitEmitter, rollLeftEmitter, rollRightEmitter, spiritBeaconEmitter, plungeEmitter;
ParticleEffect speedEmitter, defenseEmitter, invincibleEmitter, regenEmitter;
@ -391,7 +390,7 @@ protected:
int getQuadrantDirection(int lastQuad, int quad);
void updateRoll(float dt);
int lastQuad, lastQuadDir;
void onDamage(DamageData &d);
void onDamage(DamageData &d) OVERRIDE;
void updateHair(float dt);
void lostTarget(int i, Entity *e);
@ -400,7 +399,7 @@ protected:
void updateAura(float dt);
void onHealthChange(float change);
void onHealthChange(float change) OVERRIDE;
void startWallBurst(bool useCursor=true);
void startBurst();
@ -417,8 +416,8 @@ protected:
void endCharge();
bool canMove;
void onEnterState(int action);
void onExitState(int action);
void onEnterState(int action) OVERRIDE;
void onExitState(int action) OVERRIDE;
std::vector<ParticleEffect*>targetQuads;
Quad *blinder, *fader, *tripper;
void applyBlindEffects();
@ -432,7 +431,7 @@ protected:
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
Quad *glow;
bool swimming;

View file

@ -28,8 +28,8 @@ public:
protected:
float beamWidth;
void onRender(const RenderState& rs) const OVERRIDE;
void onEndOfLife();
void onUpdate(float dt);
void onEndOfLife() OVERRIDE;
void onUpdate(float dt) OVERRIDE;
};
#endif

View file

@ -48,8 +48,6 @@ SET(AQUARIA_SRCS
Ingredient.h
Intro.cpp
Intro.h
Logo.cpp
Logo.h
Main.cpp
ManaBall.cpp
ManaBall.h
@ -113,12 +111,13 @@ SET(AQUARIA_SRCS
set(EXETYPE)
option(AQUARIA_CONSOLE_WINDOW "Enable console output (always on in debug builds)" TRUE)
if(AQUARIA_CONSOLE_WINDOW OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
add_definitions(-DAQUARIA_ENABLE_CONSOLE_LOG)
endif()
IF(WIN32)
option(AQUARIA_CONSOLE_WINDOW "Enable the console window (always on in debug builds)" FALSE)
if(AQUARIA_CONSOLE_WINDOW OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
add_definitions(-DAQUARIA_ENABLE_CONSOLE_LOG)
else()
if(NOT AQUARIA_CONSOLE_WINDOW)
SET(EXETYPE WIN32)
endif()
SET(AQUARIA_SRCS ${AQUARIA_SRCS} aquaria.rc)

View file

@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "DSQ.h"
#include "States.h"
#include "Game.h"
#include "Logo.h"
#include "Avatar.h"
#include "Entity.h"
#include "Avatar.h"

View file

@ -61,8 +61,8 @@ class Element : public Quad
public:
Element();
~Element();
void destroy();
void update(float dt);
void destroy() OVERRIDE;
void update(float dt) OVERRIDE;
size_t templateIdx;
int bgLayer;
int tag;

View file

@ -76,7 +76,7 @@ public:
ACT_CLICK = 0,
ACT_RANGE = 1
};
void destroy();
void destroy() OVERRIDE;
bool isEntityDead() const {return entityDead;}
std::string name;
@ -84,7 +84,7 @@ public:
InterpolatedVector vel2;
float activationRadius;
void render(const RenderState& rs) const OVERRIDE;
void update(float dt);
void update(float dt) OVERRIDE;
void spawnParticlesFromCollisionMask(const char *p, unsigned intv=1, int layer = LR_PARTICLES, float rotz = 0);
@ -97,7 +97,7 @@ public:
void push(const Vector &vec, float time, float maxSpeed, float dmg);
bool canSetState(int state);
bool canSetState(int state) OVERRIDE;
virtual void message(const std::string &msg, int v) {}
virtual int messageVariadic(lua_State *L, int nparams) { return 0; }
@ -361,12 +361,12 @@ protected:
virtual void onDieEaten() {}
IngredientData *ingredientData;
int vs[EV_MAX];
void onEndOfLife();
void onEndOfLife() OVERRIDE;
void updateLance(float dt);
void onFHScale();
void onFH();
void onFH() OVERRIDE;
float dieTimer;
BounceType bounceType;
Entity* riding;
@ -402,11 +402,11 @@ protected:
void doDeathEffects(float manaBallEnergy=0, bool die=true);
void onEnterState(int action);
void onExitState(int action);
void onEnterState(int action) OVERRIDE;
void onExitState(int action) OVERRIDE;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
Vector pushVec;
float pushDamage;

View file

@ -910,8 +910,6 @@ void Game::ensureLimit(Entity *me, int num, int state)
void Game::establishEntity(Entity *e, int id, Vector startPos)
{
// e->layer must be set BEFORE calling this function!
assert(id); // 0 is invalid/reserved
assert(!getEntityByID(id)); // must not already exist
@ -923,7 +921,9 @@ void Game::establishEntity(Entity *e, int id, Vector startPos)
// otherwise the script is expected to set the render layer here if not using the default.
e->init();
addRenderObject(e, e->layer); // layer was just set in init()
unsigned layer = e->layer; // layer was either set in ctor, or in init()
e->layer = LR_NONE; // addRenderObject wants this to be not set
addRenderObject(e, layer);
}
Entity* Game::getEntityByID(int id) const
@ -1005,9 +1005,9 @@ Entity* Game::createEntityOnMap(const EntitySaveData& sav)
ScriptedEntity *e = new ScriptedEntity(type, pos, ET_ENEMY);
e->rotation.z = sav.rot;
int idx = getIdxForEntityType(type);
EntitySaveData copy = sav;
copy.name = type;
copy.idx = getIdxForEntityType(type);
entitySaveData.push_back(copy);
establishEntity(e, sav.id, pos);

View file

@ -38,7 +38,7 @@ public:
GridRender(ObsType obsType);
protected:
ObsType obsType;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
};
@ -46,7 +46,7 @@ class MiniMapRender : public RenderObject
{
public:
MiniMapRender();
void destroy();
void destroy() OVERRIDE;
bool isCursorIn();
void slide(int slid);
@ -66,7 +66,7 @@ protected:
bool mouseDown;
bool doRender;
float lightLevel;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
void renderIcon(const MinimapIcon *ico, const Vector& pos) const;

View file

@ -55,7 +55,7 @@ public:
HairNode *getHairNode(int idx);
protected:
float segmentLength;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
};

View file

@ -1,56 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Logo.h"
void Logo::JumpTitle::act()
{
}
Logo::Logo() : StateObject()
{
registerState(this, "Logo");
}
void Logo::applyState()
{
StateObject::applyState();
core->setClearColor(Vector(1,1,1));
Quad *q = new Quad;
{
q->setTexture("sky");
q->setWidthHeight(800, 600);
q->position = Vector(400,300);
q->alpha = 0;
q->alpha.interpolateTo(1, 3, 0);
}
addRenderObject(q);
}
void Logo::removeState()
{
StateObject::removeState();
}

View file

@ -1,35 +0,0 @@
/*
Copyright (C) 2007, 2010 - Bit-Blot
This file is part of Aquaria.
Aquaria 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __logo__
#define __logo__
#include "DSQ.h"
class Logo : public StateObject
{
public:
Logo();
EVENT(JumpTitle, jumpTitle)
void applyState();
void removeState();
};
#endif

View file

@ -496,7 +496,6 @@ void SceneEditor::init()
dsq->game->addRenderObject(text, LR_HUD);
text->alpha = 0;
selectedVariation = -1;
on = false;
addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0);

View file

@ -236,7 +236,7 @@ protected:
void mouseButtonLeft();
void mouseButtonRight();
size_t curElement, selectedVariation, possibleSelectedIdx;
size_t curElement;
Quad *placer;
DebugFont *text;

View file

@ -48,9 +48,9 @@ class Strand : public RenderObject, public Segmented
{
public:
Strand(const Vector &position, size_t segs, size_t dist=32);
void destroy();
void destroy() OVERRIDE;
protected:
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
};

View file

@ -151,7 +151,7 @@ void GameOver::applyState()
q->setWidthHeight(800, 600);
q->position = Vector(400,300,-0.1f);
}
addRenderObject(q);
addRenderObject(q, LR_ZERO);

View file

@ -41,9 +41,9 @@ public:
protected:
float existence;
Entity *parentEntity;
void onEndOfLife();
void onEndOfLife() OVERRIDE;
std::vector<Vector> points;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
};

View file

@ -13,11 +13,11 @@ public:
virtual void setWidth(float width) = 0;
virtual void setFontSize(float sz) = 0;
virtual void setAlign(Align a) = 0;
virtual float getLineHeight() = 0;
virtual size_t getNumLines() = 0;
virtual float getHeight() = 0; // total height
virtual float getStringWidth(const std::string& text) = 0; // width of string when not auto-wrapped
virtual float getActualWidth() = 0; // width of text after wrapping
virtual float getLineHeight() const = 0;
virtual size_t getNumLines() const = 0;
virtual float getHeight() const = 0; // total height
virtual float getStringWidth(const std::string& text) const = 0; // width of string when not auto-wrapped
virtual float getActualWidth() const = 0; // width of text after wrapping
};
#endif

View file

@ -124,13 +124,13 @@ float BitmapText::getSetWidth()
return textWidth;
}
float BitmapText::getHeight()
float BitmapText::getHeight() const
{
float sz = bmpFont->font->GetCharHeight('A') * bmpFont->scale;
return lines.size()*sz;
}
float BitmapText::getLineHeight()
float BitmapText::getLineHeight() const
{
return bmpFont->font->GetCharHeight('A') * bmpFont->scale;
}
@ -349,12 +349,12 @@ bool BitmapText::isScrollingText()
return scrolling;
}
size_t BitmapText::getNumLines()
size_t BitmapText::getNumLines() const
{
return lines.size();
}
float BitmapText::getStringWidth(const std::string& text)
float BitmapText::getStringWidth(const std::string& text) const
{
std::string tmp;
int maxsize = 0;

View file

@ -48,32 +48,32 @@ class BitmapText : public BaseText
{
public:
BitmapText(BmpFont *bmpFont);
void setText(const std::string &text);
void setWidth(float width);
void setText(const std::string &text) OVERRIDE;
void setWidth(float width) OVERRIDE;
float getSetWidth(); // get the width that was set
void scrollText(const std::string &text, float scrollSpeed);
void setFontSize(float sz);
void setFontSize(float sz) OVERRIDE;
bool isScrollingText();
void stopScrollingText();
bool isEmpty();
virtual void setAlign(Align align);
virtual void setAlign(Align align) OVERRIDE;
std::string getText();
int getWidthOnScreen();
Vector getColorIndex(size_t i, size_t j);
void updateWordColoring();
void autoKern();
virtual float getHeight();
void unloadDevice();
void reloadDevice();
float getStringWidth(const std::string& text);
float getActualWidth() { return maxW; }
float getLineHeight();
size_t getNumLines();
virtual float getHeight() const OVERRIDE;
void unloadDevice() OVERRIDE;
void reloadDevice() OVERRIDE;
float getStringWidth(const std::string& text) const OVERRIDE;
float getActualWidth() const OVERRIDE { return maxW; }
float getLineHeight() const OVERRIDE;
size_t getNumLines() const OVERRIDE;
protected:
float scrollSpeed;
BmpFont *bmpFont;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
float scrollDelay;
bool scrolling;
size_t currentScrollLine;

View file

@ -2070,22 +2070,18 @@ CountedPtr<Texture> Core::addTexture(const std::string &textureName)
return ptex;
}
void Core::addRenderObject(RenderObject *o, size_t layer)
void Core::addRenderObject(RenderObject *o, unsigned layer)
{
if (!o) return;
assert(o->layer == LR_NONE);
assert(layer < renderObjectLayers.size());
o->layer = layer;
if (layer >= renderObjectLayers.size())
{
std::ostringstream os;
os << "attempted to add render object to invalid layer [" << layer << "]";
errorLog(os.str());
}
renderObjectLayers[layer].add(o);
}
void Core::switchRenderObjectLayer(RenderObject *o, int toLayer)
void Core::switchRenderObjectLayer(RenderObject *o, unsigned toLayer)
{
if (!o) return;
assert(o->layer != LR_NONE);
assert(toLayer < renderObjectLayers.size());
renderObjectLayers[o->layer].remove(o);
renderObjectLayers[toLayer].add(o);
o->layer = toLayer;

View file

@ -238,8 +238,8 @@ public:
void setFullscreen(bool full);
void enable2D(int pixelScaleX, int pixelScaleY);
void addRenderObject(RenderObject *o, size_t layer=0);
void switchRenderObjectLayer(RenderObject *o, int toLayer);
void addRenderObject(RenderObject *o, unsigned layer);
void switchRenderObjectLayer(RenderObject *o, unsigned toLayer);
void addTexture(Texture *r);
CountedPtr<Texture> findTexture(const std::string &name);
void removeTexture(Texture *res);
@ -523,7 +523,7 @@ public:
Joystick *getJoystickForSourceID(int sourceID);
private:
std::vector<Joystick*> joysticks;
int sdlUserMouseEventID;
unsigned sdlUserMouseEventID;
};
extern Core *core;

View file

@ -50,17 +50,17 @@ void DebugFont::setFontSize(float sz)
fontDrawSize = sz;
}
float DebugFont::getHeight()
float DebugFont::getHeight() const
{
return fontDrawSize * lines.size() * 1.5f; // vspc in render()
}
float DebugFont::getLineHeight()
float DebugFont::getLineHeight() const
{
return fontDrawSize * 1.5f; // vspc in render()
}
float DebugFont::getStringWidth(const std::string& text)
float DebugFont::getStringWidth(const std::string& text) const
{
int maxchars = 0;
int c = 0;
@ -78,7 +78,7 @@ float DebugFont::getStringWidth(const std::string& text)
return fontDrawSize * maxchars * (1.4f * 0.75f);
}
float DebugFont::getActualWidth()
float DebugFont::getActualWidth() const
{
return maxW * (1.4f * 0.75f); // numbers taken from onRender()
}

View file

@ -28,15 +28,15 @@ class DebugFont : public BaseText
{
public:
DebugFont(int initFontSize=0, const std::string &initText="");
void setText(const std::string &text);
void setWidth(float width);
void setFontSize(float sz);
size_t getNumLines() { return lines.size(); }
virtual void setAlign(Align align);
virtual float getHeight();
virtual float getLineHeight();
virtual float getStringWidth(const std::string& text);
virtual float getActualWidth();
void setText(const std::string &text) OVERRIDE;
void setWidth(float width) OVERRIDE;
void setFontSize(float sz) OVERRIDE;
size_t getNumLines() const OVERRIDE { return lines.size(); }
virtual void setAlign(Align align) OVERRIDE;
virtual float getHeight() const OVERRIDE;
virtual float getLineHeight() const OVERRIDE;
virtual float getStringWidth(const std::string& text) const OVERRIDE;
virtual float getActualWidth() const OVERRIDE;
protected:
float fontDrawSize, textWidth;
void formatText();

View file

@ -31,7 +31,7 @@ public:
void makeVertical(Vector c1, Vector c2);
void makeHorizontal(Vector c1, Vector c2);
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
int autoWidth, autoHeight;
protected:

View file

@ -119,7 +119,7 @@ class Emitter : public Quad
{
public:
Emitter(ParticleEffect *pe);
void destroy();
void destroy() OVERRIDE;
void addParticle(Particle *p);
void removeParticle(Particle *p);
@ -138,7 +138,7 @@ protected:
Vector currentSpawn, lastSpawn;
void onRender(const RenderState& rs) const OVERRIDE;
void spawnParticle(float perc=1);
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
ParticleEffect *pe;

View file

@ -45,13 +45,13 @@ public:
Quad(const std::string &tex, const Vector &pos);
Quad();
void createGrid(int x, int y);
void destroy();
void destroy() OVERRIDE;
bool isCoordinateInside(Vector coord, int minSize=0) const;
bool isCoordinateInsideWorld(const Vector &coord, int minSize=0) const;
bool isCoordinateInsideWorldRect(const Vector &coord, int w, int h) const;
void flipVertical();
void flipHorizontal();
void flipVertical() OVERRIDE;
void flipHorizontal() OVERRIDE;
void setWidthHeight(float w, float h=-1);
void setWidth(float w);
void setHeight(float h);
@ -67,7 +67,7 @@ public:
Array2d<Vector>& getDrawGrid() { return drawGrid; }
const Array2d<Vector>& getDrawGrid() const { return drawGrid; }
void reloadDevice();
void reloadDevice() OVERRIDE;
void deleteGrid();
@ -122,9 +122,9 @@ protected:
float drawGridTimeMultiplier;
bool drawGridOut;
void onSetTexture();
void onSetTexture() OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
public:
GridDrawOrder drawOrder;

View file

@ -43,8 +43,8 @@ public:
}
virtual void onRender(const RenderState& rs) const OVERRIDE;
virtual void onUpdate(float dt);
virtual void onSetTexture();
virtual void onUpdate(float dt) OVERRIDE;
virtual void onSetTexture() OVERRIDE;
void resetUV(float xmul = 1, float ymul = 1);
void resetPos(float w, float h, float xoffs = 0, float yoffs = 0);

View file

@ -391,7 +391,7 @@ bool RenderObject::isVisibleInPass(int pass) const
void RenderObject::render(const RenderState& rs) const
{
assert(layer != LR_NONE);
assert(parent || layer != LR_NONE);
if (isHidden()) return;
/// new (breaks anything?)

View file

@ -42,7 +42,7 @@ public:
protected:
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
bool canMove;
@ -60,7 +60,7 @@ public:
EventPtr event;
protected:
void onUpdate(float dt);
void onUpdate(float dt) OVERRIDE;
void onRender(const RenderState& rs) const OVERRIDE;
TTFText *label;

View file

@ -30,8 +30,8 @@ public:
void go(float time);
virtual void capture();
void transition(float time);
void reloadDevice();
void unloadDevice();
void reloadDevice() OVERRIDE;
void unloadDevice() OVERRIDE;
bool isGoing();
protected:
void createTexture();

View file

@ -741,6 +741,7 @@ BoneGridInterpolator * Animation::getBoneGridInterpolator(size_t boneIdx)
return &bgip;
}
}
return 0;
}

View file

@ -60,7 +60,7 @@ public:
void createStrip(bool vert, int num);
Quad* addFrame(const std::string &gfx);
void showFrame(int i);
void destroy();
void destroy() OVERRIDE;
std::string gfx;
std::string name;
size_t boneIdx;

View file

@ -44,7 +44,7 @@ void StateObject::removeState()
}
void StateObject::addRenderObject(RenderObject *renderObject, int layer)
void StateObject::addRenderObject(RenderObject *renderObject, unsigned layer)
{
stateManager->getState(name)->addRenderObject(renderObject, layer);
}
@ -75,12 +75,11 @@ StateData::~StateData()
}
}
void StateData::addRenderObject(RenderObject *renderObject, int layer)
void StateData::addRenderObject(RenderObject* renderObject, unsigned layer)
{
core->addRenderObject(renderObject, layer);
renderObjects.push_back (renderObject);
renderObject->setStateDataObject(this);
renderObject->layer = layer;
}
void StateData::removeRenderObject(RenderObject *renderObject)

View file

@ -43,7 +43,7 @@ public:
StateObject *stateObject;
void clearGarbage();
void addRenderObject(RenderObject *renderObject, int layer);
void addRenderObject(RenderObject *renderObject, unsigned layer);
void eraseRenderObjects();
void removeRenderObject(RenderObject *renderObject);
void removeRenderObjectFromList(RenderObject *renderObject);
@ -61,7 +61,7 @@ public:
virtual void removeState();
virtual void update(float dt);
void addRenderObject(RenderObject *renderObject, int layer=0);
void addRenderObject(RenderObject *renderObject, unsigned layer);
void removeRenderObject(RenderObject *renderObject);
std::string name;

View file

@ -110,17 +110,17 @@ void TTFText::updateAlign()
}
}
size_t TTFText::getNumLines()
size_t TTFText::getNumLines() const
{
return (int)text.size();
}
float TTFText::getHeight()
float TTFText::getHeight() const
{
return text.size()*lineHeight;
}
float TTFText::getStringWidth(const std::string& s)
float TTFText::getStringWidth(const std::string& s) const
{
float w = 0;
std::string cp = s;
@ -223,7 +223,7 @@ void TTFText::updateFormatting()
lineHeight = font->font->LineHeight();
}
float TTFText::getLineHeight()
float TTFText::getLineHeight() const
{
return lineHeight;
}

View file

@ -42,17 +42,17 @@ class TTFText : public BaseText
{
public:
TTFText(TTFFont *font);
void setText(const std::string &txt);
void setAlign(Align align);
void setWidth(float width);
float getHeight();
float getActualWidth() { return maxW; }
void setFontSize(float); // dummy
float getStringWidth(const std::string& s);
void setText(const std::string &txt) OVERRIDE;
void setAlign(Align align) OVERRIDE;
void setWidth(float width) OVERRIDE;
float getHeight() const OVERRIDE;
float getActualWidth() const OVERRIDE { return maxW; }
void setFontSize(float) OVERRIDE; // dummy
float getStringWidth(const std::string& s) const OVERRIDE;
bool shadow;
int findLine(const std::string &label);
float getLineHeight();
size_t getNumLines();
float getLineHeight() const OVERRIDE;
size_t getNumLines() const OVERRIDE;
protected:
float width;
float lineHeight;