Mercurial > projects > mde
annotate mde/gui/renderer/SimpleRenderer.d @ 114:b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 19 Dec 2008 15:15:06 +0000 |
parents | 1655693702fc |
children | 2ac3e0012788 |
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 |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
21 import derelict.opengl.gl; |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
22 import mde.font.font; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
24 /** Interface for renderers. |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
25 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
26 * 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
|
27 * 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
|
28 * 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
|
29 * |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
30 * 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
|
31 class SimpleRenderer : IRenderer |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
32 { |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
33 this () { |
100
0ea4a3e651ae
There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
99
diff
changeset
|
34 defaultFont = FontStyle.getDefault; |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
35 } |
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
36 |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
37 alias Border.BTYPE BTYPE; |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
38 override Border getBorder (BTYPE type, bool wS, bool hS) { |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
39 Border border; |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
40 with (border) { |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
41 if (type & BTYPE.RESIZE) { |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
42 if (wS) capability = RESIZE.X1 | RESIZE.X2; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
43 if (hS) capability |= RESIZE.Y1 | RESIZE.Y2; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
44 } |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
45 if (type & BTYPE.LARGE) { |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
46 y1 = 12; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
47 y2 = 6; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
48 } |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
49 else if (type & BTYPE.SMALL) |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
50 y1 = y2 = 4; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
51 x1 = x2 = y2; |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
52 } |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
53 return border; |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
54 } |
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
55 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
56 override wdim layoutSpacing () { |
109
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
57 return 5; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
58 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
59 |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
60 |
80
ea58f277f487
Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
58
diff
changeset
|
61 //FIXME - make these do something |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
100
diff
changeset
|
62 // They should restrict the drawing of floating widgets to the floating area, for instance, |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
100
diff
changeset
|
63 // although this isn't strictly necessary. |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
64 override void restrict (wdim x, wdim y, wdim w, wdim h) {} |
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
65 override void relax () {} |
80
ea58f277f487
Gui reorganization and changes; partial implementation of floating widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
58
diff
changeset
|
66 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
67 override void drawWindow (Border* border, wdim x, wdim y, wdim w, wdim h) { |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
68 glColor3f (0f, 0f, .8f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
69 glRecti(x, y+h, x+w, y); |
38
8c4c96f04e7f
Windows can now be resized!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
37
diff
changeset
|
70 |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
71 if (border.capability != 0) { |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
100
diff
changeset
|
72 glColor3f (0f, 0f, .6f); |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
73 glBegin (GL_TRIANGLES); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
74 wdim t = border.x1 + border.y1; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
75 glVertex2i (x, y); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
76 glVertex2i (x+t, y); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
77 glVertex2i (x, y+t); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
78 |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
79 t = border.x2 + border.y1; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
80 glVertex2i (x+w, y); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
81 glVertex2i (x+w, y+t); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
82 glVertex2i (x+w-t, y); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
83 |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
84 t = border.x2 + border.y2; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
85 glVertex2i (x+w, y+h); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
86 glVertex2i (x+w-t, y+h); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
87 glVertex2i (x+w, y+h-t); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
88 |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
89 t = border.x1 + border.y2; |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
90 glVertex2i (x, y+h); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
91 glVertex2i (x, y+h-t); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
92 glVertex2i (x+t, y+h); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
93 glEnd (); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
94 } |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
95 |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
96 glColor3f (0f, 0f, 0f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
97 glRecti(x+border.x1, y+h-border.y2, x+w-border.x2, y+border.y1); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
98 } |
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
99 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
100 override void drawSpacers (wdabs x, wdabs y, wdsize w, wdsize h, wdims cols, wdims rows) { |
109
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
101 glColor3f (.2f, .2f, .2f); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
102 glBegin (GL_LINES); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
103 wdabs t = x - cast(wdim) 3; |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
104 foreach (col; cols) { |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
105 glVertex2i (t + col, y); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
106 glVertex2i (t + col, y + h); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
107 } |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
108 t = y - cast(wdim) 3; |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
109 foreach (row; rows) { |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
110 glVertex2i (x, t + row); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
111 glVertex2i (x + w, t + row); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
112 } |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
113 glEnd (); |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
114 } |
2a1428ec5344
Optional, visible spacing in grid layouts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
108
diff
changeset
|
115 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
116 override void drawWidgetBack (wdim x, wdim y, wdim w, wdim h) { |
91
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
80
diff
changeset
|
117 debug { |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
118 glColor3f (0f, .2f, .2f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
119 glRecti (x,y+h, x+w,y); |
91
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
80
diff
changeset
|
120 } |
4d5d53e4f881
Shared alignment for dynamic content lists - finally implemented! Lots of smaller changes too.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
80
diff
changeset
|
121 } |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
122 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
123 override void drawBlank (wdim x, wdim y, wdim w, wdim h) { |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
124 glColor3f (.4f, .4f, .4f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
125 glRecti(x, y+h, x+w, y); |
43
1530d9c04d4d
Column/row resizing implemented for GridLayoutWidget (finally)!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
41
diff
changeset
|
126 } |
1530d9c04d4d
Column/row resizing implemented for GridLayoutWidget (finally)!
Diggory Hardy <diggory.hardy@gmail.com>
parents:
41
diff
changeset
|
127 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
128 override void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed) { |
37
052df9b2fe07
Allowed widget resizing, changed widget IDs and made Input catch any callback exceptions.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
129 if (pushed) |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
130 glColor3f (1f, 0f, 1f); |
37
052df9b2fe07
Allowed widget resizing, changed widget IDs and made Input catch any callback exceptions.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
32
diff
changeset
|
131 else |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
132 glColor3f (.6f, 0f, .6f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
133 glRecti(x, y+h, x+w, y); |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
134 } |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
135 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
136 override wdimPair getToggleSize () { |
95
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
137 wdimPair r; |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
138 r.x = 16; |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
139 r.y = 16; |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
140 return r; |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
141 } |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
142 override void drawToggle (wdim x, wdim y, bool state, bool pushed) { |
95
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
143 float c = pushed ? .7f : .5f; |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
144 if (state) |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
145 glColor3f (0f, c, 0f); |
95
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
146 else |
97
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
147 glColor3f (c, 0f, 0f); |
30470bc19ca4
Floating widgets now work nicely: customizable borders added, resizing, moving.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
148 glRecti (x+2,y+14, x+14,y+2); |
95
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
149 } |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
93
diff
changeset
|
150 |
114
b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
111
diff
changeset
|
151 override TextAdapter getAdapter (int col) { |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
152 TextAdapter a; |
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
153 a.font = defaultFont; |
103
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
100
diff
changeset
|
154 a.colour_ = Colour (col); |
42e241e7be3e
ContentList content type; getting content items/lists from Options generically via content.Items, and a new addContent widget function. Several improvements to generic handling of content. New button-with-text widget.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
100
diff
changeset
|
155 a.index_ = size_t.max; |
100
0ea4a3e651ae
There is now a position marker for text editing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
99
diff
changeset
|
156 return a; |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
157 } |
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
158 |
41
b3a6ca4516b4
The renderer now controls which parts of the window border allow resizing.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
39
diff
changeset
|
159 protected: |
93
08a4ae11454b
Widgets now save dimensions without preventing structural changes in the base config file from applying.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
91
diff
changeset
|
160 FontStyle defaultFont; |
32
316b0230a849
Lots more work on the GUI. Also renamed lots of files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
161 } |