forked from DKU-EmbeddedSystem-Lab/2025_DKU_OpenSourceBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContent2MenuState.cpp
More file actions
59 lines (47 loc) · 1.59 KB
/
Content2MenuState.cpp
File metadata and controls
59 lines (47 loc) · 1.59 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
58
59
#include "content2menustate.hpp"
#include "game.hpp"
#include "config.hpp"
#include "gamestate.hpp"
#include "optionsstate.hpp"
Content1MenuState::Content2MenuState(InputManager* manager)
: MenuState(manager) {}
void Content2MenuState::initialize() {
// 제목 텍스트
title_text = new Texture();
title_text->loadFromText("Content 2 Menu", Game::getInstance()->mRenderer->bigFont, config::default_text_color);
// 기존 버튼 제거
for (auto button : mButtons)
delete button;
mButtons.clear();
int buttonWidth = 200;
int buttonHeight = 50;
int centerX = (config::logical_window_width - buttonWidth) / 2;
// 버튼 추가
addButton(new Button(
"Start Content",
[]() { Game::getInstance()->pushNewState<ModeSelectState>(); },
centerX, 130, buttonWidth, buttonHeight
));
addButton(new Button(
"Options",
[]() {
std::cout << "ContentOption" << std::endl;
/*Game::getInstance()->pushNewState<Content2OptionsState>();*/
},
centerX, 190, buttonWidth, buttonHeight
));
addButton(new Button(
"Back",
[]() { Game::getInstance()->goBack(); },
centerX, 250, buttonWidth, buttonHeight
));
}
void Content2MenuState::draw() {
Game::getInstance()->mRenderer->clearScreen();
if (title_text)
title_text->renderCentered(config::logical_window_width / 2, 50);
for (auto button : mButtons)
button->draw();
SelectionInputHandler::renderHighlight(mButtons, index);
Game::getInstance()->mRenderer->updateScreen();
}