1c7ebff77251ee9bd8d5290b7372b17305c3107b
1 // Copyright (C) 2006 Erik Dahlberg
3 // This file is part of LSystem3D.
5 // LSystem3D is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // LSystem3D is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with LSystem3D; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef RENDERINGSURFACE_H
23 #define RENDERINGSURFACE_H
28 #include "lindenmayersystem.h"
33 * The OpenGL rendering surface
35 class RenderingSurface
: public FXMainWindow
37 // macro to set up class declaration
38 FXDECLARE(RenderingSurface
)
45 ID_CANVAS
= FXMainWindow::ID_LAST
,
52 * @param application the application object
54 RenderingSurface(FXApp
*application
);
59 virtual ~RenderingSurface();
63 * Create and initialize the window
65 virtual void create();
73 * Force an update of the rendering surface
79 * Called by the system when the left mouse button is pressed
80 * @param sender the sender object
81 * @param selector message type and id
82 * @param data event related data
85 long onLeftMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
88 * Called by the system when the left mouse button is released
89 * @param sender the sender object
90 * @param selector message type and id
91 * @param data event related data
94 long onLeftMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
97 * Called by the system when the middle mouse button is pressed
98 * @param sender the sender object
99 * @param selector message type and id
100 * @param data event related data
103 long onMiddleMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
106 * Called by the system when the middle mouse button is released
107 * @param sender the sender object
108 * @param selector message type and id
109 * @param data event related data
112 long onMiddleMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
115 * Called by the system when the right mouse button is pressed
116 * @param sender the sender object
117 * @param selector message type and id
118 * @param data event related data
121 long onRightMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
124 * Called by the system when the right mouse button is released
125 * @param sender the sender object
126 * @param selector message type and id
127 * @param data event related data
130 long onRightMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
133 * Called by the system when the mouse is moved
134 * @param sender the sender object
135 * @param selector message type and id
136 * @param data event related data
139 long onMouseMove(FXObject
*sender
, FXSelector selector
, void *data
);
142 * Called by the system when the rendering surface needs a repaint
143 * @param sender the sender object
144 * @param selector message type and id
145 * @param data event related data
148 long onRepaint(FXObject
*sender
, FXSelector selector
, void *data
);
151 * Called by the system when the close button is pressed
152 * @param sender the sender object
153 * @param selector message type and id
154 * @param data event related data
157 long onQuit(FXObject
*sender
, FXSelector selector
, void *data
);
161 * Set current L-system generator
162 * @param lsystem the L-system generator
164 void setLSystem(LindenmayerSystem
*lsystem
);
171 RenderingSurface() {}
174 FXGLVisual
*_visual
; // Pixel format info
175 FXGLCanvas
*_canvas
; // OpenGL-capable drawing area
177 LindenmayerSystem
*_lsystem
; // The Lindenmayer system generator
186 double _modelRotationY
;
188 // Mouse button status