Add GUI Support
This commit is contained in:
33
include/TessesFramework/SDL2/Views/AbsoluteView.hpp
Normal file
33
include/TessesFramework/SDL2/Views/AbsoluteView.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class AbsoluteView : public ContainerView {
|
||||
std::vector<std::pair<std::pair<View*,bool>,SDL_Rect>> views;
|
||||
protected:
|
||||
void OnDraw(SDL_Renderer* renderer, SDL_Rect& myRect);
|
||||
bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
size_t ViewCount();
|
||||
View* GetViewAt(size_t index);
|
||||
AbsoluteView();
|
||||
void Add(SDL_Rect rect, View* view, bool owns=true);
|
||||
void Set(View* view, SDL_Rect rect);
|
||||
void Remove(View* view);
|
||||
~AbsoluteView();
|
||||
|
||||
};
|
||||
|
||||
/* class AbsoluteContainer : public View {
|
||||
std::vector<std::pair<std::pair<View*,bool>,SDL_Rect>> views;
|
||||
public:
|
||||
void Add(SDL_Rect rect, View* view, bool owns=true);
|
||||
void Set(View* view, SDL_Rect rect);
|
||||
void Remove(View* view);
|
||||
|
||||
~AbsoluteContainer();
|
||||
};*/
|
||||
}
|
||||
#endif
|
||||
18
include/TessesFramework/SDL2/Views/ButtonView.hpp
Normal file
18
include/TessesFramework/SDL2/Views/ButtonView.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class ButtonView : public View {
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
|
||||
public:
|
||||
ButtonView();
|
||||
ButtonView(std::string text);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
25
include/TessesFramework/SDL2/Views/CheckView.hpp
Normal file
25
include/TessesFramework/SDL2/Views/CheckView.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class CheckView : public View {
|
||||
protected:
|
||||
virtual void OnCheckChanged(GUIEventArgs& event);
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
|
||||
public:
|
||||
CheckView(bool checked, std::string label);
|
||||
CheckView();
|
||||
|
||||
virtual bool GetChecked();
|
||||
virtual void SetChecked(bool value);
|
||||
|
||||
|
||||
|
||||
EventList<View*,GUIEventArgs&> CheckChanged;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
15
include/TessesFramework/SDL2/Views/LabelView.hpp
Normal file
15
include/TessesFramework/SDL2/Views/LabelView.hpp
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class LabelView : public View {
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
public:
|
||||
LabelView();
|
||||
LabelView(std::string text);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
17
include/TessesFramework/SDL2/Views/ProgressView.hpp
Normal file
17
include/TessesFramework/SDL2/Views/ProgressView.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class ProgressView : public View
|
||||
{
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
public:
|
||||
ProgressView();
|
||||
ProgressView(double value);
|
||||
double value;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
20
include/TessesFramework/SDL2/Views/TextListView.hpp
Normal file
20
include/TessesFramework/SDL2/Views/TextListView.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#if defined(TESSESFRAMEWORK_ENABLE_SDL2)
|
||||
#include "../GUI.hpp"
|
||||
|
||||
namespace Tesses::Framework::SDL2::Views
|
||||
{
|
||||
class TextListView : public View {
|
||||
|
||||
protected:
|
||||
virtual void OnDraw(SDL_Renderer* renderer, SDL_Rect& r);
|
||||
virtual bool OnEvent(SDL_Event& event, SDL_Rect& myBounds, SDL_Rect& visibleBounds);
|
||||
public:
|
||||
TextListView();
|
||||
size_t firstIndex;
|
||||
int selected;
|
||||
std::vector<std::string> items;
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user