Compare commits
	
		
			5 Commits
		
	
	
		
			L-CSplash
			...
			SQC_17_HUD
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | fc4a22e844 | ||
|  | c7271f6217 | ||
|  | 8ebe7b95fc | ||
|  | df5b7960b2 | ||
|  | db0a39f64a | 
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						| @@ -373,8 +373,3 @@ FodyWeavers.xsd | |||||||
| /x64/Release/SQCSim2023.exe | /x64/Release/SQCSim2023.exe | ||||||
| /x64/Debug/SQCSim2023.exe | /x64/Debug/SQCSim2023.exe | ||||||
| /x64/Debug/SQCSim2021.pdb | /x64/Debug/SQCSim2021.pdb | ||||||
| /SQCSim-srv/cmake/* |  | ||||||
| !/SQCSim-srv/cmake/CMakeLists.txt |  | ||||||
| /SQCSim2021/cmake/* |  | ||||||
| !/SQCSim2021/cmake/CMakeLists.txt |  | ||||||
| /SQCSim2021/SQCSim-client |  | ||||||
|   | |||||||
| @@ -7,9 +7,8 @@ Bullet::Bullet(Vector3f pos, Vector3f dir, uint64_t tid): m_startpos(pos), m_cur | |||||||
|  |  | ||||||
| Bullet::~Bullet() {} | Bullet::~Bullet() {} | ||||||
|  |  | ||||||
| bool Bullet::Update(World* world, float elapsedtime, int perframe) { | bool Bullet::Update(World* world, float elapsedtime) { | ||||||
| 	int max = 100 / perframe; | 	for (int x = 0; x < 1000; ++x) { | ||||||
| 	for (int x = 0; x < max; ++x) { |  | ||||||
| 		m_currentpos += m_velocity * elapsedtime; | 		m_currentpos += m_velocity * elapsedtime; | ||||||
|  |  | ||||||
| 		if (!world->ChunkAt(m_currentpos)) | 		if (!world->ChunkAt(m_currentpos)) | ||||||
| @@ -31,14 +30,10 @@ void Bullet::Transpose(int& x, int& z) { | |||||||
| 	m_startpos.z -= z * CHUNK_SIZE_Z; | 	m_startpos.z -= z * CHUNK_SIZE_Z; | ||||||
| } | } | ||||||
|  |  | ||||||
| Vector3f Bullet::getPos() const { | Vector3f Bullet::getPos() { | ||||||
| 	return m_currentpos; | 	return m_currentpos; | ||||||
| } | } | ||||||
|  |  | ||||||
| Vector3f Bullet::getVel() const { |  | ||||||
| 	return m_velocity; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| uint64_t Bullet::getTeamID(){ | uint64_t Bullet::getTeamID(){ | ||||||
| 	return m_tid; | 	return m_tid; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -12,10 +12,9 @@ public: | |||||||
| 	Bullet(Vector3f pos, Vector3f dir, uint64_t tid); | 	Bullet(Vector3f pos, Vector3f dir, uint64_t tid); | ||||||
| 	~Bullet(); | 	~Bullet(); | ||||||
|  |  | ||||||
| 	bool Update(World* world, float elapsedtime, int perframe); | 	bool Update(World* world, float elapsedtime); | ||||||
| 	void Transpose(int& x, int& z); | 	void Transpose(int& x, int& z); | ||||||
| 	Vector3f getPos() const; | 	Vector3f getPos(); | ||||||
| 	Vector3f getVel() const; |  | ||||||
| 	uint64_t getTeamID(); | 	uint64_t getTeamID(); | ||||||
|  |  | ||||||
| private: | private: | ||||||
|   | |||||||
| @@ -53,7 +53,6 @@ typedef uint64_t Timestamp; | |||||||
| #include <sys/socket.h> | #include <sys/socket.h> | ||||||
| #include <arpa/inet.h> | #include <arpa/inet.h> | ||||||
| #include <netinet/in.h> | #include <netinet/in.h> | ||||||
| #include <cstring> |  | ||||||
|  |  | ||||||
| #define SOCKET int | #define SOCKET int | ||||||
| #define INVALID_SOCKET -1 | #define INVALID_SOCKET -1 | ||||||
|   | |||||||
| @@ -130,7 +130,7 @@ void World::GetScope(unsigned int& x, unsigned int& y) { | |||||||
| 	y = m_center[1]; | 	y = m_center[1]; | ||||||
| } | } | ||||||
|  |  | ||||||
| void World::Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) { | void World::Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]) { | ||||||
| 	UpdateWorld(player_pos, blockinfo); | 	UpdateWorld(player_pos, blockinfo); | ||||||
| 	//TransposeWorld(player_pos, bullets); | 	//TransposeWorld(player_pos, bullets); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ public: | |||||||
| 	BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; | 	BlockType BlockAt(float x, float y, float z, BlockType defaultBlockType = BTYPE_AIR) const; | ||||||
| 	BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; | 	BlockType BlockAt(const Vector3f& pos, BlockType defaultBlockType = BTYPE_AIR) const; | ||||||
|  |  | ||||||
| 	void Update(Bullet* bullets[MAX_BULLETS], const Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]); | 	void Update(Bullet* bullets[MAX_BULLETS], Vector3f& player_pos, BlockInfo* blockinfo[BTYPE_LAST]); | ||||||
|  |  | ||||||
| 	void GetScope(unsigned int& x, unsigned int& y); | 	void GetScope(unsigned int& x, unsigned int& y); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,30 +0,0 @@ | |||||||
| cmake_minimum_required(VERSION 3.18.4) |  | ||||||
|  |  | ||||||
| project(SQCSim-Server VERSION 0.1) |  | ||||||
|  |  | ||||||
| add_compile_options("-Wno-narrowing") |  | ||||||
| set(CMAKE_CXX_STANDARD 17) |  | ||||||
| set(CMAKE_STANDARD_REQUIRED True) |  | ||||||
|  |  | ||||||
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../out") |  | ||||||
|  |  | ||||||
| set(SQCSIM_COMMON_DIR "../../SQCSim-common/") |  | ||||||
|  |  | ||||||
| add_library(SQCSim-common |  | ||||||
| 			"${SQCSIM_COMMON_DIR}blockinfo.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}bullet.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}chunk.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}netprotocol.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}opensimplex.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}player.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}transformation.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}world.cpp" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| add_executable(SQCSim-server |  | ||||||
| 			"../connection.cpp" |  | ||||||
| 			"../server.cpp" |  | ||||||
| 			"../main.cpp" |  | ||||||
| 			) |  | ||||||
|  |  | ||||||
| target_link_libraries(SQCSim-server PUBLIC SQCSim-common) |  | ||||||
| @@ -85,7 +85,7 @@ int Server::Ready() { | |||||||
|  |  | ||||||
| 	while (!readystart) { | 	while (!readystart) { | ||||||
| 		sockaddr_in sockad; | 		sockaddr_in sockad; | ||||||
| 		unsigned int addrlen = sizeof(sockad); | 		int addrlen = sizeof(sockad); | ||||||
| 		SOCKET sock = accept(m_sock_tcp, (sockaddr*)&sockad, &addrlen); | 		SOCKET sock = accept(m_sock_tcp, (sockaddr*)&sockad, &addrlen); | ||||||
|  |  | ||||||
| 		if (sock < 0) | 		if (sock < 0) | ||||||
| @@ -140,7 +140,7 @@ void Server::Run() { | |||||||
| 	Log("Partie en cours...", false, false); | 	Log("Partie en cours...", false, false); | ||||||
| } | } | ||||||
|  |  | ||||||
| inline std::string Server::LogTimestamp() { | inline std::string Server::Timestamp() { | ||||||
| 	time_t rawtime; | 	time_t rawtime; | ||||||
| 	struct tm timeinfo; | 	struct tm timeinfo; | ||||||
| 	char buffer[80]; | 	char buffer[80]; | ||||||
| @@ -162,11 +162,11 @@ inline std::string Server::LogTimestamp() { | |||||||
| void Server::Log(std::string str, bool is_error = false, bool is_fatal = false) { | void Server::Log(std::string str, bool is_error = false, bool is_fatal = false) { | ||||||
| 	switch (m_log) { | 	switch (m_log) { | ||||||
| 	case LOG_DEST::LOGFILE: | 	case LOG_DEST::LOGFILE: | ||||||
| 		m_logfile << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl; | 		m_logfile << Timestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl; | ||||||
| 		break; | 		break; | ||||||
| 	case LOG_DEST::CONSOLE: | 	case LOG_DEST::CONSOLE: | ||||||
| 	default: | 	default: | ||||||
| 		std::cout << LogTimestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl; | 		std::cout << Timestamp() << (is_fatal ? "FATAL " : "") << (is_error ? "ERROR " : "") << str << std::endl; | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,7 +35,7 @@ private: | |||||||
|  |  | ||||||
| 	World* m_world = nullptr; | 	World* m_world = nullptr; | ||||||
|  |  | ||||||
| 	std::string LogTimestamp(); | 	std::string Timestamp(); | ||||||
| 	void Log(std::string str, bool is_error, bool is_fatal); | 	void Log(std::string str, bool is_error, bool is_fatal); | ||||||
| 	void buildIdList(size_t size); | 	void buildIdList(size_t size); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,17 +2,17 @@ | |||||||
|  |  | ||||||
| Audio::Audio() { | Audio::Audio() { | ||||||
| 	m_engine = irrklang::createIrrKlangDevice(); | 	m_engine = irrklang::createIrrKlangDevice(); | ||||||
| 	m_engine->setDopplerEffectParameters(10); | 	m_engine->setDopplerEffectParameters(1); | ||||||
| 	m_engine->setRolloffFactor(2); | 	m_engine->setRolloffFactor(1); | ||||||
| 	m_engine->setDefault3DSoundMinDistance(.1); | 	m_engine->setDefault3DSoundMinDistance(1); | ||||||
| 	m_engine->setDefault3DSoundMaxDistance(1000); | 	m_engine->setDefault3DSoundMaxDistance(1000); | ||||||
| } | } | ||||||
|  |  | ||||||
| Audio::Audio(const char * music) { | Audio::Audio(const char * music) { | ||||||
| 	m_engine = irrklang::createIrrKlangDevice(); | 	m_engine = irrklang::createIrrKlangDevice(); | ||||||
| 	m_engine->setDopplerEffectParameters(1); | 	m_engine->setDopplerEffectParameters(1); | ||||||
| 	m_engine->setRolloffFactor(2); | 	m_engine->setRolloffFactor(1); | ||||||
| 	m_engine->setDefault3DSoundMinDistance(.1); | 	m_engine->setDefault3DSoundMinDistance(1); | ||||||
| 	m_engine->setDefault3DSoundMaxDistance(1000); | 	m_engine->setDefault3DSoundMaxDistance(1000); | ||||||
| 	m_music = m_engine->play2D(music, false, true, true, irrklang::ESM_STREAMING); | 	m_music = m_engine->play2D(music, false, true, true, irrklang::ESM_STREAMING); | ||||||
| } | } | ||||||
| @@ -28,11 +28,10 @@ void Audio::Update3DAudio(Vector3f pos, Vector3f dir, Vector3f vel) { | |||||||
| 								  irrklang::vec3df(vel.x, vel.y, vel.z)); | 								  irrklang::vec3df(vel.x, vel.y, vel.z)); | ||||||
| } | } | ||||||
|  |  | ||||||
| irrklang::ISound* Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, bool is_looped = false, float volume = 1) { | void Audio::Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume = 1) { | ||||||
| 	sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), is_looped, false, true, is_looped? irrklang::ESM_STREAMING: irrklang::ESM_NO_STREAMING, true); | 	sound = m_engine->play3D(name, irrklang::vec3df(pos.x, pos.y, pos.z), false, false, true, irrklang::ESM_NO_STREAMING, true); | ||||||
| 	sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z)); | 	sound->setVelocity(irrklang::vec3df(vel.x, vel.y, vel.z)); | ||||||
| 	sound->setVolume(volume); | 	sound->setVolume(volume); | ||||||
| 	return sound; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume = 1) { | void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume = 1) { | ||||||
|   | |||||||
| @@ -1,30 +1,24 @@ | |||||||
| #ifndef AUDIO_H__ | #ifndef AUDIO_H__ | ||||||
| #define AUDIO_H__ | #define AUDIO_H__ | ||||||
|  |  | ||||||
| #ifdef _WIN32 |  | ||||||
| #include <irrKlang.h> | #include <irrKlang.h> | ||||||
| #include <ik_ISoundSource.h> | #include <ik_ISoundSource.h> | ||||||
| #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 "../SQCSim-common/vector3.h" | ||||||
| #include "define.h" | #include "define.h" | ||||||
|  |  | ||||||
| class Audio { | class Audio { | ||||||
| private: | private: | ||||||
|  | 	irrklang::ISoundEngine* m_engine; | ||||||
| 	irrklang::ISound* m_music; | 	irrklang::ISound* m_music; | ||||||
|  |  | ||||||
| public: | public: | ||||||
| 	Audio(); | 	Audio(); | ||||||
| 	Audio(const char* music); | 	Audio(const char* music); | ||||||
| 	~Audio(); | 	~Audio(); | ||||||
| 	irrklang::ISoundEngine* m_engine; |  | ||||||
|  |  | ||||||
| 	void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed); | 	void Update3DAudio(Vector3f pos, Vector3f dir, Vector3f speed); | ||||||
|  |  | ||||||
| 	irrklang::ISound* Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, bool is_looped, float volume); | 	void Create3DAudioObj(irrklang::ISound* sound, const char* name, Vector3f pos, Vector3f vel, float volume); | ||||||
|  |  | ||||||
| 	void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume); | 	void Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& vel, float volume); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,68 +0,0 @@ | |||||||
| cmake_minimum_required(VERSION 3.18.4) |  | ||||||
|  |  | ||||||
| project(SQCSim-Client VERSION 0.8) |  | ||||||
|  |  | ||||||
| set(CMAKE_CXX_STANDARD 17) |  | ||||||
| set(CMAKE_STANDARD_REQUIRED True) |  | ||||||
|  |  | ||||||
| set(CMAKE_BUILD_DIRECTORY "./build") |  | ||||||
| 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" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}bullet.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}chunk.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}netprotocol.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}opensimplex.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}player.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}transformation.cpp" |  | ||||||
| 			"${SQCSIM_COMMON_DIR}world.cpp" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| add_executable(SQCSim-client |  | ||||||
| 			"../audio.cpp" |  | ||||||
| 			"../connector.cpp" |  | ||||||
| 			"../engine.cpp" |  | ||||||
| 			"../mesh.cpp" |  | ||||||
| 			"../openglcontext.cpp" |  | ||||||
| 			"../shader.cpp" |  | ||||||
| 			"../skybox.cpp" |  | ||||||
| 			"../texture.cpp" |  | ||||||
| 			"../textureatlas.cpp" |  | ||||||
| 			"../tool.cpp" |  | ||||||
| 			"../vertexbuffer.cpp" |  | ||||||
| 			"../worldrenderer.cpp" |  | ||||||
| 			"../main.cpp" |  | ||||||
| 			) |  | ||||||
|  |  | ||||||
| target_link_libraries(SQCSim-client PUBLIC SQCSim-common |  | ||||||
| 			${IRRKLANG_LIBRARY} |  | ||||||
| 			sfml-system |  | ||||||
| 			sfml-window |  | ||||||
| 			sfml-graphics |  | ||||||
| 			GL |  | ||||||
| 			GLU |  | ||||||
| 			GLEW |  | ||||||
| 			${IL_LIBRARIES} |  | ||||||
| 			${ILU_LIBRARIES} |  | ||||||
| 			) |  | ||||||
|  |  | ||||||
| @@ -6,34 +6,26 @@ | |||||||
| #include <iostream> | #include <iostream> | ||||||
| #include <chrono> | #include <chrono> | ||||||
| #include <iomanip> | #include <iomanip> | ||||||
| #include <GL/glew.h> |  | ||||||
| #include <SFML/Window.hpp> | #include <SFML/Window.hpp> | ||||||
| #include <SFML/Graphics.hpp> | #include <SFML/Graphics.hpp> | ||||||
| #include "../SQCSim-common/define.h" | #include "../SQCSim-common/define.h" | ||||||
|  |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|  | #include <GL/glew.h> | ||||||
| #include <gl/GL.h> | #include <gl/GL.h> | ||||||
| #include <gl/GLU.h> | #include <gl/GLU.h> | ||||||
| #else |  | ||||||
| #include <GL/gl.h> |  | ||||||
| #include <GL/glu.h> |  | ||||||
| #include <climits> |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #define NETWORK_TEST false | #define NETWORK_TEST false | ||||||
| #define SRV_ADDR "127.0.0.1" | #define SRV_ADDR "127.0.0.1" | ||||||
| #define COUNTDOWN 300 | #define COUNTDOWN 300 | ||||||
|  |  | ||||||
| #define BULLET_UPDATES_PER_FRAME 20 | #define BASE_WIDTH 1600 | ||||||
|  | #define BASE_HEIGHT 900 | ||||||
| #define BASE_WIDTH 640 |  | ||||||
| #define BASE_HEIGHT 480 |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #define TEXTURE_PATH    "./media/textures/" | #define TEXTURE_PATH    "./media/textures/" | ||||||
| #define SHADER_PATH	    "./media/shaders/" | #define SHADER_PATH	    "./media/shaders/" | ||||||
| #define AUDIO_PATH		"./media/audio/" | #define AUDIO_PATH		"./media/audio/" | ||||||
| #define CHUNK_PATH		"./media/chunks/" | #define CHUNK_PATH		"./media/chunks/" | ||||||
| #define MENU_ITEM_PATH		"./media/menu_items/" |  | ||||||
|  |  | ||||||
| #endif // DEFINE_H__ | #endif // DEFINE_H__ | ||||||
|   | |||||||
| @@ -1 +0,0 @@ | |||||||
|  |  | ||||||
| @@ -24,8 +24,6 @@ class Engine : public OpenglContext { | |||||||
| public: | public: | ||||||
|     Engine(); |     Engine(); | ||||||
|     virtual ~Engine(); |     virtual ~Engine(); | ||||||
|     virtual void DrawMenu(); |  | ||||||
|     virtual void DrawSplachScreen(); |  | ||||||
|     virtual void Init(); |     virtual void Init(); | ||||||
|     virtual void DeInit(); |     virtual void DeInit(); | ||||||
|     virtual void LoadResource(); |     virtual void LoadResource(); | ||||||
| @@ -38,7 +36,7 @@ public: | |||||||
|     virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y); |     virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y); | ||||||
|  |  | ||||||
| private: | private: | ||||||
|     float GetScale() const; |     std::pair<float, float> GetScale() const; | ||||||
|  |  | ||||||
|     int GetFps(float elapsedTime) const; |     int GetFps(float elapsedTime) const; | ||||||
|     int GetCountdown(float elapsedTime); |     int GetCountdown(float elapsedTime); | ||||||
| @@ -50,11 +48,13 @@ private: | |||||||
|     void DisplayNotification(std::string message); |     void DisplayNotification(std::string message); | ||||||
|     void ProcessNotificationQueue(); |     void ProcessNotificationQueue(); | ||||||
|     void DisplayCrosshair(); |     void DisplayCrosshair(); | ||||||
|  |     void DisplayPovGun(); | ||||||
|     void DisplayCurrentItem(); |     void DisplayCurrentItem(); | ||||||
|     void DisplayHud(int timer); |     void DisplayHud(int timer); | ||||||
|     void DisplayInfo(float elapsedTime, BlockType bloc); |     void DisplayInfo(float elapsedTime, BlockType bloc); | ||||||
|  |     void DisplaySingleOrMultiplayerMenu(); | ||||||
|     void DrawHud(float elapsedTime, BlockType bloc); |     void DrawHud(float elapsedTime, BlockType bloc); | ||||||
|     void PrintText(float x, float y, float scale, const std::string& t); |     void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f); | ||||||
|  |  | ||||||
|     Connector m_conn; |     Connector m_conn; | ||||||
|     Shader m_shader01; |     Shader m_shader01; | ||||||
| @@ -64,37 +64,26 @@ private: | |||||||
|     World m_world = World(); |     World m_world = World(); | ||||||
|     WorldRenderer m_wrenderer = WorldRenderer(); |     WorldRenderer m_wrenderer = WorldRenderer(); | ||||||
|  |  | ||||||
|     Texture m_textureSkybox; |  | ||||||
|     Texture m_textureFont; |  | ||||||
|     Texture m_textureCrosshair; |     Texture m_textureCrosshair; | ||||||
|  |     Texture m_textureFont; | ||||||
|     Texture m_textureGun; |     Texture m_textureGun; | ||||||
|  |     Texture m_texturePovGun; | ||||||
|  |     Texture m_textureSkybox; | ||||||
|  |     Texture m_textureSoloMultiMenu; | ||||||
|  |     Texture m_textureTitle; | ||||||
|  |  | ||||||
|     Skybox m_skybox; |     Skybox m_skybox; | ||||||
|     Audio m_audio = Audio(AUDIO_PATH "start.wav"); |     Audio m_audio = Audio(AUDIO_PATH "start.wav"); | ||||||
|  |  | ||||||
|     irrklang::ISound* m_powpow, |     irrklang::ISound* m_powpow; | ||||||
|         * m_scream; |     irrklang::ISound* m_scream; | ||||||
|     irrklang::ISound *m_whoosh[MAX_BULLETS]; |  | ||||||
|  |  | ||||||
|     Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); |     Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f)); | ||||||
|      |      | ||||||
|     Bullet* m_bullets[MAX_BULLETS]; |     Bullet* m_bullets[MAX_BULLETS]; | ||||||
|  |  | ||||||
|     //Menu |  | ||||||
|     enum class GameState { MAIN_MENU, OPTIONS, QUIT, NEWG, PLAY }; |  | ||||||
|     GameState m_gamestate = GameState::MAIN_MENU; |  | ||||||
|     Texture MenuTitleTexture; |  | ||||||
|     Texture MenuBGTexture; |  | ||||||
|     Texture MenuStartTexture; |  | ||||||
|     Texture MenuQuitTexture; |  | ||||||
|     Texture MenuOptionsTexture; |  | ||||||
|     Texture SplachScreenTexture; |  | ||||||
|  |  | ||||||
|     float m_scale; |     float m_scale; | ||||||
|     float m_time = 0; |     float m_time = 0; | ||||||
|     float m_time_SplashScreen = 0; |  | ||||||
|     float m_Width = 0; |  | ||||||
|     float m_Height = 0; |  | ||||||
|  |  | ||||||
|     int m_renderCount = 0; |     int m_renderCount = 0; | ||||||
|     int m_countdown = COUNTDOWN; |     int m_countdown = COUNTDOWN; | ||||||
| @@ -107,6 +96,7 @@ private: | |||||||
|     bool m_displayHud = true; |     bool m_displayHud = true; | ||||||
|     bool m_displayInfo = false; |     bool m_displayInfo = false; | ||||||
|     bool m_resetcountdown = false; |     bool m_resetcountdown = false; | ||||||
|  |     bool m_soloMultiChoiceMade = true; | ||||||
|     bool m_stopcountdown = false; |     bool m_stopcountdown = false; | ||||||
|      |      | ||||||
|     bool m_keyK = false; |     bool m_keyK = false; | ||||||
| @@ -121,9 +111,6 @@ private: | |||||||
|     bool m_mouseC = false; |     bool m_mouseC = false; | ||||||
|     bool m_mouseWU = false; |     bool m_mouseWU = false; | ||||||
|     bool m_mouseWD = false; |     bool m_mouseWD = false; | ||||||
|     //Pour trouver ou est la souris |  | ||||||
|     float m_mousemx = 0; |  | ||||||
|     float m_mousemy = 0; |  | ||||||
|  |  | ||||||
|     std::string m_messageNotification = ""; |     std::string m_messageNotification = ""; | ||||||
| }; | }; | ||||||
|   | |||||||
| Before Width: | Height: | Size: 7.9 KiB | 
| Before Width: | Height: | Size: 8.6 KiB | 
| Before Width: | Height: | Size: 289 KiB | 
| @@ -7,7 +7,7 @@ void main() | |||||||
|     texel = texture2D(tex,gl_TexCoord[0].st); |     texel = texture2D(tex,gl_TexCoord[0].st); | ||||||
|  |  | ||||||
|     texel *= light; |     texel *= light; | ||||||
|    texel.a = 255.; |    texel.a = 255; | ||||||
|     gl_FragColor = texel; |     gl_FragColor = texel; | ||||||
|     |     | ||||||
| } | } | ||||||
|   | |||||||
| Before Width: | Height: | Size: 195 KiB | 
							
								
								
									
										
											BIN
										
									
								
								SQCSim2021/media/textures/single_multi.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 1.3 MiB | 
							
								
								
									
										
											BIN
										
									
								
								SQCSim2021/media/textures/skybox2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 4.3 MiB | 
							
								
								
									
										
											BIN
										
									
								
								SQCSim2021/media/textures/title.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 30 KiB | 
| @@ -9,7 +9,6 @@ OpenglContext::~OpenglContext() | |||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| bool OpenglContext::Start(const std::string& title, int width, int height, bool fullscreen) | bool OpenglContext::Start(const std::string& title, int width, int height, bool fullscreen) | ||||||
| { | { | ||||||
|     m_title = title; |     m_title = title; | ||||||
| @@ -23,7 +22,6 @@ bool OpenglContext::Start(const std::string& title, int width, int height, bool | |||||||
|  |  | ||||||
|     while (m_app.isOpen()) |     while (m_app.isOpen()) | ||||||
|     { |     { | ||||||
|  |  | ||||||
|         clock.restart(); |         clock.restart(); | ||||||
|  |  | ||||||
|         sf::Event Event; |         sf::Event Event; | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ | |||||||
| #include <string> | #include <string> | ||||||
| #include <SFML/Window.hpp> | #include <SFML/Window.hpp> | ||||||
| #include "define.h" | #include "define.h" | ||||||
| #include "texture.h" |  | ||||||
|  |  | ||||||
| // Documentation de SFML: http://www.sfml-dev.org/documentation/index-fr.php | // Documentation de SFML: http://www.sfml-dev.org/documentation/index-fr.php | ||||||
| class OpenglContext | class OpenglContext | ||||||
| @@ -32,6 +31,7 @@ public: | |||||||
|     virtual void MousePressEvent(const MOUSE_BUTTON &button, int x, int y) = 0; |     virtual void MousePressEvent(const MOUSE_BUTTON &button, int x, int y) = 0; | ||||||
|     virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y) = 0; |     virtual void MouseReleaseEvent(const MOUSE_BUTTON &button, int x, int y) = 0; | ||||||
|  |  | ||||||
|  |  | ||||||
|     bool Start(const std::string& title, int width, int height, bool fullscreen); |     bool Start(const std::string& title, int width, int height, bool fullscreen); | ||||||
|     bool Stop(); |     bool Stop(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,30 +8,30 @@ void Skybox::Init(float size){ | |||||||
| 	int count = 0; | 	int count = 0; | ||||||
| 	VertexBuffer::VertexData* vd = new VertexBuffer::VertexData[24]; | 	VertexBuffer::VertexData* vd = new VertexBuffer::VertexData[24]; | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f); |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);  | 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 0.f, .75f);    | 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 0.f, .75f);    | ||||||
|  | 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 0.f, .5f);    | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f); |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);  | 	vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f);  | ||||||
|  | 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .25f, .5f);  | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f); |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);  | 	vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f);  | ||||||
|  | 	vd[count++] = VertexBuffer::VertexData(-size, -size, -size, 1.f, 1.f, 1.f, .5f, .5f);  | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f); |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 1.f, .5f);    | 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, 1.f, .5f);    | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 1.f, .75f);    | 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, 1.f, .75f);    | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);  | 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .75f, .75f);  | ||||||
|  | 	vd[count++] = VertexBuffer::VertexData(size, -size, -size, 1.f, 1.f, 1.f, .75f, .5f);  | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .25f, 1.f); | 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .25f, 1.f);   | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, size, size, 1.f, 1.f, 1.f, .5f, 1.f); | 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .25f, .75f); | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, size, 1.f, 1.f, 1.f, .5f, .75f); | 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .5f, .75f); | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, size, -size, 1.f, 1.f, 1.f, .25f, .75f); | 	vd[count++] = VertexBuffer::VertexData(size, size, -size, 1.f, 1.f, 1.f, .5f, 1.f);   | ||||||
|  |  | ||||||
| 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .5f, .25f); | 	vd[count++] = VertexBuffer::VertexData(-size, -size, size, 1.f, 1.f, 1.f, .5f, .25f); | ||||||
| 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, .75f, .25f); | 	vd[count++] = VertexBuffer::VertexData(size, -size, size, 1.f, 1.f, 1.f, .75f, .25f); | ||||||
|   | |||||||
| @@ -211,4 +211,3 @@ void WorldRenderer::UpdateWorld(World* origin, const Vector3f& player, BlockInfo | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||