-
Notifications
You must be signed in to change notification settings - Fork 2
/
.merge_file_a06736
80 lines (74 loc) · 1.89 KB
/
.merge_file_a06736
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "CheatState.h"
CheatState::CheatState(State *state, StateData *data) :text("font/enhanced_dot_digital-7.ttf", 30, Text::TEXT_BLENDED, "-", WHITE, 100)
{
SDL_Surface *surface = NULL;
int w, h;
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 400, 40, 32, 0, 0, 0, 0);
SDL_FillRect(surface, NULL, SDL_MapRGB(surface->format, 0, 0, 0));
texture = SDL_CreateTextureFromSurface(Game::GetInstance().GetRenderer(), surface);
SDL_FreeSurface(surface);
SDL_QueryTexture(texture, 0, 0, &w, &h);
box.SetRect(box.GetXrect(), box.GetYrect(), w, h);
this->state = state;
this->data = data;
text.SetPos(512, 300, true, true);
}
CheatState::~CheatState()
{
}
void CheatState::Update(float dt){
Input();
}
void CheatState::Render(){
state->Render();
SDL_Rect dstrec, clipRect;
dstrec.x = 512 - box.GetWrect()/2;
dstrec.y = 300 - box.GetHrect()/2;
dstrec.w = box.GetWrect();
dstrec.h = box.GetHrect();
clipRect.x = 0;
clipRect.y = 0;
clipRect.w = box.GetWrect();
clipRect.h = box.GetHrect();
SDL_RenderCopy(Game::GetInstance().GetRenderer(), texture, &clipRect, &dstrec);
text.Render(0, 0);
}
void CheatState::Input(){
if (InputManager::GetInstance().KeyPress(SDLK_ESCAPE)){
requestDelete = true;
}
if (msg.size() <= 21){
for (char c = 32; c <= 122; c++){
if (InputManager::GetInstance().KeyPress(c)){
msg += c;
text.SetText(msg);
text.SetPos(512, 300, true, true);
}
}
}
if (InputManager::GetInstance().KeyPress(SDLK_BACKSPACE)){
if (msg.size() > 0){
msg.pop_back();
text.SetText(msg);
text.SetPos(512, 300, true, true);
}
}
if (InputManager::GetInstance().KeyPress(SDLK_RETURN)){
ChechCheat();
requestDelete = true;
}
}
void CheatState::ChechCheat(){
if (msg == "gibemonipls"){
<<<<<<< .merge_file_a06736
data->money += 2000;
}
if (msg == "klapaucius"){
=======
>>>>>>> .merge_file_a11392
data->money += 1000;
}
if (msg == "fabulous"){
data->fame += 64;
}
}