2017-03-02 12:18:59 +08:00
|
|
|
#pragma once
|
|
|
|
#include "MiniEngine.h"
|
|
|
|
#include <functional>
|
|
|
|
|
2017-03-02 13:13:05 +08:00
|
|
|
namespace MiniEngine
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace Widget
|
|
|
|
{
|
|
|
|
|
|
|
|
class Brush : public Renderer
|
2017-03-02 12:18:59 +08:00
|
|
|
{
|
|
|
|
public:
|
2017-03-02 13:13:05 +08:00
|
|
|
void setArea(Rect Area);
|
|
|
|
void setFullArea(Rect FullArea);
|
2017-03-02 12:18:59 +08:00
|
|
|
|
2017-03-02 13:13:05 +08:00
|
|
|
int copy(Texture t, Rect src, Rect dst);
|
|
|
|
int copyTo(Texture t, Rect dst);
|
|
|
|
int copyTo(Texture t, Point lupoint);
|
|
|
|
int copyFill(Texture t,Rect src);
|
|
|
|
int copyFullFill(Texture t);
|
2017-03-02 12:18:59 +08:00
|
|
|
private:
|
2017-03-02 13:13:05 +08:00
|
|
|
Rect area,fullarea;
|
2017-03-02 12:18:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Board
|
|
|
|
{
|
|
|
|
public:
|
2017-03-02 13:13:05 +08:00
|
|
|
Board(Rect Area);
|
2017-03-02 12:18:59 +08:00
|
|
|
Brush getBrush();
|
2017-03-02 13:13:05 +08:00
|
|
|
Rect getArea();
|
2017-03-02 12:18:59 +08:00
|
|
|
private:
|
2017-03-02 13:13:05 +08:00
|
|
|
Rect area;
|
2017-03-02 12:18:59 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Drawable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void draw(Brush& brush)=0;
|
|
|
|
virtual ~Drawable()=default;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Interactive
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void handle(SDL_Event e,int& running,int& update)=0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ButtonBase : public Drawable, public Interactive
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ButtonBase();
|
2017-03-02 13:13:05 +08:00
|
|
|
void setTextureNormal(Texture Normal);
|
|
|
|
void setTextureMouseover(Texture Mouseover);
|
|
|
|
void setTextureClicked(Texture Clicked);
|
|
|
|
void setRect(Rect SensorArea);
|
2017-03-02 12:18:59 +08:00
|
|
|
virtual void draw(Brush& brush);
|
|
|
|
virtual void handle(SDL_Event e,int& running,int& update);
|
|
|
|
private:
|
|
|
|
int status;
|
2017-03-02 13:13:05 +08:00
|
|
|
Texture t1,t2,t3;
|
|
|
|
Rect rect;
|
2017-03-02 12:18:59 +08:00
|
|
|
};
|
2017-03-02 13:13:05 +08:00
|
|
|
|
|
|
|
}/// End of namespace MiniEngine::Widget
|
|
|
|
|
|
|
|
}/// End of namespace MiniEngine
|