Try my best on network
This commit is contained in:
parent
738c48fffd
commit
29b106d002
@ -10,4 +10,5 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
|
|
||||||
add_subdirectory(deerith_engine_core)
|
add_subdirectory(deerith_engine_core)
|
||||||
add_subdirectory(deerith_engine_client)
|
add_subdirectory(deerith_engine_client)
|
||||||
|
add_subdirectory(deerith_engine_server)
|
||||||
add_subdirectory(sandbox)
|
add_subdirectory(sandbox)
|
||||||
@ -1,6 +1,5 @@
|
|||||||
find_package(glfw3 REQUIRED)
|
find_package(glfw3 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(glm REQUIRED)
|
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(IMGUI REQUIRED imgui)
|
pkg_check_modules(IMGUI REQUIRED imgui)
|
||||||
@ -29,7 +28,6 @@ target_link_libraries(DeerithClient
|
|||||||
DeerithCore
|
DeerithCore
|
||||||
OpenGL::GL
|
OpenGL::GL
|
||||||
glfw
|
glfw
|
||||||
glm::glm
|
|
||||||
${IMGUI_LIBRARIES}
|
${IMGUI_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
1
deerith_engine_client/include/deerith/network/network.h
Normal file
1
deerith_engine_client/include/deerith/network/network.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
#
|
||||||
@ -2,6 +2,7 @@ add_library(DeerithCore)
|
|||||||
|
|
||||||
find_package(spdlog REQUIRED)
|
find_package(spdlog REQUIRED)
|
||||||
find_package(fmt REQUIRED)
|
find_package(fmt REQUIRED)
|
||||||
|
find_package(glm REQUIRED)
|
||||||
|
|
||||||
file(GLOB_RECURSE DEERITH_CORE_SOURCES
|
file(GLOB_RECURSE DEERITH_CORE_SOURCES
|
||||||
CONFIGURE_DEPENDS
|
CONFIGURE_DEPENDS
|
||||||
@ -22,4 +23,5 @@ target_link_libraries(DeerithCore
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
spdlog::spdlog
|
spdlog::spdlog
|
||||||
fmt::fmt
|
fmt::fmt
|
||||||
|
glm::glm
|
||||||
)
|
)
|
||||||
8
deerith_engine_core/include/deerith/network/client.h
Normal file
8
deerith_engine_core/include/deerith/network/client.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace deerith
|
||||||
|
{
|
||||||
|
class Client
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
6
deerith_engine_core/include/deerith/network/network.h
Normal file
6
deerith_engine_core/include/deerith/network/network.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace deerith
|
||||||
|
{
|
||||||
|
void connect_to_server();
|
||||||
|
}
|
||||||
9
deerith_engine_core/include/deerith/world/world.h
Normal file
9
deerith_engine_core/include/deerith/world/world.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace deerith
|
||||||
|
{
|
||||||
|
using world_tick_function = std::function<void(int current_tick)>;
|
||||||
|
|
||||||
|
void set_world_tick_callback(world_tick_function *tick_function);
|
||||||
|
}
|
||||||
21
deerith_engine_server/CMakeLists.txt
Normal file
21
deerith_engine_server/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
add_library(DeerithServer)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE deerith_server_SOURCES
|
||||||
|
CONFIGURE_DEPENDS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_sources(DeerithServer
|
||||||
|
PRIVATE
|
||||||
|
${deerith_server_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(DeerithServer
|
||||||
|
PUBLIC
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(DeerithServer
|
||||||
|
PUBLIC
|
||||||
|
DeerithCore
|
||||||
|
)
|
||||||
0
deerith_engine_server/src/core.cpp
Normal file
0
deerith_engine_server/src/core.cpp
Normal file
@ -1,8 +1,34 @@
|
|||||||
add_executable(Sandbox
|
file(GLOB_RECURSE SANDBOX_COMMON
|
||||||
src/main.cpp
|
CONFIGURE_DEPENDS
|
||||||
|
src/common/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(Sandbox
|
file(GLOB_RECURSE SANDBOX_CLIENT
|
||||||
|
CONFIGURE_DEPENDS
|
||||||
|
src/client/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE SANDBOX_SERVER
|
||||||
|
CONFIGURE_DEPENDS
|
||||||
|
src/server/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(SandboxClient
|
||||||
|
${SANDBOX_COMMON}
|
||||||
|
${SANDBOX_CLIENT}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(SandboxClient
|
||||||
PRIVATE
|
PRIVATE
|
||||||
DeerithClient
|
DeerithClient
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(SandboxServer
|
||||||
|
${SANDBOX_COMMON}
|
||||||
|
${SANDBOX_SERVER}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(SandboxServer
|
||||||
|
PRIVATE
|
||||||
|
DeerithServer
|
||||||
)
|
)
|
||||||
13
sandbox/src/server/main.cpp
Normal file
13
sandbox/src/server/main.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#include <deerith/core/core.h>
|
||||||
|
#include <deerith/core/log.h>
|
||||||
|
|
||||||
|
int main(int args_count, const char **args)
|
||||||
|
{
|
||||||
|
deerith::init_deerith_core();
|
||||||
|
|
||||||
|
deerith_core_trace("Running server\n{}", args[0]);
|
||||||
|
|
||||||
|
deerith::shutdown_deerith_core();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user