-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuSettings.cpp
49 lines (39 loc) · 1.01 KB
/
MenuSettings.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 "MenuSettings.h"
#include "WorldConstants.h"
using namespace std;
using namespace world_constants;
MenuSettings::MenuSettings(ScreenBuffer *screenBuffer):
Screen(screenBuffer)
{
m_controlTexts.push_back("[A] - Move Left");
m_controlTexts.push_back("[D] - Move Right");
m_controlTexts.push_back("[S] - Faster Down");
m_controlTexts.push_back("[O] - Rotate Left");
m_controlTexts.push_back("[P] - Rotate Right");
m_controlTexts.push_back("[0] - Pause Game");
}
void MenuSettings::handleInput()
{
}
void MenuSettings::update()
{
}
void MenuSettings::fillScreenBuffer()
{
drawBorder();
drawCloseText();
const string ControlText = "CONTROL:";
m_screenBuffer->add(getCenterPosX(ControlText), 2, ControlText);
const int StartX = 3;
int textY = 4;
for (const string Text : m_controlTexts)
{
m_screenBuffer->add(StartX, textY, Text);
textY += 2;
}
void drawCloseText();
}
int MenuSettings::getCenterPosX(const string Text) const
{
return static_cast<int>( (SCREEN_WIDTH / 2) - (Text.length() / 2) );
}