Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Tilemap implementation  (Read 1102 times)

0 Members and 1 Guest are viewing this topic.

joe5513

  • Newbie
  • *
  • Posts: 11
    • View Profile
Tilemap implementation
« on: October 18, 2017, 03:11:53 pm »
Hello everyone!

Ive been working with sfml (and with C++ in general) for a few month now, and have some questions.

Im trying to implement Tilemap with chunks, and things goes pretty fine, but as it is my first attempt to make something like this, i wonder if im doing it right.

So can someone review my sources and point me to what i did wrong and what my common mistakes are.

https://github.com/joe5513/fragment

In short:

Grid is the class that represents a whole tilemap;
Chunk is the class that represents a part of tilemap, and contains Cells data and vertices;
Cell is the value struct that representing its type;

Grid is allocating Chunks and stores them in std::vector<Chunk*>;
Chunk is allocating Cells (aka tiles) and store them in Cell* pointer;
Grid object have some functionality to set and get Cells, to map them into  'world' coordinates and vice versa, and to draw Chunks;

 

anything