-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNameBoard.h
56 lines (37 loc) · 994 Bytes
/
NameBoard.h
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
#pragma once
#ifndef SNAKE_NAME_BOARD_H
#define SNAKE_NAME_BOARD_H
#include <string>
#include <vector>
#include <set>
#include <SDL.h>
#include <SDL_ttf.h>
#include "constants.h"
constexpr auto ALPHABET_SIZE = 26;
class NameBoard
{
public:
NameBoard();
~NameBoard();
void changeCurrentPos(int x, int y);
void appendToName();
void backspaceName();
void render(SDL_Renderer*, TTF_Font*);
bool isNameEmpty() const;
std::string getName() const;
size_t getSelection() const;
private:
Pos current = { 0,0 };
int possiablePos[100][100];
size_t selection = 0;
std::string name = "";
const std::string YOUR_NAME = "Your name: ";
const std::string BACKSPACE = "Backspace";
const std::string CONFIRM = "Confirm";
const std::string CANCEL = "Cancel";
const std::string alphabet[ALPHABET_SIZE] = { "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N",
"O", "P", "Q", "R", "S", "T",
"U", "V", "W", "X", "Y", "Z" };
};
#endif // !SNAKE_NAME_BOARD_H