-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFontStyleChooser.cpp
More file actions
46 lines (37 loc) · 1.35 KB
/
Copy pathFontStyleChooser.cpp
File metadata and controls
46 lines (37 loc) · 1.35 KB
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
35
36
37
38
39
40
41
42
43
44
45
//
// Created by jonng on 6/5/2021.
//
#include "FontStyleChooser.h"
FontStyleChooser::FontStyleChooser() {
font_dropdown_menu.setOutlineThickness(1.f);
font_label.setCharacterSize(17);
font_label.setString("Font Style");
font_dropdown_menu.addItem("ARCADE");
font_dropdown_menu.addItem("GREAT VIBES");
font_dropdown_menu.addItem("MILKY NICE");
font_dropdown_menu.addItem("OPEN SANS");
font_dropdown_menu.addItem("THE FLESH");
font_dropdown_menu.setDisplayedItem("MILKY NICE");
font_dropdown_menu.setSize({260.f,30.f});
setPosition({765.f,120.f});
}
void FontStyleChooser::addEventHandler(RenderWindow &window, sf::Event event) {
font_dropdown_menu.addEventHandler(window,event);
}
void FontStyleChooser::setPosition(sf::Vector2f position) {
font_label.setPosition(position);
font_dropdown_menu.setPosition({position.x,position.y+font_label.getGlobalBounds().height + 10.f});
}
void FontStyleChooser::draw(RenderTarget &window, sf::RenderStates state) const {
window.draw(font_label);
window.draw(font_dropdown_menu);
}
std::string FontStyleChooser::getFontChoice() {
return font_dropdown_menu.getDisplayedItem();
}
void FontStyleChooser::setFontChoice(const std::string& fontChoice) {
font_dropdown_menu.setDisplayedItem(fontChoice);
}
void FontStyleChooser::reset() {
setFontChoice("MILKY NICE");
}