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

View File

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

View File

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

View File

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

View File

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