[go: up one dir, main page]

Menu

[dc7c97]: / src / polar-view.h  Maximize  Restore  History

Download this file

65 lines (53 with data), 2.1 kB

 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* mazen-ng
* Copyright (C) Jacob Zimmermann 2009 <jacob@jzimm.net>
*
* mazen-ng is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* mazen-ng is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _POLAR_VIEW_H_
#define _POLAR_VIEW_H_
#include <gtkmm.h>
#include <vector>
#include "grid-view.h"
struct xy;
class PolarView: public GridView
{
private:
std::vector<Cairo::Matrix> rot;
int width, height;
double maze_x, maze_y;
int prev_x, prev_y;
void sol_path_add (Cairo::RefPtr<Cairo::Context> cr, const xy& p);
protected:
PolarView ();
double gap () const;
inline double angle_gap (double r) const {
return asin (gap () / r);
}
double angle;
Cairo::Rectangle cent_room_rect;
void point_coord (int y, double& dx, double& dy) const;
double radius_for_x (int x) const { return radius_for_x ((double) x); }
double radius_for_x (double x) const;
enum cline_type { NORMAL, OPEN, CLOSED };
virtual void rline (Cairo::RefPtr<Cairo::Context> cr, int y, double r, bool off) const;
virtual void cline (Cairo::RefPtr<Cairo::Context> cr, int y, double r, cline_type ltype) const = 0;
public:
virtual void set_maze (Glib::RefPtr<GridMaze> maze);
virtual void set_size (int width, int height);
virtual void render (Cairo::RefPtr<Cairo::Context> cr, Artwork::Renderer& renderer);
virtual void render_solution (Cairo::RefPtr<Cairo::Context> cr, Artwork::Renderer& renderer);
};
#endif // _POLAR_VIEW_H_