Refactor to work on Linux / Unix, fix some compiler errors.

CMakeLists was also modified to make this work, but its scuffed
and i will hold on to that for a while longer
This commit is contained in:
Lion Kortlepel
2020-11-01 02:00:27 +01:00
parent 02fbe72eed
commit 8bc35fb82e
18 changed files with 254 additions and 41 deletions

View File

@@ -3,10 +3,14 @@
///
#include "Lua/LuaSystem.hpp"
#ifdef __WIN32
#include <windows.h>
#include <conio.h>
#else // *nix
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
#endif // __WIN32
#include "Logger.h"
#include <iostream>
#include <conio.h>
#include <string>
#include <thread>
#include <mutex>
@@ -47,6 +51,7 @@ void ConsoleOut(const std::string& msg){
}
}
void SetupConsole(){
#ifdef __WIN32
DWORD outMode = 0;
HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
if (stdoutHandle == INVALID_HANDLE_VALUE){
@@ -66,10 +71,11 @@ void SetupConsole(){
std::this_thread::sleep_for(std::chrono::seconds(3));
exit(GetLastError());
}
#endif // __WIN32
}
[[noreturn]] void ReadCin(){
while (true){
int In = _getch();
int In = getchar();
if (In == 13) {
if(!CInputBuff.empty()) {
HandleInput(CInputBuff);
@@ -90,4 +96,4 @@ void ConsoleInit(){
In.detach();
std::thread Out(OutputRefresh);
Out.detach();
}
}