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
,
51 * @param application the FOX application object
52 * @param lsystem the Lindenmayer-system
54 RenderingSurface(FXApp
*application
, LindenmayerSystem
*lsystem
);
57 * Create and initialize the window
67 * Force an update of the rendering surface
72 * Called by the system when the left mouse button is pressed
73 * @param sender the sender object
74 * @param selector message type and id
75 * @param data event related data
78 long onLeftMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
81 * Called by the system when the left mouse button is released
82 * @param sender the sender object
83 * @param selector message type and id
84 * @param data event related data
87 long onLeftMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
90 * Called by the system when the middle mouse button is pressed
91 * @param sender the sender object
92 * @param selector message type and id
93 * @param data event related data
96 long onMiddleMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
99 * Called by the system when the middle mouse button is released
100 * @param sender the sender object
101 * @param selector message type and id
102 * @param data event related data
105 long onMiddleMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
108 * Called by the system when the right mouse button is pressed
109 * @param sender the sender object
110 * @param selector message type and id
111 * @param data event related data
114 long onRightMouseDown(FXObject
*sender
, FXSelector selector
, void *data
);
117 * Called by the system when the right mouse button is released
118 * @param sender the sender object
119 * @param selector message type and id
120 * @param data event related data
123 long onRightMouseUp(FXObject
*sender
, FXSelector selector
, void *data
);
126 * Called by the system when the mouse is moved
127 * @param sender the sender object
128 * @param selector message type and id
129 * @param data event related data
132 long onMouseMove(FXObject
*sender
, FXSelector selector
, void *data
);
135 * Called by the system when the rendering surface needs a repaint
136 * @param sender the sender object
137 * @param selector message type and id
138 * @param data event related data
141 long onRepaint(FXObject
*sender
, FXSelector selector
, void *data
);
148 RenderingSurface() {}
152 FXGLVisual
*_visual
; // Pixel format info
153 FXGLCanvas
*_canvas
; // OpenGL-capable drawing area
155 LindenmayerSystem
*_lsystem
; // The Lindenmayer System
163 double _modelRotationY
;
165 // Mouse button status