annotate mde/gui/renderer/SimpleRenderer.d @ 32:316b0230a849

Lots more work on the GUI. Also renamed lots of files. Lots of changes to the GUI. Renderer is now used exclusively for rendering and WidgetDecoration is gone. Renamed lots of files to conform to case policies. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Wed, 30 Apr 2008 18:05:56 +0100
parents
children 052df9b2fe07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
1 /* LICENSE BLOCK
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
2 Part of mde: a Modular D game-oriented Engine
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
3 Copyright © 2007-2008 Diggory Hardy
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
4
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify it under the terms
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
6 of the GNU General Public License as published by the Free Software Foundation, either
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
7 version 2 of the License, or (at your option) any later version.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
8
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
11 See the GNU General Public License for more details.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
12
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
13 You should have received a copy of the GNU General Public License
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
15
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
16 /** A simple renderer. */
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
17 module mde.gui.renderer.SimpleRenderer;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
18
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
19 import mde.gui.renderer.IRenderer;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
20
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
21 import gl = mde.gl.basic;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
22
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
23 /** Interface for renderers.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
24 *
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
25 * Renderers provide unified drawing methods for widget, e.g. to draw a window background, a frame,
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
26 * or a button. The renderer will effectively be synonymous with the theme, except that a scripted
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
27 * renderer may also be available.
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
28 *
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
29 * The renderer is intended to be per-GUI. */
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
30 class SimpleRenderer : IRenderer
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
31 {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
32 int windowBorder () {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
33 return 20;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
34 }
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
35
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
36 int layoutSpacing () {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
37 return 4;
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
38 }
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
39
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
40
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
41 void drawWindow (int x, int y, int w, int h) {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
42 gl.setColor (0f, 0f, 1f);
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
43 gl.drawBox (x,y, w,h);
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
44
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
45 gl.setColor (.3f, .3f, .3f);
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
46 gl.drawBox (x+20, y+20, w-40, h-40);
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
47 }
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
48
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
49 void drawWidgetBack (int x, int y, int w, int h) {}
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
50
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
51 void drawBox (int x, int y, int w, int h) {
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
52 gl.drawBox (x,y, w,h);
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
53 }
316b0230a849 Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
54 }