-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionSelector.h
More file actions
34 lines (25 loc) · 856 Bytes
/
OptionSelector.h
File metadata and controls
34 lines (25 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include "SelectorArrow.h"
#include "Option.h"
#include <SFML/Window/Mouse.hpp>
#include <SFML/Window/Keyboard.hpp>
class OptionSelector : public sf::Drawable
{
public:
OptionSelector(const std::vector<std::string> &optionStrings);
virtual ~OptionSelector() {}
void update(float deltaTime);
void updateOnMouseMove(const sf::Vector2f &worldMousePosition);
void updateOnMouseButtonPress(sf::Mouse::Button button);
void updateOnKeyPress(sf::Keyboard::Key key);
void draw(sf::RenderTarget &target, sf::RenderStates states) const override;
protected:
std::vector<Option> options_;
SelectorArrow selectorArrow_;
size_t selectedOptionIndex_;
virtual void selectOption_();
void decrementSelectedOptionIndex_();
void incrementSelectedOptionIndex_();
void updateSelectorPosition_();
void setSelectedOptionIndex_(size_t index);
};