-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitleScreen.cpp
76 lines (56 loc) · 1.67 KB
/
TitleScreen.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
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
#include "TitleScreen.h"
#include "Controller.h"
void TitleScreen::Load() {
spriteSheets = uiTS.initUI();
uiTS.setBMPid(gfx->CreatingBMP(spriteSheets));
r = 1.0f;
g = 0.0f;
b = 0.0f;
width = gfx->getDimensions(0);
height = gfx->getDimensions(1);
//ScreenToClient(hwnd, &mousePosition);
}
void TitleScreen::Unload() {
}
void TitleScreen::Update(double timeTotal, double timeDelta, std::vector<IA>* inputQue) {
//deal with input queue
if (GetCursorPos(&mousePosition)) {
if (ScreenToClient(hwnd, &mousePosition)) { mPos = {static_cast<float>(mousePosition.x),height - static_cast<float>(mousePosition.y)}; }
//r = abs(mousePosition.x) / width;
}
for (int i = 0; i < inputQue->size(); i++) {
switch (inputQue->at(i).action)
{
case PRIMARY_CLICK:
//r = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
//b = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
//g = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
for (int i = 0; i < uiTS.getSize(); i++) {
if (Collide::pointCollision(mPos, uiTS.getUI(i)->getHitbox()) && uiTS.getUI(i)->checkClickable()) {
uiTS.Triggered(i);
}
}
break;
case SECONDARY_CLICK:
r = 1.f;
b = 1.f;
g = 1.f;
break;
default:
break;
}
}
inputQue->clear();
}
void TitleScreen::Update(double timeTotal, double timeDelta) {
}
void TitleScreen::Update(State::GameAction action, LPARAM lparam, WPARAM wparam) {
//Xpos = GET_X_LPARAM(lparam);
//Ypos = GET_Y_LPARAM(lparam);
//sxPos = gfx->PixelsToDipsX(Xpos);
//syPos = gfx->PixelsToDipsY(Ypos);
}
void TitleScreen::Render() {
gfx->ClearScreen(r, g, b);
gfx->DrawUI(uiTS.getUIs(), uiTS.getBMPid());
}