Compare commits
	
		
			6 Commits
		
	
	
		
			SQC-15_ani
			...
			SQC32_sauv
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 4a9ad70d48 | ||
|  | 1ab83a85a7 | ||
|  | 2ab201e93c | ||
|  | 8e041a314d | ||
|  | 6bb3ee9667 | ||
|  | f654c5effa | 
| @@ -41,17 +41,22 @@ typedef uint8_t BlockType; | |||||||
| enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_GREENGRASS, BTYPE_LAST }; | enum BLOCK_TYPE { BTYPE_AIR, BTYPE_DIRT, BTYPE_GRASS, BTYPE_METAL, BTYPE_ICE, BTYPE_GREENGRASS, BTYPE_LAST }; | ||||||
| typedef uint8_t BoostType; | typedef uint8_t BoostType; | ||||||
| enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE, BTYPE_BOOST_LAST }; | enum BOOST_TYPE { BTYPE_SPEED, BTYPE_HEAL, BTYPE_DAMAGE, BTYPE_INVINCIBLE, BTYPE_BOOST_LAST }; | ||||||
|  |  | ||||||
| //anim  |  | ||||||
| enum ANIM_TYPE { STILL = 0, SHOOTING = 8, JUMPING = 16, JUMPINGSHOOTING = 24, DEAD = 32, TYPE_LAST = 40}; | enum ANIM_TYPE { STILL = 0, SHOOTING = 8, JUMPING = 16, JUMPINGSHOOTING = 24, DEAD = 32, TYPE_LAST = 40}; | ||||||
| enum ANIM_POS {FRONT, QUARTER_FRONT_LEFT, QUATER_FRONT_RIGHT, PROFIL_LEFT, PROFIL_RIGHT, QUARTER_BACK_LEFT, QUARTER_BACK_RIGHT, BACK , POS_LAST}; | enum ANIM_POS {FRONT, QUARTER_FRONT_LEFT, QUATER_FRONT_RIGHT, PROFIL_LEFT, PROFIL_RIGHT, QUARTER_BACK_LEFT, QUARTER_BACK_RIGHT, BACK , POS_LAST}; | ||||||
|  |  | ||||||
| typedef uint64_t Timestamp; | typedef uint64_t Timestamp; | ||||||
|  |  | ||||||
|  | enum Resolution { | ||||||
|  | 	HD = 0,		// 1280x720	 (High Definition) | ||||||
|  | 	FHD,		// 1920x1080 (Full HD) | ||||||
|  | 	QHD,		// 2560x1440 (Quad HD) | ||||||
|  | 	UHD			// 3840x2160 (Ultra HD) | ||||||
|  | }; | ||||||
|  |  | ||||||
| #ifdef _WIN32 | #ifdef _WIN32 | ||||||
|  |  | ||||||
| #pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject | #pragma comment(lib,"wsock32.lib") // Pour pouvoir faire fonctionner le linker sans le vcxproject | ||||||
| #pragma comment(lib,"ws2_32.lib") | #pragma comment(lib,"ws2_32.lib") | ||||||
|  |  | ||||||
| #include <ws2tcpip.h> | #include <ws2tcpip.h> | ||||||
| #include <Windows.h> | #include <Windows.h> | ||||||
| #include <cstdio> | #include <cstdio> | ||||||
|   | |||||||
| @@ -248,8 +248,6 @@ void Player::SetDirection(Vector3f dir) { m_direction = dir; } | |||||||
|  |  | ||||||
| Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); } | Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); } | ||||||
|  |  | ||||||
| Vector3f Player::GetPositionAbs() const { return m_position; } |  | ||||||
|  |  | ||||||
| Vector3f Player::GetVelocity() const { return m_velocity; } | Vector3f Player::GetVelocity() const { return m_velocity; } | ||||||
|  |  | ||||||
| Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPosition().z); } | Vector3f Player::GetPOV() const { return Vector3f(GetPosition().x, m_POV, GetPosition().z); } | ||||||
|   | |||||||
| @@ -26,7 +26,6 @@ public: | |||||||
|  |  | ||||||
| 	void SetDirection(Vector3f dir); | 	void SetDirection(Vector3f dir); | ||||||
| 	Vector3f GetPosition() const; | 	Vector3f GetPosition() const; | ||||||
| 	Vector3f GetPositionAbs() const; |  | ||||||
| 	Vector3f GetDirection() const; | 	Vector3f GetDirection() const; | ||||||
| 	Vector3f GetVelocity() const; | 	Vector3f GetVelocity() const; | ||||||
| 	Vector3f GetPOV() const; | 	Vector3f GetPOV() const; | ||||||
|   | |||||||
| @@ -100,7 +100,7 @@ void Connection::Run(World* world) { | |||||||
| 														  in.keys.right,  | 														  in.keys.right,  | ||||||
| 														  in.keys.jump, false, el), world, el); | 														  in.keys.jump, false, el), world, el); | ||||||
|  |  | ||||||
| 		out.position = player.get()->GetPositionAbs(); | 		out.position = player.get()->GetPosition(); | ||||||
| 		out.direction = in.direction; | 		out.direction = in.direction; | ||||||
| 		out.timestamp = in.timestamp; | 		out.timestamp = in.timestamp; | ||||||
| 		out.id = m_playinfo.id; | 		out.id = m_playinfo.id; | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ | |||||||
|     <ClInclude Include="mesh.h" /> |     <ClInclude Include="mesh.h" /> | ||||||
|     <ClInclude Include="openglcontext.h" /> |     <ClInclude Include="openglcontext.h" /> | ||||||
|     <ClInclude Include="remoteplayer.h" /> |     <ClInclude Include="remoteplayer.h" /> | ||||||
|  |     <ClInclude Include="settings.h" /> | ||||||
|     <ClInclude Include="shader.h" /> |     <ClInclude Include="shader.h" /> | ||||||
|     <ClInclude Include="skybox.h" /> |     <ClInclude Include="skybox.h" /> | ||||||
|     <ClInclude Include="texture.h" /> |     <ClInclude Include="texture.h" /> | ||||||
| @@ -44,6 +45,7 @@ | |||||||
|     <ClCompile Include="mesh.cpp" /> |     <ClCompile Include="mesh.cpp" /> | ||||||
|     <ClCompile Include="openglcontext.cpp" /> |     <ClCompile Include="openglcontext.cpp" /> | ||||||
|     <ClCompile Include="remoteplayer.cpp" /> |     <ClCompile Include="remoteplayer.cpp" /> | ||||||
|  |     <ClCompile Include="settings.cpp" /> | ||||||
|     <ClCompile Include="shader.cpp" /> |     <ClCompile Include="shader.cpp" /> | ||||||
|     <ClCompile Include="skybox.cpp" /> |     <ClCompile Include="skybox.cpp" /> | ||||||
|     <ClCompile Include="texture.cpp" /> |     <ClCompile Include="texture.cpp" /> | ||||||
|   | |||||||
| @@ -56,6 +56,9 @@ | |||||||
|     <ClInclude Include="booster.h"> |     <ClInclude Include="booster.h"> | ||||||
|       <Filter>Fichiers d%27en-tête</Filter> |       <Filter>Fichiers d%27en-tête</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  |     <ClInclude Include="settings.h"> | ||||||
|  |       <Filter>Fichiers d%27en-tête</Filter> | ||||||
|  |     </ClInclude> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ClCompile Include="engine.cpp"> |     <ClCompile Include="engine.cpp"> | ||||||
| @@ -103,5 +106,8 @@ | |||||||
|     <ClCompile Include="booster.cpp"> |     <ClCompile Include="booster.cpp"> | ||||||
|       <Filter>Fichiers sources</Filter> |       <Filter>Fichiers sources</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|  |     <ClCompile Include="settings.cpp"> | ||||||
|  |       <Filter>Fichiers sources</Filter> | ||||||
|  |     </ClCompile> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| </Project> | </Project> | ||||||
| @@ -48,3 +48,7 @@ void Audio::Render3DAudioObj(irrklang::ISound* sound, Vector3f& pos, Vector3f& v | |||||||
| void Audio::ToggleMusicState() { m_music->setIsPaused(!m_music->getIsPaused()); } | void Audio::ToggleMusicState() { m_music->setIsPaused(!m_music->getIsPaused()); } | ||||||
|  |  | ||||||
| void Audio::PauseEngine() { m_engine->setAllSoundsPaused(); } | void Audio::PauseEngine() { m_engine->setAllSoundsPaused(); } | ||||||
|  |  | ||||||
|  | float Audio::GetMusicVolume() const { | ||||||
|  | 	return m_music->getVolume(); | ||||||
|  | } | ||||||
|   | |||||||
| @@ -33,6 +33,8 @@ public: | |||||||
| 	void ToggleMusicState(); | 	void ToggleMusicState(); | ||||||
|  |  | ||||||
| 	void PauseEngine(); | 	void PauseEngine(); | ||||||
|  |  | ||||||
|  | 	float GetMusicVolume() const; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| #endif // AUDIO_H__ | #endif // AUDIO_H__ | ||||||
|   | |||||||
| @@ -28,17 +28,8 @@ | |||||||
| #define BASE_WIDTH 640 | #define BASE_WIDTH 640 | ||||||
| #define BASE_HEIGHT 480 | #define BASE_HEIGHT 480 | ||||||
|  |  | ||||||
|  |  | ||||||
| #define ANIME_PATH_JUMP		"./media/textures/AssetOtherPlayer/FinalPNGJumping/" | #define ANIME_PATH_JUMP		"./media/textures/AssetOtherPlayer/FinalPNGJumping/" | ||||||
| #define ANIME_PATH_STILL	"./media/textures/AssetOtherPlayer/FinalPNGStanding/" | #define ANIME_PATH_STILL	"./media/textures/AssetOtherPlayer/FinalPNGStanding/" | ||||||
|  |  | ||||||
| //1 = jump shoot sans anim, 2 = jump shoot avec anim |  | ||||||
| #define ANIM_PATH_JSHOOT1    "./media/textures/AssetOtherPlayer/FinalPNGJumpingShooting/" |  | ||||||
| #define ANIM_PATH_JSHOOT2	"./media/textures/AssetOtherPlayer/FinalPNGJumpingShooting/ShootingJump/" |  | ||||||
| //1 = shoot sans anim, 2 = shoot avec anim |  | ||||||
| #define ANIM_PATH_SSHOOT1	"./media/textures/AssetOtherPlayer/FinalPNGShooting/" |  | ||||||
| #define ANIM_PATH_SSHOOT2	"./media/textures/AssetOtherPlayer/FinalPNGShooting/Shooting/" |  | ||||||
|  |  | ||||||
| #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/" | ||||||
|   | |||||||
| @@ -459,70 +459,28 @@ void Engine::LoadResource() { | |||||||
|  |  | ||||||
| 	//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM  | 	//AJOUTER LES TEXTURES DANS L'ORDRE DE L'ÉNUM  | ||||||
|  |  | ||||||
| 	//STILL//STANDING |  | ||||||
| 	TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueProfilRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueLeftBack.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueRightBack.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueBackRight.png"); |  | ||||||
|  |  | ||||||
| 	//SHOOTINGSTILL SANS TIRER |  | ||||||
| 	//TextureAtlas::TextureIndex StillFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueFrontRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueProfilShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackLeftShootingLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueBackRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT1 "BlueShootingBackRight.png"); |  | ||||||
|  |  | ||||||
| 	//SHOOTINGSTILL TIRER |  | ||||||
| 	//TextureAtlas::TextureIndex StillFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueFrontRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontLeftFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueLeftShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueProfilShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueProfilShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueBackLeftShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueBackRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex StillBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_SSHOOT2  "BlueShootingBackRightShoot1.png"); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	//JUMP | 	//JUMP | ||||||
|  | 	//TextureAtlas::TextureIndex JumpBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackJumpRight.png"); | ||||||
| 	//TextureAtlas::TextureIndex JumpFront = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueFrontJumpRight.png"); | 	//TextureAtlas::TextureIndex JumpFront = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueFrontJumpRight.png"); | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftFrontJumpLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightFrontJumpRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftBackJumpLeft.png"); | 	//TextureAtlas::TextureIndex JumpQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftBackJumpLeft.png"); | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBackJumpRight.png"); | 	//TextureAtlas::TextureIndex JumpQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBackJumpRight.png"); | ||||||
| 	//TextureAtlas::TextureIndex JumpBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackJumpRight.png"); | 	//TextureAtlas::TextureIndex JumpProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpLeft.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex JumpProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilJumpRight.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex JumpQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftFrontJumpLeft.png"); | ||||||
| 	//SHOOTINGJUMP SANS TIRER  | 	//TextureAtlas::TextureIndex JumpQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightFrontJumpRight.png"); | ||||||
| 	//TextureAtlas::TextureIndex JumpFrontShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueFrontJumpRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueFrontLeftJumpLeftShootingLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueFrontRightJumpRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueProfilLeftJumpLeftShootingLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BluerProfilRightJumprightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackLeftShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueBackLeftJumpLeftShootingLeft.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackRightShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueBackRightJumpRightShootingRight.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpBackShoot = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT1  "BlueBackJumpRightShootingRight.png"); |  | ||||||
|  |  | ||||||
|  |  | ||||||
| 	//SHOOTINGJUMP TIRER |  | ||||||
| 	//TextureAtlas::TextureIndex JumpFrontShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueFrontJumpRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueFrontLeftJumpLeftShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterFrontRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueFrontRightJumpRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueProfilLeftJumpLeftShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpProfiltRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BluerProfilRightJumprightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackLeftShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueBackLeftJumpLeftShootingLeftShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpQuarterBackRightShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueBackRightJumpRightShootingRightShoot1.png"); |  | ||||||
| 	//TextureAtlas::TextureIndex JumpBackShootFire = m_animeAtlas.AddTexture(ANIM_PATH_JSHOOT2  "BlueBackJumpRightShootingRightShoot1.png"); |  | ||||||
|  |  | ||||||
|  | 	//STILL | ||||||
|  | 	//TextureAtlas::TextureIndex StillBack = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueBackRight.png"); | ||||||
|  | 	TextureAtlas::TextureIndex StillFront = m_animeAtlas.AddTexture(ANIME_PATH_STILL "BlueFrontRight.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillQuarterBackLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeftBack.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillQuarterBackRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRightBack.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillProfiltLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilLeft.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillProfiltRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueProfilRight.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillQuarterFrontLeft = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueLeft.png"); | ||||||
|  | 	//TextureAtlas::TextureIndex StillQuarterFrontRight = m_animeAtlas.AddTexture(ANIME_PATH_JUMP "BlueRight.png"); | ||||||
|  |  | ||||||
|  | 	//SHOOTINGSTILL | ||||||
|  | 	//SHOOTINGJUMP | ||||||
|  |  | ||||||
| 	if (!m_animeAtlas.Generate(TEXTURE_SIZE, false)) { | 	if (!m_animeAtlas.Generate(TEXTURE_SIZE, false)) { | ||||||
| 		std::cout << " Unable to generate texture atlas ..." << std::endl; | 		std::cout << " Unable to generate texture atlas ..." << std::endl; | ||||||
| @@ -1283,16 +1241,12 @@ void Engine::Render(float elapsedTime) { | |||||||
| 			Sync sync; | 			Sync sync; | ||||||
| 			uint64_t id = m_conn.getId(); | 			uint64_t id = m_conn.getId(); | ||||||
| 			static std::vector<char*> lsPck; | 			static std::vector<char*> lsPck; | ||||||
| 			static uint64_t sync_acc = 0; |  | ||||||
| 			sync_acc += tstamp; |  | ||||||
|  |  | ||||||
| 			if (sync_acc >= 1000) { | 			if (false) { // TODO: Faire un checkup pour chaque ~1000ms. | ||||||
| 				sync_acc -= 1000; |  | ||||||
| 				sync.sid = id; | 				sync.sid = id; | ||||||
| 				sync.timestamp = tstamp; | 				sync.timestamp = tstamp; | ||||||
| 				sync.position = m_player.GetPositionAbs(); | 				sync.position = m_player.GetPosition(); | ||||||
| 				sync.hp = m_player.GetHP(); | 				sync.hp = m_player.GetHP(); | ||||||
| 				 |  | ||||||
| 				// TODO: Garrocher ca quelque-part.  | 				// TODO: Garrocher ca quelque-part.  | ||||||
| 			} | 			} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ | |||||||
| #include "renderer.h" | #include "renderer.h" | ||||||
| #include "remoteplayer.h" | #include "remoteplayer.h" | ||||||
| #include "booster.h" | #include "booster.h" | ||||||
|  | #include "settings.h" | ||||||
|  |  | ||||||
| class Engine : public OpenglContext { | class Engine : public OpenglContext { | ||||||
| public: | public: | ||||||
| @@ -64,10 +64,6 @@ private: | |||||||
|     void DrawHud(float elapsedTime, BlockType bloc); |     void DrawHud(float elapsedTime, BlockType bloc); | ||||||
|     void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f); |     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; | ||||||
|     BlockInfo* m_blockinfo[BTYPE_LAST]; |     BlockInfo* m_blockinfo[BTYPE_LAST]; | ||||||
| @@ -99,6 +95,7 @@ private: | |||||||
|     irrklang::ISound *m_whoosh[MAX_BULLETS]; |     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)); | ||||||
|  |     Settings m_parameters = Settings(m_audio); | ||||||
|      |      | ||||||
|     Bullet* m_bullets[MAX_BULLETS]; |     Bullet* m_bullets[MAX_BULLETS]; | ||||||
|  |  | ||||||
| @@ -123,8 +120,6 @@ private: | |||||||
|     float m_time_SplashScreen = 0; |     float m_time_SplashScreen = 0; | ||||||
|     float m_titleX = 0; |     float m_titleX = 0; | ||||||
|     float m_titleY = 0; |     float m_titleY = 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; | ||||||
|   | |||||||
| After Width: | Height: | Size: 264 KiB | 
| After Width: | Height: | Size: 320 KiB | 
| After Width: | Height: | Size: 337 KiB | 
| After Width: | Height: | Size: 360 KiB | 
| After Width: | Height: | Size: 394 KiB | 
| After Width: | Height: | Size: 339 KiB | 
| After Width: | Height: | Size: 374 KiB | 
| After Width: | Height: | Size: 656 KiB | 
| After Width: | Height: | Size: 653 KiB | 
| After Width: | Height: | Size: 656 KiB | 
| After Width: | Height: | Size: 652 KiB | 
| After Width: | Height: | Size: 485 KiB | 
| After Width: | Height: | Size: 512 KiB | 
| After Width: | Height: | Size: 575 KiB | 
| After Width: | Height: | Size: 512 KiB | 
| After Width: | Height: | Size: 575 KiB | 
| After Width: | Height: | Size: 716 KiB | 
| After Width: | Height: | Size: 732 KiB | 
| After Width: | Height: | Size: 715 KiB | 
| After Width: | Height: | Size: 731 KiB | 
| After Width: | Height: | Size: 629 KiB | 
| After Width: | Height: | Size: 649 KiB | 
| After Width: | Height: | Size: 644 KiB | 
| After Width: | Height: | Size: 646 KiB | 
| After Width: | Height: | Size: 326 KiB | 
| After Width: | Height: | Size: 268 KiB | 
| After Width: | Height: | Size: 660 KiB | 
| After Width: | Height: | Size: 680 KiB | 
| After Width: | Height: | Size: 659 KiB | 
| After Width: | Height: | Size: 680 KiB | 
| After Width: | Height: | Size: 486 KiB | 
| After Width: | Height: | Size: 494 KiB | 
| After Width: | Height: | Size: 517 KiB | 
| After Width: | Height: | Size: 493 KiB | 
| After Width: | Height: | Size: 517 KiB | 
| After Width: | Height: | Size: 695 KiB | 
| After Width: | Height: | Size: 710 KiB | 
| After Width: | Height: | Size: 701 KiB | 
| After Width: | Height: | Size: 728 KiB | 
| After Width: | Height: | Size: 696 KiB | 
| After Width: | Height: | Size: 732 KiB | 
| After Width: | Height: | Size: 694 KiB | 
| After Width: | Height: | Size: 710 KiB | 
| After Width: | Height: | Size: 410 KiB | 
| After Width: | Height: | Size: 402 KiB | 
| After Width: | Height: | Size: 413 KiB | 
| After Width: | Height: | Size: 402 KiB | 
| After Width: | Height: | Size: 413 KiB | 
| @@ -33,51 +33,48 @@ void RemotePlayer::Init() | |||||||
|  |  | ||||||
| void RemotePlayer::Feed(const netprot::Output out) { | void RemotePlayer::Feed(const netprot::Output out) { | ||||||
|  |  | ||||||
| 	current.position = out.position; | 	//current.position = out.position; | ||||||
| 	current.direction = out.direction; | 	//current.direction = out.direction; | ||||||
| 	current.states = out.states; | 	//current.states = out.states; | ||||||
| 	current.id = out.id; | 	//current.id = out.id; | ||||||
|  |  | ||||||
| 	if (current.position != previous.position) | 	//if (current.position != previous.position) | ||||||
| 	{ | 	//{ | ||||||
| 		Vector3f positionDelta = current.position - previous.position; | 	//	Vector3f positionDelta = current.position - previous.position; | ||||||
| 		m_position = current.position + positionDelta; | 	//	m_position = current.position + positionDelta; | ||||||
| 		m_direction = current.direction;		 | 	//	m_direction = current.direction;		 | ||||||
|  |  | ||||||
| 	} | 	//} | ||||||
|  |  | ||||||
| 	if(current.direction != previous.direction) | 	//if(current.direction != previous.direction) | ||||||
| 	{ | 	//{ | ||||||
| 		m_direction = current.direction; | 	//	m_direction = current.direction; | ||||||
| 		current.direction = current.direction; | 	//	current.direction = current.direction; | ||||||
| 	} | 	//} | ||||||
|  |  | ||||||
| 	if (current.states.shooting) { | 	//if (current.states.shooting) { | ||||||
| 		m_animstate = Anim::SHOOTING; | 	//	m_animstate = Anim::SHOOTING; | ||||||
| 	} | 	//} | ||||||
| 	else if (current.states.jumping) { | 	//else if (current.states.jumping) { | ||||||
| 		m_animstate = Anim::JUMPING; | 	//	m_animstate = Anim::JUMPING; | ||||||
| 	} | 	//} | ||||||
| 	else if (current.states.dead) { | 	//else if (current.states.dead) { | ||||||
| 		m_animstate = Anim::DEAD; | 	//	m_animstate = Anim::DEAD; | ||||||
| 	} | 	//} | ||||||
| 	else if(current.states.powerup){ | 	//else if(current.states.powerup){ | ||||||
| 		m_animstate = Anim::POWERUP; | 	//	m_animstate = Anim::POWERUP; | ||||||
| 	} | 	//} | ||||||
| 	else if (current.states.still) { | 	//else if (current.states.still) { | ||||||
| 		m_animstate = Anim::STILL; | 	//	m_animstate = Anim::STILL; | ||||||
| 	} | 	//} | ||||||
| 	else if (current.states.running) { | 	//else if (current.states.running) { | ||||||
| 		m_animstate = Anim::RUNNING; | 	//	m_animstate = Anim::RUNNING; | ||||||
| 	} | 	//} | ||||||
|  |  | ||||||
| 	previous.direction = current.direction; | 	//previous.direction = current.direction; | ||||||
| 	previous.position = current.position; | 	//previous.position = current.position; | ||||||
| 	previous.states = current.states; | 	//previous.states = current.states; | ||||||
| 	previous.id = current.id; | 	//previous.id = current.id; | ||||||
|  |  | ||||||
| 	m_direction = current.direction; |  | ||||||
| 	m_position = current.position; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime) | void RemotePlayer::Render(TextureAtlas& atlas, Shader& shader, Transformation tran, float elapsedTime) | ||||||
|   | |||||||
							
								
								
									
										146
									
								
								SQCSim2021/settings.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,146 @@ | |||||||
|  | #include "settings.h" | ||||||
|  |  | ||||||
|  | Settings::Settings(Audio& audio) | ||||||
|  |     : m_audio(audio), | ||||||
|  |     m_mainVolume(0.5f), | ||||||
|  |     m_musicVolume(0.5f), | ||||||
|  |     m_sfxVolume(0.5f), | ||||||
|  |     m_resolution(FHD), | ||||||
|  |     m_fullscreen(false), | ||||||
|  |     m_brightness(0.5f), | ||||||
|  |     m_contrast(0.5f), | ||||||
|  |     m_mouseSensitivity(0.5f) { | ||||||
|  |     ApplyResolution(m_resolution); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SaveFile(const std::string& filename) { | ||||||
|  |     std::ofstream file(filename); | ||||||
|  |     if (!file.is_open()) { | ||||||
|  |         std::cerr << "Failed to open file for saving parameters" << std::endl; | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     file << m_mainVolume << '\n'; | ||||||
|  |     file << m_musicVolume << '\n'; | ||||||
|  |     file << m_sfxVolume << '\n'; | ||||||
|  |  | ||||||
|  |     file << static_cast<int>(m_resolution) << '\n'; | ||||||
|  |     file << m_fullscreen << '\n'; | ||||||
|  |     file << m_brightness << '\n'; | ||||||
|  |     file << m_contrast << '\n'; | ||||||
|  |  | ||||||
|  |     file << m_mouseSensitivity << '\n'; | ||||||
|  |  | ||||||
|  |     file.close(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::LoadFile(const std::string& filename) { | ||||||
|  |     std::ifstream file(filename); | ||||||
|  |     if (!file.is_open()) { | ||||||
|  |         std::cerr << "Failed to open file for loading parameters" << std::endl; | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     file >> m_mainVolume; | ||||||
|  |     file >> m_musicVolume; | ||||||
|  |     file >> m_sfxVolume; | ||||||
|  |  | ||||||
|  |     int resolutionValue; | ||||||
|  |     file >> resolutionValue; | ||||||
|  |     m_resolution = static_cast<Resolution>(resolutionValue); | ||||||
|  |  | ||||||
|  |     file >> m_fullscreen; | ||||||
|  |     file >> m_brightness; | ||||||
|  |     file >> m_contrast; | ||||||
|  |  | ||||||
|  |     file >> m_mouseSensitivity; | ||||||
|  |  | ||||||
|  |     file.close(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | float Settings::GetMainVolume() const { | ||||||
|  |     return m_mainVolume; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetMainVolume(float volume) { | ||||||
|  |     m_mainVolume = volume; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::GetMusicVolume() { | ||||||
|  |     m_musicVolume = m_audio.GetMusicVolume(); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetMusicVolume(float volume) { | ||||||
|  |     m_musicVolume = volume; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | float Settings::GetSfxVolume() const { | ||||||
|  |     return m_sfxVolume; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetSfxVolume(float volume) { | ||||||
|  |     m_sfxVolume = volume; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | float Settings::GetBrightness() const { | ||||||
|  |     return m_brightness; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetBrightness(float brightness) { | ||||||
|  |     m_brightness = brightness; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | float Settings::GetContrast() const { | ||||||
|  |     return m_contrast; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetContrast(float contrast) { | ||||||
|  |     m_contrast = contrast; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | bool Settings::GetFullscreen() const { | ||||||
|  |     return m_fullscreen; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetFullscreen(bool fullscreen) { | ||||||
|  |     m_fullscreen = fullscreen; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | const Resolution& Settings::GetResolution() const { | ||||||
|  |     return m_resolution; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetResolution(const Resolution& resolution) { | ||||||
|  |     m_resolution = resolution; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | float Settings::GetMouseSensitivity() const { | ||||||
|  |     return m_mouseSensitivity; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::SetMouseSensitivity(float sensitivity) { | ||||||
|  |     m_mouseSensitivity = sensitivity; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | void Settings::ApplyResolution(Resolution resolution) { | ||||||
|  |     switch (resolution) { | ||||||
|  |     case HD: | ||||||
|  |         m_rezWidth = 1280; | ||||||
|  |         m_rezHeight = 720; | ||||||
|  |         break; | ||||||
|  |     case FHD: | ||||||
|  |         m_rezWidth = 1920; | ||||||
|  |         m_rezHeight = 1080; | ||||||
|  |         break; | ||||||
|  |     case QHD: | ||||||
|  |         m_rezWidth = 2560; | ||||||
|  |         m_rezHeight = 1440; | ||||||
|  |         break; | ||||||
|  |     case UHD: | ||||||
|  |         m_rezWidth = 3840; | ||||||
|  |         m_rezHeight = 2160; | ||||||
|  |         break; | ||||||
|  |     default: | ||||||
|  |         break; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										70
									
								
								SQCSim2021/settings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,70 @@ | |||||||
|  | #ifndef SETTINGS_H__ | ||||||
|  | #define SETTINGS_H__ | ||||||
|  |  | ||||||
|  | #include <iostream> | ||||||
|  | #include <fstream> | ||||||
|  | #include <sstream> | ||||||
|  | #include <string> | ||||||
|  | #include <map> | ||||||
|  |  | ||||||
|  | #include "define.h" | ||||||
|  | #include "audio.h" | ||||||
|  |  | ||||||
|  | class Settings { | ||||||
|  | public: | ||||||
|  | 	Settings(Audio& audio); | ||||||
|  |  | ||||||
|  | 	void SaveFile(const std::string& filename); | ||||||
|  | 	void LoadFile(const std::string& filename); | ||||||
|  |  | ||||||
|  | 	// Audio | ||||||
|  | 	float GetMainVolume() const; | ||||||
|  | 	void SetMainVolume(float volume); | ||||||
|  |  | ||||||
|  | 	void GetMusicVolume(); | ||||||
|  | 	void SetMusicVolume(float volume); | ||||||
|  |  | ||||||
|  | 	float GetSfxVolume() const; | ||||||
|  | 	void SetSfxVolume(float volume); | ||||||
|  |  | ||||||
|  | 	// Graphic | ||||||
|  | 	float GetBrightness() const; | ||||||
|  | 	void SetBrightness(float brightness); | ||||||
|  |  | ||||||
|  | 	float GetContrast() const; | ||||||
|  | 	void SetContrast(float contrast); | ||||||
|  |  | ||||||
|  | 	bool GetFullscreen() const; | ||||||
|  | 	void SetFullscreen(bool fullscreen); | ||||||
|  |  | ||||||
|  | 	const Resolution& GetResolution() const; | ||||||
|  | 	void SetResolution(const Resolution& resolution); | ||||||
|  |  | ||||||
|  | 	// Gameplay | ||||||
|  | 	float GetMouseSensitivity() const; | ||||||
|  | 	void SetMouseSensitivity(float sensitivity); | ||||||
|  |  | ||||||
|  | 	void ApplyResolution(Resolution resolution); | ||||||
|  |  | ||||||
|  | private: | ||||||
|  |  | ||||||
|  | 	Audio& m_audio; | ||||||
|  | 	// Audio | ||||||
|  | 	float m_mainVolume; | ||||||
|  | 	float m_musicVolume; | ||||||
|  | 	float m_sfxVolume; | ||||||
|  |  | ||||||
|  | 	// Graphic | ||||||
|  | 	Resolution m_resolution; | ||||||
|  | 	bool m_fullscreen; | ||||||
|  | 	int m_rezWidth; | ||||||
|  | 	int m_rezHeight; | ||||||
|  | 	float m_brightness; | ||||||
|  | 	float m_contrast; | ||||||
|  |  | ||||||
|  | 	// Gameplay | ||||||
|  | 	float m_mouseSensitivity; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #endif // PARAMETERS_H | ||||||