Show available missions
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum class Alignment { LEFT, RIGHT, CENTER };
|
||||
struct PositionInfo {
|
||||
@ -25,6 +26,10 @@ public:
|
||||
virtual void set_position(int x, int y);
|
||||
virtual void set_alignment(Alignment align);
|
||||
|
||||
int get_width();
|
||||
int get_height();
|
||||
const PositionInfo& get_position();
|
||||
|
||||
virtual void draw() = 0;
|
||||
|
||||
protected:
|
||||
@ -68,4 +73,23 @@ protected:
|
||||
std::string text;
|
||||
|
||||
SDL_Texture* generate_text(const std::string& text);
|
||||
};
|
||||
|
||||
class ListWidget : public Widget {
|
||||
public:
|
||||
ListWidget(SDL_Renderer* renderer, int element_height,
|
||||
Alignment element_alignment);
|
||||
virtual ~ListWidget();
|
||||
|
||||
void add_element(Widget* element);
|
||||
|
||||
virtual void draw() override;
|
||||
|
||||
protected:
|
||||
int element_height;
|
||||
Alignment element_alignment;
|
||||
|
||||
std::vector<Widget*> elements;
|
||||
|
||||
void place_element(Widget* element, int index);
|
||||
};
|
||||
Reference in New Issue
Block a user