summaryrefslogtreecommitdiffstats
path: root/engine/include/bound.hpp
blob: a924e908c90d152be54a4e4b3355b9bfbe34f029 (plain)
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
#ifndef __FLATBOUND_H__
#define __FLATBOUND_H__

#include "object.hpp"
#include "svector.h"

namespace flat {

typedef SVector<int, 2> pixel;

class FlatBound : virtual public flat::object
{
    pixel location;

public:

    FlatBound() {}
    virtual ~FlatBound() {}

    virtual void scale(double ratio) = 0;

    virtual pixel extremum(const FlatBound*) const = 0;

    bool isColliding(const FlatBound *other) const
    {
        return (other.extremum(this) - location) < (this.extremum(other) - location);
    }

    const pixel& getLocation() const
    {
        return location;
    }

    void setLocation(const pixel &loc)
    {
        this->location = loc;
    }
};

}

#endif