-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cubes.h
94 lines (74 loc) · 2.26 KB
/
Cubes.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
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
94
#pragma once
#include "stdafx.h"
#include "resource.h"
#include "TestEnvironment.h"
class RenderContext;
class FramerateCounter;
class CubeRendererInterface;
class UserInterface;
class Camera;
class Input;
class SkeletalModel;
/* The main application class (Singleton)
Owns instances of all other classes, creates the application window and handles keyboad input */
class AnimaApplication
{
static const int DISPLAY_WIDTH = 1280;
static const int DISPLAY_HEIGHT = 720;
static const int INPUT_DELAY = 50;
RenderContext* mRenderContext;
FramerateCounter* mFramerateCounter;
UserInterface* mUserInterface;
TestEnvironment* mTestEnvironment;
Camera* mCamera;
Input* mInput;
SkeletalModel* mModel;
WNDCLASSEX mWindowClass;
HWND mWindowHandle;
AnimaApplication(){}
AnimaApplication( WNDCLASSEX windowClass, HWND windowHandle ) : mWindowClass( windowClass ), mWindowHandle( windowHandle ){}
static AnimaApplication* mInstance;
float mModelRotationAngle;
aiQuaternion mModelRotation;
bool mRotateModel;
unsigned __int64 mFrameCounter;
class DeltaTime
{
LARGE_INTEGER TicksPerSecond;
LARGE_INTEGER LastTick;
float Delta;
public:
DeltaTime()
{
QueryPerformanceFrequency( &TicksPerSecond );
QueryPerformanceCounter( &LastTick );
Delta = 0.f;
}
void Update()
{
LARGE_INTEGER curTick;
QueryPerformanceCounter( &curTick );
Delta = float(double(curTick.QuadPart - LastTick.QuadPart)/TicksPerSecond.QuadPart);
LastTick = curTick;
}
float Elapsed()
{
return Delta;
}
} mDeltaTime;
public:
~AnimaApplication();
static HRESULT CreateInstance( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow);
static void DestroyInstance();
static AnimaApplication* Instance() { return mInstance; }
void Run();
void NextFrame(); // update and render the next frame
void ProcessInput();
void EnableInput();
void SetTestEnvironment( TestEnvironment* testEnvironment ) { mTestEnvironment = testEnvironment; }
const TestEnvironment* GetTestEnvironment() { return mTestEnvironment; }
LRESULT OnMessage(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
void OnDeviceLost();
void OnDeviceReset();
void TestDeviceLost();
};