Minor changes

This commit is contained in:
Grayson Riffe (Laptop) 2021-08-24 11:09:07 -05:00
parent e17d2e283a
commit 1f6bb4630c
5 changed files with 15 additions and 13 deletions

View File

@ -66,7 +66,7 @@ namespace nf {
showWindow(true);
m_running = true;
MSG msg = { };
std::thread mainThread(&Application::startMainThread, this);
std::thread mainThread(&Application::runMainGameThread, this);
while (m_running) {
while (PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)) {
TranslateMessage(&msg);
@ -140,7 +140,7 @@ namespace nf {
m_currentState = m_sIntro;
}
void Application::startMainThread() {
void Application::runMainGameThread() {
m_renderer = new Renderer(this);
startIntroState();
std::chrono::steady_clock::time_point start_time = std::chrono::steady_clock::now();
@ -184,7 +184,7 @@ namespace nf {
Error("Cannot run two NF applications at once!");
}
}
//TODO: Test fullscreen graphcis
void Application::toggleFullscreen() {
DWORD wndStyle = GetWindowLong(m_window, GWL_STYLE);
if (wndStyle & WS_OVERLAPPEDWINDOW) {
@ -231,8 +231,10 @@ namespace nf {
}
case WM_SYSKEYDOWN: {
if (GetKeyState(VK_RETURN) & 0x8000) {
app->m_currentConfig.fullscreen = !app->m_currentConfig.fullscreen;
app->toggleFullscreen();
if (!(lParam & (1 << 30))) {
app->m_currentConfig.fullscreen = !app->m_currentConfig.fullscreen;
app->toggleFullscreen();
}
return 0;
}
break;
@ -297,4 +299,4 @@ namespace nf {
delete curr;
}
}
}
}

View File

@ -3,7 +3,6 @@
#include <iostream>
#include <sstream>
#include <fstream>
#include <Windows.h>
#include "Config.h"

View File

@ -31,7 +31,7 @@ namespace nf {
~Application();
private:
void startIntroState();
void startMainThread();
void runMainGameThread();
void registerWindowClass();
void toggleFullscreen();
RECT getWindowRect() const;

View File

@ -1,6 +1,7 @@
#pragma once
#include <chrono>
#include <string>
#include <Windows.h>
namespace nf {
#ifdef _DEBUG

View File

@ -4,13 +4,13 @@
#include "VertexBuffer.h"
namespace nf {
struct VertexBufferElement {
unsigned int type;
unsigned int count;
unsigned char normalized;
};
class VertexArray {
struct VertexBufferElement {
unsigned int type;
unsigned int count;
unsigned char normalized;
};
public:
VertexArray();