-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.cpp
50 lines (39 loc) · 816 Bytes
/
Core.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
#include "Core.h"
#include "StageManager.h"
#include "ShapeManager.h"
CCore* CCore::m_pInst = nullptr;
CCore::CCore() :
m_bLoop(true)
{
srand((unsigned int)time(0));
}
CCore::~CCore()
{
CShapeManager::DestoryInst();
CStageManager::DestoryInst();
}
bool CCore::Init()
{
m_hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if (m_hConsole == INVALID_HANDLE_VALUE)
return false;
if (!CStageManager::GetInst()->Init())
return false;
return true;
}
void CCore::Run()
{
while (m_bLoop)
{
system("cls");
CShapeManager::GetInst()->Update();
CStageManager::GetInst()->Run();
CShapeManager::GetInst()->Render();
Sleep(100);
}
}
void CCore::SetConsolePos(int x, int y)
{
COORD pos = { (x+1) * 2, y };
SetConsoleCursorPosition(m_hConsole, pos);
}