summaryrefslogtreecommitdiffstats
path: root/labb3/tiles/TileList.h
blob: 026721f5b31c71ef3263e25a43876e77a7067a2b (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
// This is the .h file you will edit and turn in.
// We have provided a skeleton for you,
// but you must finish it as described in the spec.
// Also remove these comments here and add your own, as well as on the members.
// TODO: remove this comment header

#ifndef TILELIST_H
#define TILELIST_H

#include <QGraphicsScene>
#include "Tile.h"

class TileList {
public:
    TileList();
    ~TileList();
    void addTile(Tile tile);
    void drawAll(QGraphicsScene* scene) const;
    int indexOfTopTile(int x, int y) const;
    void lower(int x, int y);
    void raise(int x, int y);
    void remove(int x, int y);
    void removeAll(int x, int y);

private:
    int cur_size = 0;
    int amount_tiles;
    Tile *tiles;

    int indexOfBottomTile(int x, int y) const;
    void shiftRight(int start, int end);
    void shiftLeft(int start, int end);
};

#endif // TILELIST_H