Skip to content

Commit

Permalink
Add override instead of virtual
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Sep 19, 2024
1 parent 5dd4e88 commit 3aaeae1
Show file tree
Hide file tree
Showing 46 changed files with 256 additions and 386 deletions.
7 changes: 4 additions & 3 deletions demo/ff/include/ffcharacterchooser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ class FFCharacterChooser : public gcn::Widget, gcn::KeyListener
{
public:
FFCharacterChooser();
~FFCharacterChooser();
void draw(gcn::Graphics* graphics);
~FFCharacterChooser() override;
void draw(gcn::Graphics* graphics) override;
void keyPressed(gcn::KeyEvent& keyEvent) override;

int getSelected();
void setSelected(int selected);
void setDistance(int distance);
void keyPressed(gcn::KeyEvent& keyEvent);

private:
int mSelected;
Expand Down
9 changes: 5 additions & 4 deletions demo/ff/include/ffcontainer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ class FFContainer : public gcn::Container
{
public:
FFContainer();
~FFContainer();
void logic();
void draw(gcn::Graphics* graphics);
~FFContainer() override;
void logic() override;
void draw(gcn::Graphics* graphics) override;
gcn::Rectangle getChildrenArea() override;

void setVisible(bool visible);
void setWidth(int width);
void setHeight(int width);
void setDimension(const gcn::Rectangle &dimension);
void slideContentTo(int y);
gcn::Rectangle getChildrenArea();

private:
int mRealWidth;
Expand Down
7 changes: 4 additions & 3 deletions demo/ff/include/ffdemo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ class FFDemo : public gcn::ActionListener, public gcn::KeyListener
{
public:
FFDemo();
~FFDemo();
~FFDemo() override;
void action(const gcn::ActionEvent& actionEvent) override;
void keyPressed(gcn::KeyEvent& keyEvent) override;

void run();
void action(const gcn::ActionEvent& actionEvent);
void keyPressed(gcn::KeyEvent& keyEvent);

private:
void input();
Expand Down
5 changes: 3 additions & 2 deletions demo/ff/include/fflistbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ class FFListBox : public gcn::ListBox
{
public:
FFListBox();
~FFListBox();
void draw(gcn::Graphics* graphics);
~FFListBox() override;
void draw(gcn::Graphics* graphics) override;

void setSelected(int i);

private:
Expand Down
4 changes: 2 additions & 2 deletions demo/ff/include/ffscrollarea.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class FFScrollArea : public gcn::ScrollArea, public gcn::KeyListener
{
public:
FFScrollArea();
void draw(gcn::Graphics *graphics);
void keyPressed(gcn::KeyEvent &keyEvent);
void draw(gcn::Graphics* graphics) override;
void keyPressed(gcn::KeyEvent& keyEvent) override;
};

#endif
11 changes: 2 additions & 9 deletions demo/ff/include/stringlistmodel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,8 @@ class StringListModel : public gcn::ListModel
public:
StringListModel() {}

int getNumberOfElements()
{
return mStrings.size();
}

std::string getElementAt(int i)
{
return mStrings.at(i);
}
int getNumberOfElements() override { return mStrings.size(); }
std::string getElementAt(int i) override { return mStrings.at(i); }

void add(std::string str)
{
Expand Down
4 changes: 2 additions & 2 deletions examples/action_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace ActionExample
button2->addActionListener(this);
}

~MainContainer()
~MainContainer() override
{
delete font;

Expand All @@ -74,7 +74,7 @@ namespace ActionExample

// Implement the action function in ActionListener to receive actions
// The eventId tells us which widget called the action function.
virtual void action(const gcn::ActionEvent& actionEvent)
void action(const gcn::ActionEvent& actionEvent) override
{
std::string str;
std::ostringstream os(str);
Expand Down
4 changes: 2 additions & 2 deletions examples/rickroll_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace RickRollExample
button2->addActionListener(this);
}

~MainContainer()
~MainContainer() override
{
delete font;

Expand All @@ -73,7 +73,7 @@ namespace RickRollExample

// Implement the action function in ActionListener to receive actions
// The eventId tells us which widget called the action function.
virtual void action(const gcn::ActionEvent& actionEvent)
void action(const gcn::ActionEvent& actionEvent) override
{
// Here we use the widget pointer to check which widget the action
// originated from.
Expand Down
4 changes: 2 additions & 2 deletions examples/widgets_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace WidgetsExample
class DemoListModel : public gcn::ListModel
{
public:
virtual int getNumberOfElements() { return 5; }
int getNumberOfElements() override { return 5; }

virtual std::string getElementAt(int i)
std::string getElementAt(int i) override
{
switch (i)
{
Expand Down
2 changes: 1 addition & 1 deletion include/guisan/actionevent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~ActionEvent();
~ActionEvent() override;

/**
* Gets the identifier of the event. An identifier can
Expand Down
2 changes: 1 addition & 1 deletion include/guisan/containerevent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~ContainerEvent();
~ContainerEvent() override;

/**
* Gets the container the event concerns.
Expand Down
14 changes: 6 additions & 8 deletions include/guisan/defaultfont.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~DefaultFont(){}
~DefaultFont() override {}

/**
* Draws a glyph as a rectangle. The glyphs will always be drawn as
Expand All @@ -95,13 +95,11 @@ namespace gcn

// Inherited from Font

virtual void drawString(Graphics* graphics, const std::string& text, int x, int y, bool enabled);

virtual int getWidth(const std::string& text) const;

virtual int getHeight() const;

virtual int getStringIndexAt(const std::string& text, int x) const;
void drawString(
Graphics* graphics, const std::string& text, int x, int y, bool enabled) override;
int getWidth(const std::string& text) const override;
int getHeight() const override;
int getStringIndexAt(const std::string& text, int x) const override;
};
}

Expand Down
15 changes: 5 additions & 10 deletions include/guisan/genericinput.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,13 @@ namespace gcn
*/
void pushMouseMoved(int x, int y);


// Inherited from Input

virtual bool isKeyQueueEmpty();

virtual KeyInput dequeueKeyInput();

virtual bool isMouseQueueEmpty();

virtual MouseInput dequeueMouseInput();

virtual void _pollInput();
bool isKeyQueueEmpty() override;
KeyInput dequeueKeyInput() override;
bool isMouseQueueEmpty() override;
MouseInput dequeueMouseInput() override;
void _pollInput() override;

protected:
/**
Expand Down
14 changes: 5 additions & 9 deletions include/guisan/imagefont.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode
/**
* Destructor.
*/
virtual ~ImageFont();
~ImageFont() override;

/**
* Draws a glyph.
Expand Down Expand Up @@ -205,14 +205,10 @@ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); @endcode

// Inherited from Font

virtual int getWidth(const std::string& text) const;

virtual void drawString(Graphics* graphics, const std::string& text,
int x, int y, bool enabled);

virtual int getHeight() const;

virtual int getStringIndexAt(const std::string& text, int x) const;
int getWidth(const std::string& text) const override;
void drawString(Graphics* graphics, const std::string& text, int x, int y, bool enabled) override;
int getHeight() const override;
int getStringIndexAt(const std::string& text, int x) const override;

protected:
/**
Expand Down
2 changes: 1 addition & 1 deletion include/guisan/keyevent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~KeyEvent();
~KeyEvent() override;

/**
* Gets the type of the event.
Expand Down
31 changes: 13 additions & 18 deletions include/guisan/opengl/openglgraphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~OpenGLGraphics();
~OpenGLGraphics() override;

/**
* Sets the target plane on where to draw.
Expand Down Expand Up @@ -120,29 +120,24 @@ namespace gcn

// Inherited from Graphics

virtual void _beginDraw();
void _beginDraw() override;
void _endDraw() override;

virtual void _endDraw();
bool pushClipArea(Rectangle area) override;
void popClipArea() override;

virtual bool pushClipArea(Rectangle area);

virtual void popClipArea();

virtual void drawImage(const Image* image, int srcX, int srcY,
void drawImage(const Image* image, int srcX, int srcY,
int dstX, int dstY, int width,
int height);

virtual void drawPoint(int x, int y);

virtual void drawLine(int x1, int y1, int x2, int y2);

virtual void drawRectangle(const Rectangle& rectangle);
int height) override;

virtual void fillRectangle(const Rectangle& rectangle);
void drawPoint(int x, int y) override;
void drawLine(int x1, int y1, int x2, int y2) override;

virtual void setColor(const Color& color);
void drawRectangle(const Rectangle& rectangle) override;
void fillRectangle(const Rectangle& rectangle) override;

virtual const Color& getColor();
void setColor(const Color& color) override;
const Color& getColor() override;

protected:
int mWidth, mHeight;
Expand Down
22 changes: 9 additions & 13 deletions include/guisan/opengl/openglimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace gcn
/**
* Destructor.
*/
virtual ~OpenGLImage();
~OpenGLImage() override;

/**
* Gets the OpenGL texture handle for the image.
Expand All @@ -138,30 +138,26 @@ namespace gcn
*/
virtual int getTextureHeight() const;


// Inherited from Image

virtual void free();

virtual int getWidth() const;
void free() override;

virtual int getHeight() const;
int getWidth() const override;
int getHeight() const override;

virtual Color getPixel(int x, int y);
Color getPixel(int x, int y) override;
void putPixel(int x, int y, const Color& color) override;

virtual void putPixel(int x, int y, const Color& color);

virtual void convertToDisplayFormat();
void convertToDisplayFormat() override;

protected:
GLuint mTextureHandle;
unsigned int* mPixels;
bool mAutoFree;
int mWidth;
int mHeight;
int mTextureWidth;
int mTextureHeight;

int mTextureWidth;
int mTextureHeight;
};
}

Expand Down
3 changes: 1 addition & 2 deletions include/guisan/opengl/openglsdlimageloader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ namespace gcn

// Inherited from ImageLoader

virtual Image* load(const std::string& filename,
bool convertToDisplayFormat = true)
Image* load(const std::string& filename, bool convertToDisplayFormat = true) override
{
SDL_Surface *loadedSurface = loadSDLSurface(filename);

Expand Down
Loading

0 comments on commit 3aaeae1

Please sign in to comment.