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.

34 lines
621 B
C++

#pragma once
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <vector>
#include <string>
//Default object used for menues
template <class T>
class Cursor {
public:
std::vector<T> items;
unsigned int selected;
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();
};