/
Main.cpp
92 lines (74 loc) · 1.85 KB
/
Main.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "vtx.h"
#include "Player.h"
#include "2Player.h"
#include "Ball.h"
#include "Bar.h"
#include "Stage.h"
using std::unique_ptr;
using namespace vtx;
enum _GameState
{
GAME_MAIN,
GAME_RESULT,
};
_GameState gs;
//int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
int main()
{
unique_ptr<Lib> lib(new Lib(_T("Ravoidance"), 1280, 720, false));
float angle = -70;
unique_ptr<Camera> camera(new Camera(D3DXVECTOR3(0, cos(D3DXToRadian(angle)) * 22 - 1, sin(D3DXToRadian(angle)) * 22), D3DXVECTOR3(D3DXToRadian(angle + 90), 0, 0)));
unique_ptr<Stage> stage(new Stage());
unique_ptr<Player> player(new Player(D3DXVECTOR3(-5, -4.5, 0), 0));
player->texture[0].Load(_T("Texture/Red.png"));
player->texture[1].Load(_T("Texture/Shadow.png"));
unique_ptr<Player2> player2(new Player2(D3DXVECTOR3(0, -4.5, 5), 0));
player2->texture[0].Load(_T("Texture/Blue.png"));
player2->texture[1].Load(_T("Texture/Shadow.png"));
unique_ptr<BallAdmin> ball_1(new BallAdmin());
unique_ptr<BallAdmin> ball_2(new BallAdmin());
unique_ptr<Bar> bar(new Bar());
gs = GAME_MAIN;
int c = 0;
while (app->wnd->MessageLoop())
{
switch (gs)
{
case GAME_MAIN:
render->Start();
render->Clear(0xff000000);
extern bool GameSet;
if (GameSet == true)
{
c++;
if (c > 100)
gs = GAME_RESULT;
}
stage->Draw();
player->Draw(ball_1.get());
player2->Draw(ball_2.get());
player->Hit(*player2);
player2->Hit(*player);
ball_1->Draw(*player, *player2);
ball_2->Draw_B(*player2, *player);
bar->Draw();
render->End();
break;
case GAME_RESULT:
render->Start();
extern int playerCount;
extern int playerCount2;
if (playerCount > playerCount2)
{
render->Clear(0xff7fffd4);
}
else
{
render->Clear(0xffff6347);
}
render->End();
break;
}
}
return 0;
}