mirror of
https://github.com/simtactics/niotso.git
synced 2025-03-22 10:52:20 +00:00
Realized I had forgotten to initialize the UserInput struct to 0.
This commit is contained in:
parent
551f3c834f
commit
705da4ba5c
8 changed files with 17 additions and 18 deletions
|
@ -19,4 +19,5 @@
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
int Initialize();
|
int Initialize();
|
||||||
|
void Shutdown();
|
||||||
}
|
}
|
|
@ -24,8 +24,6 @@ HANDLE Thread;
|
||||||
IXAudio2 *pXAudio2 = NULL;
|
IXAudio2 *pXAudio2 = NULL;
|
||||||
IXAudio2MasteringVoice *MasterVoice = NULL;
|
IXAudio2MasteringVoice *MasterVoice = NULL;
|
||||||
|
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
int Initialize(){
|
int Initialize(){
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
|
|
|
@ -74,13 +74,13 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||||
return ERROR_INIT | ERROR_INIT_LOGIC | ERROR_LOGIC_CREATE_SCENE;
|
return ERROR_INIT | ERROR_INIT_LOGIC | ERROR_LOGIC_CREATE_SCENE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LARGE_INTEGER PreviousTime;
|
|
||||||
QueryPerformanceCounter(&PreviousTime);
|
|
||||||
|
|
||||||
ShowWindow(Window::hWnd, SW_SHOW);
|
ShowWindow(Window::hWnd, SW_SHOW);
|
||||||
SetForegroundWindow(Window::hWnd);
|
SetForegroundWindow(Window::hWnd);
|
||||||
SetFocus(Window::hWnd);
|
SetFocus(Window::hWnd);
|
||||||
|
|
||||||
|
LARGE_INTEGER PreviousTime;
|
||||||
|
QueryPerformanceCounter(&PreviousTime);
|
||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
|
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
|
||||||
|
@ -102,17 +102,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
||||||
|
|
||||||
PreviousTime.QuadPart = CurrentTime.QuadPart;
|
PreviousTime.QuadPart = CurrentTime.QuadPart;
|
||||||
QueryPerformanceCounter(&CurrentTime);
|
QueryPerformanceCounter(&CurrentTime);
|
||||||
unsigned SleepDuration = (unsigned)
|
float SleepDuration =
|
||||||
((System::FramePeriod - (float)(CurrentTime.QuadPart-PreviousTime.QuadPart)/System::ClockFreq.QuadPart) * 1000);
|
(System::FramePeriod - (float)(CurrentTime.QuadPart-PreviousTime.QuadPart)/System::ClockFreq.QuadPart) * 1000;
|
||||||
if(SleepDuration > 1) Sleep(SleepDuration);
|
if(SleepDuration > 1) Sleep((unsigned) SleepDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG msg;
|
ShowWindow(Window::hWnd, SW_HIDE);
|
||||||
while(GetMessage(&msg, NULL, 0, 0))
|
Audio::Shutdown();
|
||||||
{
|
Graphics::Shutdown();
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
Shutdown();
|
Shutdown();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
//Graphics/Startup.cpp
|
//Graphics/Startup.cpp
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
int Initialize();
|
int Initialize();
|
||||||
|
void Shutdown();
|
||||||
extern HDC hDC;
|
extern HDC hDC;
|
||||||
extern HGLRC hRC;
|
extern HGLRC hRC;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ HANDLE Thread;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
HGLRC hRC;
|
HGLRC hRC;
|
||||||
|
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
int Initialize(){
|
int Initialize(){
|
||||||
hDC = GetDC(Window::hWnd);
|
hDC = GetDC(Window::hWnd);
|
||||||
if(hDC == NULL){
|
if(hDC == NULL){
|
||||||
|
|
|
@ -44,6 +44,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
System::UserInput.CloseWindow = true;
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,9 @@ class LoginScreen : public Scene {
|
||||||
int Run(float){
|
int Run(float){
|
||||||
if(System::UserInput.CloseWindow){
|
if(System::UserInput.CloseWindow){
|
||||||
System::Shutdown = true;
|
System::Shutdown = true;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -27,6 +27,8 @@ namespace System {
|
||||||
UserInput_t UserInput;
|
UserInput_t UserInput;
|
||||||
|
|
||||||
int Initialize(){
|
int Initialize(){
|
||||||
|
memset(&UserInput, 0, sizeof(UserInput));
|
||||||
|
|
||||||
QueryPerformanceFrequency(&ClockFreq);
|
QueryPerformanceFrequency(&ClockFreq);
|
||||||
|
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
|
|
Loading…
Add table
Reference in a new issue