ajout de billot de bois

This commit is contained in:
Jonathan Trottier
2023-11-20 16:02:45 -05:00
parent 79013fe5d1
commit 3118f71b9c
7 changed files with 192 additions and 109 deletions

View File

@@ -398,6 +398,7 @@ void Engine::LoadResource() {
TextureAtlas::TextureIndex texIceIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "metal2.png");
TextureAtlas::TextureIndex texGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "grass.png");
TextureAtlas::TextureIndex texMetalIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "dirt.png");
TextureAtlas::TextureIndex texGreenGrassIndex = m_textureAtlas.AddTexture(TEXTURE_PATH "greengrass.png");
if (!m_textureAtlas.Generate(TEXTURE_SIZE, false)) {
std::cout << " Unable to generate texture atlas ..." << std::endl;
@@ -413,7 +414,8 @@ void Engine::LoadResource() {
m_blockinfo[BTYPE_METAL] = new BlockInfo(BTYPE_METAL, "Metal", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texIceIndex, u, v, s, s);
m_blockinfo[BTYPE_ICE] = new BlockInfo(BTYPE_ICE, "Ice", u, v, s, 1);
m_textureAtlas.TextureIndexToCoord(texGreenGrassIndex, u, v, s, s);
m_blockinfo[BTYPE_GREENGRASS] = new BlockInfo(BTYPE_GREENGRASS, "GreenGrass", u, v, s, 1);
std::cout << " Loading and compiling shaders ..." << std::endl;
if (!m_shader01.Load(SHADER_PATH "shader01.vert", SHADER_PATH "shader01.frag", true)) {
std::cout << " Failed to load shader " << std::endl;
@@ -441,6 +443,7 @@ void Engine::SystemNotification(std::string systemLog) {
DisplayNotification(message);
}
void Engine::KillNotification(Player killer, Player killed) {
std::string message = "";
@@ -1023,11 +1026,14 @@ void Engine::Render(float elapsedTime) {
m_player.ApplyTransformation(skybox, false); // Version d'ApplyTransformation qui ne tient compte que de la rotation
// (donc l'objet ne bouge pas relativement au joueur, ce qui est pratique pour une skybox!).
if (m_key1) bloc++;
else if (m_key2) bloc--;
if (m_mouseWU) bloc++;
else if (m_mouseWD) bloc--;
if (bloc == BTYPE_LAST + 1) bloc = BTYPE_AIR + 1;
else if (bloc == BTYPE_AIR) bloc = BTYPE_LAST; // La selection de BTYPE_LAST <20>quipe l'arme.
m_mouseWU = m_mouseWD = false;
m_mouseWU = m_mouseWD = m_key1 = m_key2 = false;
if (m_mouseL) {
if (bloc != BTYPE_LAST)
@@ -1200,6 +1206,10 @@ void Engine::KeyPressEvent(unsigned char key) {
break;
case 24: // Y - Ignorer
break;
case 27: // 1
break;
case 28: // 2
break;
case 255: // Fn - Ignorer
break;
default:
@@ -1274,6 +1284,12 @@ void Engine::KeyReleaseEvent(unsigned char key) {
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
case 27: // 1
m_key1 = true;
break;
case 28: // 2
m_key2 = true;
break;
case 57: // Espace - Stop sauter
m_keySpace = false;
break;
@@ -1394,3 +1410,5 @@ bool Engine::LoadTexture(Texture& texture, const std::string& filename, bool use
return true;
}

View File

@@ -58,6 +58,9 @@ private:
void DrawHud(float elapsedTime, BlockType bloc);
void PrintText(float x, float y, const std::string& t, float charSizeMultiplier = 1.0f);
Connector m_conn;
Shader m_shader01;
BlockInfo* m_blockinfo[BTYPE_LAST];
@@ -123,6 +126,8 @@ private:
bool m_soloMultiChoiceMade = false;
bool m_stopcountdown = false;
bool m_key1 = false;
bool m_key2 = false;
bool m_keyK = false;
bool m_keyL = false;
bool m_keyW = false;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB