Début TP2 + Handling des événements de touches de mouvement

This commit is contained in:
Marc-Eric Martel
2021-09-24 10:15:43 -04:00
parent 6d62a36bd3
commit 2f8e6dbb30
186 changed files with 26429 additions and 442 deletions

View File

@@ -1,26 +0,0 @@
#include "blockarray3d.h"
BlockArray3d::BlockArray3d(int x, int y, int z) : m_x(x), m_y(y), m_z(z) {
m_blocks = new BlockType[x * y * z];
Reset(BTYPE_AIR);
}
BlockArray3d::BlockArray3d(BlockArray3d& ba) : m_x(ba.m_x), m_y(ba.m_y), m_z(ba.m_z) {
m_blocks = new BlockType[ba.m_x*ba.m_y*ba.m_z];
for (int index = 0; index < (m_x * m_y * m_z); ++index)
m_blocks[index] = ba.m_blocks[index];
}
BlockArray3d::~BlockArray3d() { delete[] m_blocks; }
void BlockArray3d::Set(int x, int y, int z, BlockType type) { m_blocks[GetPosition(x, y, z)] = type; }
BlockType BlockArray3d::Get(int x, int y, int z) const { return m_blocks[GetPosition(x, y, z)]; }
void BlockArray3d::Reset(BlockType type) {
for (int index = 0; index < (m_x * m_y * m_z); ++index)
m_blocks[index] = type;
}
int BlockArray3d::GetPosition(int x, int y, int z) const { return x + (z * m_x) + (y * m_z * m_x); }