Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.5 kB
1
Indexable
Never
button.h

#pragma once
#ifndef BUTTON_H
#define BUTTON_H

#include <SFML/Graphics.hpp>

class Button
{
public:
    Button();
    virtual ~Button() = default;
    virtual void responseToMouse(sf::RenderWindow& window) = 0;
    virtual void update(float dt) = 0;
    virtual void draw(sf::RenderWindow& window) = 0;
protected:
    float x, y, width, height;
};

#endif // !BUTTON_H

staticbutton.h

#pragma once
#ifndef STATICBUTTON_H
#define STATICBUTTON_H

#include "../codes/UI/buttons/button.h"

class StaticButton : public Button
{
public:
    StaticButton();
    StaticButton(float px, float py, float pwidth, float pheight);
    ~StaticButton();
    virtual void responseToMouse(sf::RenderWindow& window) override;
    virtual void update(float dt) override;
    virtual void draw(sf::RenderWindow& window) override;
};

#endif // !STATICBUTTON_H

staticbutton.cpp

include <../codes/UI/buttons/staticbutton.h>

StaticButton::StaticButton()
{

}

StaticButton::StaticButton(float px = 0, float py = 0, float pwidth = 100, float pheight = 100) : x{px}, y{py}, width{pwidth}, height{pheight}
{
    
}

StaticButton::~StaticButton()
{

}

void StaticButton::responseToMouse(sf::RenderWindow& window)
{

}

void StaticButton::update(float dt)
{

}

void StaticButton::draw(sf::RenderWindow& window)
{

}


button.cpp

#include <../codes/UI/buttons/button.h>

Button::Button()
{

}