Remove some files
This commit is contained in:
parent
c793ed6c55
commit
a5a2c25a44
23 changed files with 0 additions and 779 deletions
|
|
@ -1,36 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.27.0)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
project(canvasprogramserver)
|
||||
|
||||
set(sources "servermain.cpp"
|
||||
"MainServer.cpp"
|
||||
"ClientData.cpp"
|
||||
"../../include/Helpers/Networking/NetServer.cpp"
|
||||
"../../include/Helpers/Networking/NetClient.cpp"
|
||||
"../../include/Helpers/Networking/ByteStream.cpp"
|
||||
"../../include/Helpers/Random.cpp"
|
||||
"../DrawComponents/DrawBrushStroke.cpp"
|
||||
"../DrawComponents/DrawComponent.cpp"
|
||||
"../DrawComponents/DrawEllipse.cpp"
|
||||
"../DrawComponents/DrawRectangle.cpp"
|
||||
"../DrawComponents/DrawTextBox.cpp"
|
||||
"../DrawComponents/DrawImage.cpp"
|
||||
)
|
||||
|
||||
|
||||
find_package(GameNetworkingSockets)
|
||||
add_executable(canvasprogramserver ${sources})
|
||||
target_compile_definitions(canvasprogramserver PRIVATE IS_SERVER)
|
||||
|
||||
if(WIN32)
|
||||
set_property(TARGET canvasprogramserver PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
target_include_directories(canvasprogramserver PRIVATE "../../include" "../..")
|
||||
target_link_libraries(canvasprogramserver GameNetworkingSockets::shared)
|
||||
else()
|
||||
target_include_directories(canvasprogramserver PRIVATE "../../include" "../.." "../../../GameNetworkingSockets/include")
|
||||
target_compile_options(canvasprogramserver PRIVATE -O3)
|
||||
target_link_options(canvasprogramserver PRIVATE -O3)
|
||||
target_link_libraries(canvasprogramserver GameNetworkingSockets::shared)
|
||||
endif()
|
||||
|
||||
install(TARGETS canvasprogramserver DESTINATION bin)
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
#include "MainServer.hpp"
|
||||
#include "steam/steamnetworkingsockets.h"
|
||||
#include "steam/steamnetworkingtypes.h"
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
std::mutex inputMutex;
|
||||
std::queue<std::string> inputQueue;
|
||||
|
||||
std::unique_ptr<std::thread> inputThread;
|
||||
|
||||
void user_input_init() {
|
||||
inputThread = std::make_unique<std::thread>([&]() {
|
||||
for(;;) {
|
||||
std::string newMessage;
|
||||
std::cin >> newMessage;
|
||||
inputMutex.lock();
|
||||
inputQueue.emplace(newMessage);
|
||||
inputMutex.unlock();
|
||||
if(newMessage == "stop")
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
SteamDatagramErrMsg errMsg;
|
||||
if(!GameNetworkingSockets_Init(nullptr, errMsg))
|
||||
std::cout << "[GameNetworkingSockets_Init] Failed to initialize network sockets " << errMsg << std::endl;
|
||||
|
||||
MainServer server("");
|
||||
user_input_init();
|
||||
for(;;) {
|
||||
server.update();
|
||||
inputMutex.lock();
|
||||
bool isQuitting = false;
|
||||
while(!inputQueue.empty()) {
|
||||
std::string newMessage = inputQueue.front();
|
||||
inputQueue.pop();
|
||||
if(newMessage == "stop") {
|
||||
isQuitting = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
std::cout << "Unknown command: " << newMessage << std::endl;
|
||||
}
|
||||
}
|
||||
inputMutex.unlock();
|
||||
if(isQuitting)
|
||||
break;
|
||||
}
|
||||
inputThread->join();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue