From 078cb33c27b6ec08514bb17c19e8a2e5ab51a220 Mon Sep 17 00:00:00 2001 From: MarcEricMartel <74071476+MarcEricMartel@users.noreply.github.com> Date: Mon, 6 Dec 2021 21:46:46 -0500 Subject: [PATCH] Petit ajout de choix de bloc avec la wheel de souris. --- SQCSim2021/engine.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/SQCSim2021/engine.cpp b/SQCSim2021/engine.cpp index 7f24df8..7d3d913 100644 --- a/SQCSim2021/engine.cpp +++ b/SQCSim2021/engine.cpp @@ -193,8 +193,19 @@ 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!). + static BlockType bloc = 1; + + if (m_mouseWU) bloc++; + else if (m_mouseWD) bloc--; + if (bloc == BTYPE_LAST) + bloc = BTYPE_DIRT; + else if (bloc == BTYPE_AIR) + bloc = BTYPE_LAST - 1; + + m_mouseWU = m_mouseWD = false; + if (m_mouseL) - m_world.ChangeBlockAtCursor(BTYPE_DIRT, m_player, m_block); + m_world.ChangeBlockAtCursor(bloc, m_player, m_block); else if (m_mouseR) m_world.ChangeBlockAtCursor(BTYPE_AIR, m_player, m_block);