Merge branch 'master' into linux

This commit is contained in:
MarcEricMartel 2023-10-03 11:34:02 -04:00
commit c85f7df15e
700 changed files with 120630 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -22,7 +22,7 @@
#define FRAMES_DELETE_CHUNKS 1
#define THREADS_GENERATE_CHUNKS 8
#define THREADS_UPDATE_CHUNKS 3
#define THREADS_UPDATE_CHUNKS 6
#define THREADS_DELETE_CHUNKS 3
#define VIEW_DISTANCE 512 // Si les chunks arrêtent de s'afficher pendant une game et qu'il y a un access violation quand tu quitte, il faut augmenter ce chiffre.

View File

@ -5,7 +5,7 @@ Player::Player(const Vector3f& position, float rotX, float rotY) : m_position(po
m_velocity = Vector3f(0, 0, 0);
m_airborne = true;
m_hp = 0.75f; //TODO: Remettre à 1.0f
m_username = "Zelda Bee-Bop";
m_username = "Zelda Bee-Bop56";
}
void Player::TurnLeftRight(float value) {

View File

@ -105,8 +105,8 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>external\irrKlang-1.6.0\include;external\glew210\include;external\devil178\include;external\sfml251\include;$(IncludePath)</IncludePath>
<LibraryPath>external\glew210\lib;external\sfml251\lib;external\devil178\lib;external\irrKlang-1.6.0\lib\Win32-visualStudio;$(LibraryPath)</LibraryPath>
<IncludePath>external\irrKlang-1.6.0\include;external\glew210\include;external\devil180\include;external\sfml251-32\include;$(IncludePath)</IncludePath>
<LibraryPath>external\glew210\lib\Release\Win32;external\sfml251-32\lib;external\devil180\lib\x86\Release;external\irrKlang-1.6.0\lib\Win32-visualStudio;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
@ -115,8 +115,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>external\devil180\include;external\irrKlang-1.6.0\include;external\sfml251\include;external\glew210\include;$(IncludePath)</IncludePath>
<LibraryPath>external\sfml251\lib;external\devil180\lib\x86\Release;external\glew210\lib\Release\Win32;$(LibraryPath);external\irrKlang-1.6.0\lib\Win32-visualStudio</LibraryPath>
<IncludePath>external\devil180\include;external\irrKlang-1.6.0\include;external\sfml251-32\include;external\glew210\include;$(IncludePath)</IncludePath>
<LibraryPath>external\sfml251-32\lib;external\devil180\lib\x86\Release;external\glew210\lib\Release\Win32;$(LibraryPath);external\irrKlang-1.6.0\lib\Win32-visualStudio</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>

View File

@ -1,6 +1,8 @@
#ifndef CLI_DEFINE_H__
#define CLI_DEFINE_H__
//#define SFML_STATIC true
#include <iostream>
#include <chrono>
#include <iomanip>
@ -18,8 +20,8 @@
#define SRV_ADDR "127.0.0.1"
#define COUNTDOWN 300
#define BASE_WIDTH 640
#define BASE_HEIGHT 480
#define BASE_WIDTH 1920
#define BASE_HEIGHT 1080
#define TEXTURE_PATH "./media/textures/"
#define SHADER_PATH "./media/shaders/"

View File

@ -1,5 +1,23 @@
#include "engine.h"
#include <iostream>
#include <chrono>
#include <thread>
#include <queue>
// Define a structure to represent notifications
struct Notification {
std::string message;
float displayStartTime = 0.0f;
};
// Use a queue to manage notifications
//std::queue<Notification> notificationQueue;
// Use a vector to manage notifications
std::vector<Notification> notifications;
Engine::Engine() {}
Engine::~Engine() {
@ -113,6 +131,91 @@ void Engine::LoadResource() {
void Engine::UnloadResource() {}
void Engine::SystemNotification(std::string systemLog) {
std::string message = "";
message = systemLog;
DisplayNotification(message);
}
void Engine::KillNotification(Player killer, Player killed) {
std::string message = "";
message = killed.GetUsername() + " killed by -> " + killer.GetUsername();
DisplayNotification(message);
}
void Engine::DisplayNotification(std::string message) {
if (message.length() > 45) {
message = message.substr(0, 45);
}
// Create a new notification and add it to the queue
Notification newNotification;
newNotification.message = message;
newNotification.displayStartTime = m_time;
notifications.push_back(newNotification);
}
// Add a method to process the notification queue
void Engine::ProcessNotificationQueue() {
m_textureFont.Bind();
float scale = GetScale();
unsigned int xOffset = Width() - Width() * 0.26;
unsigned int yOffset = Height() - (Height() / 2.2);
// Iterate through the notifications and display them
for (auto it = notifications.begin(); it != notifications.end(); ) {
float timeSinceDisplay = m_time - it->displayStartTime;
// Display the notification message with vertical offset
unsigned int y = yOffset - (static_cast<unsigned int>(scale * 20) * (it - notifications.begin()));
glDisable(GL_STENCIL_TEST);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glBlendEquation(GL_FUNC_ADD);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, Width(), 0, Height(), -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
PrintText(xOffset, y, scale, it->message);
glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR);
glBlendEquation(GL_FUNC_SUBTRACT);
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
// Check if it's time to remove the notification (display for 2 seconds)
if (timeSinceDisplay >= 4.0f) {
it = notifications.erase(it); // Remove the notification
}
else {
++it;
}
}
}
void Engine::DisplayCrosshair() {
m_textureCrosshair.Bind();
static const int crossSize = 32;
@ -261,6 +364,17 @@ void Engine::DrawHud(float elapsedTime, BlockType bloc) {
int timer = GetCountdown(elapsedTime);
// Appel de la fonction pour l'affichage de notifications
if (m_keyK) {
SystemNotification(m_messageNotification);
m_keyK = false;
}
if (m_keyL) {
KillNotification(m_player, m_player);
m_keyL = false;
}
if (m_displayInfo) {
DisplayInfo(elapsedTime, bloc);
}
@ -423,6 +537,7 @@ void Engine::Render(float elapsedTime) {
if (m_isSkybox) m_skybox.Render(skybox);
ProcessNotificationQueue();
DrawHud(elapsedTime, bloc);
static bool fell = false;
@ -474,6 +589,13 @@ void Engine::KeyPressEvent(unsigned char key) {
break;
case 5: // F - Ignorer
break;
case 10: // K - Debugging DisplayNotification()
m_keyK = true;
m_messageNotification = "notifications systeme peuvent être affiché";
break;
case 11: // L - Debugging DisplayNotification()
m_keyL = true;
break;
case 6: // G - Ignorer
break;
case 12: // M - Ignorer
@ -522,6 +644,12 @@ void Engine::KeyReleaseEvent(unsigned char key) {
m_displayInfo = !m_displayInfo;
std::cout << "DISPLAY INFO " << (m_displayInfo ? "enabled" : "disabled") << std::endl;
break;
case 10: // K
m_keyK = false;
break;
case 11: // L - Debugging DisplayNotification()
m_keyL = false;
break;
case 12: // M - Toggle music
m_audio.ToggleMusicState();
break;

View File

@ -43,6 +43,10 @@ private:
bool LoadTexture(Texture& texture, const std::string& filename, bool useMipmaps = true, bool stopOnError = true);
void SystemNotification(std::string systemLog);
void KillNotification(Player killer, Player killed);
void DisplayNotification(std::string message);
void ProcessNotificationQueue();
void DisplayCrosshair();
void DisplayCurrentItem();
void DisplayHud(int timer);
@ -70,7 +74,7 @@ private:
irrklang::ISound* m_scream;
Player m_player = Player(Vector3f(.5f, CHUNK_SIZE_Y + 1.8f, .5f));
Bullet* m_bullets[MAX_BULLETS];
float m_scale;
@ -89,6 +93,8 @@ private:
bool m_resetcountdown = false;
bool m_stopcountdown = false;
bool m_keyK = false;
bool m_keyL = false;
bool m_keyW = false;
bool m_keyA = false;
bool m_keyS = false;
@ -99,6 +105,8 @@ private:
bool m_mouseC = false;
bool m_mouseWU = false;
bool m_mouseWD = false;
std::string m_messageNotification = "";
};
#endif // ENGINE_H__

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,98 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">SFML 2.5.1</span>
</div>
</div>
<div id="content">
<!-- Generated by Doxygen 1.8.14 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_c0a853e81d6f1c1f0a3eb7a27dc24256.html">SFML</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> </div>
<div class="headertitle">
<div class="title">GpuPreference.hpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Headers.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;SFML/Config.hpp&gt;</code><br />
</div>
<p><a href="GpuPreference_8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ab0233c2d867cbd561036ed2440a4fec0"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="GpuPreference_8hpp.html#ab0233c2d867cbd561036ed2440a4fec0">SFML_DEFINE_DISCRETE_GPU_PREFERENCE</a></td></tr>
<tr class="memdesc:ab0233c2d867cbd561036ed2440a4fec0"><td class="mdescLeft">&#160;</td><td class="mdescRight">A macro to encourage usage of the discrete GPU. <a href="#ab0233c2d867cbd561036ed2440a4fec0">More...</a><br /></td></tr>
<tr class="separator:ab0233c2d867cbd561036ed2440a4fec0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Headers. </p>
<p>File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE </p>
<p class="definition">Definition in file <a class="el" href="GpuPreference_8hpp_source.html">GpuPreference.hpp</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ab0233c2d867cbd561036ed2440a4fec0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0233c2d867cbd561036ed2440a4fec0">&#9670;&nbsp;</a></span>SFML_DEFINE_DISCRETE_GPU_PREFERENCE</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE</td>
</tr>
</table>
</div><div class="memdoc">
<p>A macro to encourage usage of the discrete GPU. </p>
<p>In order to inform the Nvidia/AMD driver that an SFML application could benefit from using the more powerful discrete GPU, special symbols have to be publicly exported from the final executable.</p>
<p>SFML defines a helper macro to easily do this.</p>
<p>Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the global scope of a source file that will be linked into the final executable. Typically it is best to place it where the main function is also defined. </p>
<p class="definition">Definition at line <a class="el" href="GpuPreference_8hpp_source.html#l00069">69</a> of file <a class="el" href="GpuPreference_8hpp_source.html">GpuPreference.hpp</a>.</p>
</div>
</div>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
Copyright &copy; Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More