-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuBar.cpp
More file actions
57 lines (41 loc) · 1.05 KB
/
MenuBar.cpp
File metadata and controls
57 lines (41 loc) · 1.05 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
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by Kristal Hong on 11/27/23.
//
#include "MenuBar.h"
MenuBar::MenuBar() {
}
void MenuBar::addMenu(Menu menu) {
menus.push_back(menu);
setPosition({menus[0].getGlobalBounds().left, menus[0].getGlobalBounds().top});
}
void MenuBar::setPosition(sf::Vector2f position) {
if(!menus.empty())
{
menus[0].setPosition(position);
for (int i = 1; i < menus.size() ; ++i) {
Position::right(menus[i-1], menus[i], 2);
}
}
}
void MenuBar::setMenuSize(sf::Vector2f size) {
for (auto& menu : menus) {
menu.setItemSize(size);
}
}
void MenuBar::addEventHandler(sf::RenderWindow& window, sf::Event event) {
for (auto& menu : menus) {
menu.addEventHandler(window, event);
}
}
void MenuBar::draw(sf::RenderTarget& window, sf::RenderStates states) const {
for (const auto& menu : menus) {
window.draw(menu, states);
}
}
void MenuBar::update() {
}
Snapshot MenuBar::getSnapshot() {
return Snapshot();
}
void MenuBar::applySnapshot(const Snapshot &snapshot) {
}