You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
602 B
C
32 lines
602 B
C
6 years ago
|
#pragma once
|
||
6 years ago
|
#include <allegro5/allegro.h>
|
||
|
#include <allegro5/allegro_font.h>
|
||
6 years ago
|
#include <vector>
|
||
|
|
||
6 years ago
|
//Default object used for menues
|
||
6 years ago
|
template <class T>
|
||
|
class Cursor {
|
||
|
public:
|
||
|
std::vector<T> items;
|
||
6 years ago
|
unsigned int selected;
|
||
6 years ago
|
bool active;
|
||
|
|
||
|
Cursor();
|
||
|
|
||
|
void activate(std::vector<T> _items);
|
||
|
void deactivate();
|
||
|
void draw(float _x_start, float _y_start, float _y_offset, ALLEGRO_FONT* _font);
|
||
|
void up();
|
||
|
void down();
|
||
|
T get_selected();
|
||
|
|
||
|
private:
|
||
|
float x_start;
|
||
|
float y_start;
|
||
|
float y_offset;
|
||
|
ALLEGRO_FONT* font;
|
||
|
|
||
|
std::vector<std::string> get_item_strings();
|
||
|
void update_selector();
|
||
|
void redraw();
|
||
|
};
|