00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef HEXGRID_H
00020 #define HEXGRID_H
00021
00022 #include <item.h>
00023 #include <matrix2d.h>
00024
00025 namespace Papyrus {
00026
00031 class Hexgrid : public Group
00032 {
00033 public:
00034 typedef enum STYLE {SIDE, VERTEX} Style;
00035
00036 Hexgrid(Vertex upperleft, int width, int height, double hexrad);
00037 Hexgrid(Vertex upperleft, std::string filename, double hexrad);
00038
00039 ~Hexgrid();
00040
00041 virtual void pl_insert();
00042
00043 bool has_outline() { return _use_outline; }
00044 bool use_outline(bool uo) { _use_outline = uo; }
00045 RGBA get_outline() { return _outline; }
00046 void set_outline(RGBA& outline) { _use_outline = true; _outline = outline; }
00047
00048 double get_edge() { return _halfedge*2.0; }
00049 double get_apothem() { return _apothem; }
00050
00051 double get_radius() { return _radius; }
00052 void set_radius(double radius);
00053
00054 Vertex& get_upperleft() { return _upperleft; }
00055 void set_upperleft(Vertex& upperleft) { _upperleft = upperleft; }
00056
00057 Style get_style() { return _style; }
00058 void set_style(Style s) { _style = s; }
00059
00060 void set_color(int x, int y, RGBA& color);
00061
00062 protected:
00063 RGBA* _colors;
00064 bool _use_outline;
00065 RGBA _outline;
00066 Vertex _upperleft;
00067 int _width, _height;
00068 double _radius, _apothem, _halfedge;
00069 Style _style;
00070
00071 };
00072
00073 };
00074
00075
00076 #endif