Compare commits
5 Commits
540d682cfc
...
8e5d81f913
Author | SHA1 | Date |
---|---|---|
Otto Naderer | 8e5d81f913 | |
Otto Naderer | fb0b8cee79 | |
Otto Naderer | ed8345550f | |
Otto Naderer | 1887c702c4 | |
rna88 | ca1e18cf3c |
|
@ -0,0 +1,54 @@
|
|||
# cmake for irrnet, ottona, 2022-04-27
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
option(OP_COMPILE_WITH_IRRLICHT "compile irrnet with native irrlicht datatypes" ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lib")
|
||||
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
|
||||
#irrnet stuff
|
||||
set(IRRNET_TARGET irrnet)
|
||||
set(IRRNET_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/source")
|
||||
set(IRRNET_INC_DIR "${CMAKE_CURRENT_LIST_DIR}/include")
|
||||
|
||||
#enet stuff
|
||||
set(ENET_TARGET enet)
|
||||
set(ENET_DIR "${CMAKE_CURRENT_LIST_DIR}/enet")
|
||||
set(ENET_INC_DIR ${ENET_DIR}/include)
|
||||
add_subdirectory(${ENET_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
#zlib stuff
|
||||
set(ZLIB_TARGET zlibstatic)
|
||||
set(ZLIB_DIR "${CMAKE_CURRENT_LIST_DIR}/zlib")
|
||||
set(ZLIB_INC_DIR ${ZLIB_DIR}/include)
|
||||
add_subdirectory(${ZLIB_DIR} EXCLUDE_FROM_ALL)
|
||||
|
||||
#irrlicht stuff
|
||||
set(IRRLICHT_INC_DIR /usr/include/irrlicht)
|
||||
|
||||
|
||||
project(irrnet)
|
||||
|
||||
add_library(${IRRNET_TARGET} STATIC
|
||||
${IRRNET_INC_DIR}/CEncryption.h
|
||||
${IRRNET_INC_DIR}/CNetManager.h
|
||||
${IRRNET_INC_DIR}/INetManager.h
|
||||
${IRRNET_INC_DIR}/irrNet.h
|
||||
${IRRNET_INC_DIR}/SPacket.h
|
||||
${IRRNET_SRC_DIR}/CNetManager.cpp
|
||||
${IRRNET_SRC_DIR}/SPacket.cpp
|
||||
)
|
||||
|
||||
if (OP_COMPILE_WITH_IRRLICHT)
|
||||
message(STATUS "compile with native irrlicht")
|
||||
add_definitions(-DCOMPILE_WITH_IRRLICHT)
|
||||
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRLICHT_INC_DIR})
|
||||
endif()
|
||||
|
||||
target_include_directories(${IRRNET_TARGET} PUBLIC ${IRRNET_INC_DIR} ${ENET_INC_DIR} ${ZLIB_INC_DIR})
|
||||
|
|
@ -49,6 +49,10 @@ class SOutPacket
|
|||
SOutPacket& operator << (const f64 data);
|
||||
/// Adds data to the packet.
|
||||
SOutPacket& operator << (const core::vector3df& data);
|
||||
#ifdef COMPILE_WITH_IRRLICHT
|
||||
/// Adds a quaternion to the packet
|
||||
SOutPacket& operator << (const core::quaternion&);
|
||||
#endif
|
||||
/// Adds data to the packet.
|
||||
SOutPacket& operator << (const c8* string);
|
||||
/// Adds data to the packet.
|
||||
|
@ -57,7 +61,6 @@ class SOutPacket
|
|||
SOutPacket& operator << (const std::string& string);
|
||||
/// Adds data to the packet.
|
||||
SOutPacket& operator << (const core::stringw& string);
|
||||
|
||||
/// Appends another SOutPacket to the packet.
|
||||
SOutPacket& operator << (const SOutPacket& other);
|
||||
|
||||
|
@ -114,7 +117,11 @@ class SInPacket
|
|||
/// Gets the next item in the packet based on the size of the variable.
|
||||
void operator >> (f64& data);
|
||||
/// Gets the next item in the packet based on the size of the variable.
|
||||
void operator >> (core::vector3df& data);
|
||||
void operator >> (core::vector3df& data);
|
||||
#ifdef COMPILE_WITH_IRRLICHT
|
||||
/// Gets the next item in the packet based on the size of the variable.
|
||||
void operator >> (core::quaternion& data);
|
||||
#endif
|
||||
/// Gets the next item in the packet based on the size of the variable.
|
||||
void operator >> (char* string);
|
||||
/// Gets the next item in the packet based on the size of the variable.
|
||||
|
|
|
@ -106,6 +106,14 @@ SOutPacket& SOutPacket::operator << (const core::vector3df& data)
|
|||
memcpy(buff.pointer() + buff.size() - 12, &data.X, 12);
|
||||
return *this;
|
||||
}
|
||||
#ifdef COMPILE_WITH_IRRLICHT
|
||||
SOutPacket& SOutPacket::operator << (const core::quaternion& data)
|
||||
{
|
||||
enlargeBuffer(16);
|
||||
memcpy(buff.pointer() + buff.size() - 16, &data.X, 16);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
SOutPacket& SOutPacket::operator << (const c8* string)
|
||||
{
|
||||
|
@ -297,6 +305,13 @@ void SInPacket::operator >> (core::vector3df &data)
|
|||
memcpy(&data.X,getData()+pos,12);
|
||||
pos+=12;
|
||||
}
|
||||
#ifdef COMPILE_WITH_IRRLICHT
|
||||
void SInPacket::operator >> (core::quaternion &data)
|
||||
{
|
||||
memcpy(&data.X,getData()+pos,16);
|
||||
pos+=16;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SInPacket::operator >> (char *string)
|
||||
{
|
||||
|
|
2
zlib
2
zlib
|
@ -1 +1 @@
|
|||
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f
|
||||
Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389
|
Loading…
Reference in New Issue