Mercurial > projects > qtd
comparison examples/opengl/hellogl/glwidget.d @ 215:8aaa84d48451
Improve examples.
author | SokoL_SD |
---|---|
date | Tue, 14 Jul 2009 15:25:45 +0000 |
parents | 71101646ab25 |
children | 1f6923c8cba0 |
comparison
equal
deleted
inserted
replaced
214:11f1760d1700 | 215:8aaa84d48451 |
---|---|
33 ** If you are unsure which license is appropriate for your use, please | 33 ** If you are unsure which license is appropriate for your use, please |
34 ** contact the sales department at qt-sales@nokia.com. | 34 ** contact the sales department at qt-sales@nokia.com. |
35 ** | 35 ** |
36 ****************************************************************************/ | 36 ****************************************************************************/ |
37 | 37 |
38 version(Tango) | 38 import std.math; |
39 import tango.math.Math; | 39 import std.conv; |
40 else | |
41 { | |
42 import std.math; | |
43 int rndint(real x) | |
44 { | |
45 return cast(int)rndtol(x); | |
46 } | |
47 } | |
48 | 40 |
49 import qt.core.QPoint; | 41 import qt.core.QPoint; |
50 import qt.gui.QMouseEvent; | 42 import qt.gui.QMouseEvent; |
51 import qt.opengl.QGLWidget; | 43 import qt.opengl.QGLWidget; |
52 import qt.gui.QColor; | 44 import qt.gui.QColor; |
53 import qt.core.QSize; | 45 import qt.core.QSize; |
54 | |
55 import qt.opengl.gl; | 46 import qt.opengl.gl; |
56 import qt.opengl.glu; | 47 import qt.opengl.glu; |
57 | 48 |
58 class GLWidget : QGLWidget | 49 class GLWidget : QGLWidget |
59 { | 50 { |
248 glVertex3d(x1, y1, +0.05); | 239 glVertex3d(x1, y1, +0.05); |
249 } | 240 } |
250 | 241 |
251 void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) | 242 void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) |
252 { | 243 { |
253 qglColor(trolltechGreen.darker(rndint(250 + (100 * x1)))); | 244 qglColor(trolltechGreen.darker(to!(int)(rndtol(250 + (100 * x1))))); |
254 | 245 |
255 glVertex3d(x1, y1, +0.05); | 246 glVertex3d(x1, y1, +0.05); |
256 glVertex3d(x2, y2, +0.05); | 247 glVertex3d(x2, y2, +0.05); |
257 glVertex3d(x2, y2, -0.05); | 248 glVertex3d(x2, y2, -0.05); |
258 glVertex3d(x1, y1, -0.05); | 249 glVertex3d(x1, y1, -0.05); |