/
killerg_nc.cpp
94 lines (60 loc) · 1.31 KB
/
killerg_nc.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
93
// killerg_nc.cpp : 定义应用程序的入口点。
//
#include "stdafx.h"
#include "common.h"
#include "cfg_file.h"
#include "engine.h"
#include "res_mgr.h"
#include "window.h"
#include "spirit.h"
#include "input.h"
#include "frame_rate.h"
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
Engine::Init();
Input input;
input.Init();
Window window;
window.Init(800, 600, "killerg2d");
ResMgr resmgr;
resmgr.Init();
FrameRate framerate;
framerate.Init(600);
Timer timer;
timer.Init();
SpiritAnimate spirit;
spirit.Init("abc.txt");
int x = 100, y = 100;
int model = 0;
while( !input.IsKeyDown(SDLK_ESCAPE) )
{
timer.Update();
input.Update();
if( input.IsKeyDown(SDLK_LEFT) )
x-=1;
if( input.IsKeyDown(SDLK_RIGHT) )
x+=1;
if( input.IsKeyDown(SDLK_UP) )
y-=1;
if( input.IsKeyDown(SDLK_DOWN) )
y+=1;
if( input.IsKeyDown(SDLK_x) )
spirit.Play();
if( input.IsKeyDown(SDLK_y) )
spirit.Stop();
spirit.Update(timer.GetIntervalF());
window.Clear();
spirit.Draw(&window, x, y);
window.Flush();
framerate.WaitFrame();
}
timer.Destroy();
framerate.Destroy();
resmgr.Destroy();
window.Destroy();
input.Destroy();
Engine::Destroy();
}