mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
Build fixes for Linux, some warnings and compatibility fixes for C++17 and up
This commit is contained in:
parent
924bc058b4
commit
74ad8f7804
36 changed files with 126 additions and 225 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
12
BBGE/Quad.h
12
BBGE/Quad.h
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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?)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -741,6 +741,7 @@ BoneGridInterpolator * Animation::getBoneGridInterpolator(size_t boneIdx)
|
|||
return &bgip;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue