diff --git a/.gitignore b/.gitignore index 3569aab..f15149d 100644 --- a/.gitignore +++ b/.gitignore @@ -375,3 +375,6 @@ FodyWeavers.xsd /x64/Debug/SQCSim2021.pdb /SQCSim-srv/cmake/* !/SQCSim-srv/cmake/CMakeLists.txt +/SQCSim2021/cmake/* +!/SQCSim2021/cmake/CMakeLists.txt +/SQCSim2021/SQCSim-client diff --git a/SQCSim-common/world.cpp b/SQCSim-common/world.cpp index 4d7c292..1be12e7 100644 --- a/SQCSim-common/world.cpp +++ b/SQCSim-common/world.cpp @@ -130,7 +130,7 @@ void World::GetScope(unsigned int& x, unsigned int& y) { y = m_center[1]; } -void World::Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) { +void World::Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) { UpdateWorld(player_pos, blockinfo); //TransposeWorld(player_pos, bullets); } @@ -407,4 +407,4 @@ void World::UpdateWorld(const Vector3f& player, BlockInfo* blockinfo[BTYPE_LAST] }*/ } -int World::GettbDeleted() const { return m_tbDeleted.size(); } \ No newline at end of file +int World::GettbDeleted() const { return m_tbDeleted.size(); } diff --git a/SQCSim-common/world.h b/SQCSim-common/world.h index d341ee8..0cc628d 100644 --- a/SQCSim-common/world.h +++ b/SQCSim-common/world.h @@ -30,7 +30,7 @@ public: BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; - void Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]); + void Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]); void GetScope(unsigned int& x, unsigned int& y); diff --git a/SQCSim2021/audio.h b/SQCSim2021/audio.h index b0ff044..d4625cf 100644 --- a/SQCSim2021/audio.h +++ b/SQCSim2021/audio.h @@ -1,8 +1,14 @@ #ifndef AUDIO_H__ #define AUDIO_H__ +#ifdef _WIN32 #include #include +#else +#include "./external/irrKlang-64bit-1.6.0/include/irrKlang.h" +#include "./external/irrKlang-64bit-1.6.0/include/ik_ISoundSource.h" +#endif + #include "../SQCSim-common/vector3.h" #include "define.h" @@ -29,4 +35,4 @@ public: void PauseEngine(); }; -#endif // AUDIO_H__ \ No newline at end of file +#endif // AUDIO_H__ diff --git a/SQCSim2021/cmake/CMakeLists.txt b/SQCSim2021/cmake/CMakeLists.txt index 02c5332..fbe850f 100644 --- a/SQCSim2021/cmake/CMakeLists.txt +++ b/SQCSim2021/cmake/CMakeLists.txt @@ -6,9 +6,26 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_STANDARD_REQUIRED True) set(CMAKE_BUILD_DIRECTORY "./build") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../out") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../") set(SQCSIM_COMMON_DIR "../../SQCSim-common/") +set(SQCSIM_EXTERN_DIR "../external/") + +find_package(SFML COMPONENTS system window graphics REQUIRED) +find_package(DevIL REQUIRED) +find_package(OpenGL REQUIRED) +find_package(GLEW REQUIRED) + +find_library(IRRKLANG_LIBRARY + NAMES libIrrKlang.so + PATHS "${SQCSIM_EXTERN_DIR}/irrKlang-64bit-1.6.0/lib/linux-gcc-64/") + +include_directories( + ${SQCSIM_EXTERN_DIR}/irrKlang-64bit-1.6.0/include/ + ${SFML_INCLUDE_DIRS} + ${IL_INCLUDE_DIR} + ) + add_library(SQCSim-common "${SQCSIM_COMMON_DIR}blockinfo.cpp" @@ -21,7 +38,7 @@ add_library(SQCSim-common "${SQCSIM_COMMON_DIR}world.cpp" ) -add_executable(SQCSim-server +add_executable(SQCSim-client "../audio.cpp" "../connector.cpp" "../engine.cpp" @@ -30,10 +47,22 @@ add_executable(SQCSim-server "../shader.cpp" "../skybox.cpp" "../texture.cpp" + "../textureatlas.cpp" "../tool.cpp" "../vertexbuffer.cpp" "../worldrenderer.cpp" "../main.cpp" ) -target_link_libraries(SQCSim-server PUBLIC SQCSim-common) +target_link_libraries(SQCSim-client PUBLIC SQCSim-common + ${IRRKLANG_LIBRARY} + sfml-system + sfml-window + sfml-graphics + GL + GLU + GLEW + ${IL_LIBRARIES} + ${ILU_LIBRARIES} + ) + diff --git a/SQCSim2021/define.h b/SQCSim2021/define.h index 8d51188..02e5faf 100644 --- a/SQCSim2021/define.h +++ b/SQCSim2021/define.h @@ -4,14 +4,18 @@ #include #include #include +#include #include #include #include "../SQCSim-common/define.h" #ifdef _WIN32 -#include #include #include +#else +#include +#include +#include #endif #define NETWORK_TEST false diff --git a/SQCSim2021/media/shaders/shader01.frag b/SQCSim2021/media/shaders/shader01.frag index 38588d0..8adf697 100644 --- a/SQCSim2021/media/shaders/shader01.frag +++ b/SQCSim2021/media/shaders/shader01.frag @@ -7,7 +7,7 @@ void main() texel = texture2D(tex,gl_TexCoord[0].st); texel *= light; - texel.a = 255; + texel.a = 255.; gl_FragColor = texel; }