-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuBar.cpp
49 lines (45 loc) · 1.65 KB
/
MenuBar.cpp
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
#include "MenuBar.h"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// All Initial Setting ---------------------------------------
MenuBar::MenuBar(){
x = 0;
y = 0;
}
void MenuBar::VecSet(vector<string> vector, sf::String title, float width){
// string s = "Menu" + to_string(i);
sf::String T = title;
Menu menu; // each Small Menu inside Bar
// menu.itemSet(s);
// menu.itemlistSet(vector);
// menu.SetSize(40);
// menu.setPosition(x,y);
menu.MenuSum(title,vector, 40, {x, y}, width);
// cout << "Menu Set" << i << endl;
// cout << x << " Sucessfule Insert THE MENU " << endl;
cout << menu.GetPosition().x << ", " << menu.GetPosition().y << endl << endl;
bar.push_back(menu);
x += width;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//AddEVentHandle Updata Window DRAW -------------------------------
void MenuBar::draw(sf::RenderTarget& window, sf::RenderStates states) const{
auto iter = bar.cbegin();
for(;iter != bar.cend(); ++iter){
window.draw(*iter);
}
}
void MenuBar::addEventHandler(sf::RenderWindow& window, sf::Event event){
auto iter = bar.begin();
for(;iter != bar.end(); ++iter){
(*iter).menuSet(menu);
(*iter).addEventHandler(window,event);
(*iter).update();
menu = (*iter).getMenu();
if(State::isStateEnabled(State::BAR)){
click = (*iter).ReturnClickItem();
// cout << click << endl;
}
}
}
void MenuBar::update(){
}