-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (35 loc) · 773 Bytes
/
main.cpp
File metadata and controls
40 lines (35 loc) · 773 Bytes
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
#include "renderer.h"
#include "pbody.h"
#include "ui.h"
#include "simulator.h"
#include <conio.h>
#define tmr1 1
#define tmr2 2
renderer rend;
ui UI;
simulator simul;
void __stdcall tmr(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
simul.process();
UI.update();
rend.Draw();
UI.fpstmp++;
}
void __stdcall tmrfps(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
UI.fps = UI.fpstmp;
UI.fpstmp = 0;
}
int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
CWinApp MyApp;
rend.Create();
rend.init(&simul, &UI);
simul.init(&rend, &UI);
UI.init(&simul, &rend);
SetTimer(rend.GetHwnd(), tmr1, 0, tmr);
SetTimer(rend.GetHwnd(), tmr2, 1000, tmrfps);
return MyApp.Run();
KillTimer (rend.GetHwnd(), tmr1);
KillTimer (rend.GetHwnd(), tmr2);
}