]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/dragonblocks/block_def.cpp
Initial Commit
[dragonblocks3d.git] / src / dragonblocks / block_def.cpp
1 #include <iostream>
2 #include <stdexcept>
3 #include "block_def.hpp"
4
5 using namespace std;
6 using namespace dragonblocks;
7
8 BlockDef::BlockDef(const string &n, const vector<Texture> &t) : name(n), tiles(t)
9 {
10         int s = tiles.size();
11         if (s == 0) {
12                 drawable = false;
13         } else {
14                 for (int i = 0; s < 6; i += s) {
15                         for (int j = 0; j < i && j + i < 6; j++) {
16                                 tiles[i + j] = tiles[j];
17                         }
18                 }
19         }
20 }
21
22 BlockDef::BlockDef(const string &n, const Texture &t) : BlockDef(n, {t, t, t, t, t, t})
23 {
24 }
25
26 BlockDef::BlockDef(const string &n) : BlockDef(n, vector<Texture>())
27 {
28 }