summary refs log tree commit diff stats
path: root/src/level.h
blob: bc05837b959aa0987d69833dbb3b19ff79f4b575 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef LEVEL_H_678CFCCF
#define LEVEL_H_678CFCCF

#include <vector>
#include "renderer.h"
#include "vector.h"
#include "consts.h"
#include "tileset.h"

class Level {
public:

  Level()
  {
    size_ = LEVEL_SIZE;

    tiles_.resize(size_.w() * size_.h());
  }

  const vec2s& getSize() const
  {
    return size_;
  }

  size_t at(vec2s pos) const
  {
    return at(pos.x(), pos.y());
  }

  size_t at(size_t x, size_t y) const
  {
    return tiles_.at(x + size_.w() * y);
  }

  const Tileset& getTileset() const
  {
    return tileset_;
  }

  texture_ptr render(SDL_Renderer* ren, Layer layer) const;

private:

  vec2s size_;
  std::vector<size_t> tiles_;
  Tileset tileset_;
};

#endif /* end of include guard: LEVEL_H_678CFCCF */