summaryrefslogtreecommitdiff
path: root/test/simple/iupmain.c
diff options
context:
space:
mode:
authorscuri <scuri>2010-06-21 23:52:19 +0000
committerscuri <scuri>2010-06-21 23:52:19 +0000
commit91cb54015437f9087f6679288295c8604a21228b (patch)
tree86d8fa0bda3cdb432bb7531c18e5d33c8fdda56f /test/simple/iupmain.c
parent37a92b86d13e89d0dcec92be6d23ceced29dbc36 (diff)
*** empty log message ***
Diffstat (limited to 'test/simple/iupmain.c')
-rw-r--r--test/simple/iupmain.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/test/simple/iupmain.c b/test/simple/iupmain.c
index f417925..df081e3 100644
--- a/test/simple/iupmain.c
+++ b/test/simple/iupmain.c
@@ -1,4 +1,6 @@
#include <stdlib.h>
+#include <stdio.h>
+
#include <iup.h>
#include <iupgl.h>
#include <cd.h>
@@ -28,6 +30,28 @@ glu32
cdgl
ftgl
*/
+void SimpleUpdateSize(cdCanvas* cnv)
+{
+ Ihandle* canvas = IupGetHandle("SimpleCanvas");
+ int w = IupGetInt(canvas, "RASTERSIZE");
+ int h = IupGetInt2(canvas, "RASTERSIZE");
+ IupGLMakeCurrent(canvas);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, w, 0, h);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+
+ if (cnv)
+ {
+ char StrData[100];
+ sprintf(StrData, "%dx%d", w, h); /* no need to update resolution */
+ cdCanvasSetAttribute(cnv, "SIZE", StrData);
+ }
+}
+
int main(int argc, char** argv)
{
@@ -112,19 +136,8 @@ int main(int argc, char** argv)
SimpleDrawWindow();
#ifdef USE_OPENGL
- {
- Ihandle* canvas = IupGetHandle("SimpleCanvas");
- int w = IupGetInt(canvas, "RASTERSIZE");
- int h = IupGetInt2(canvas, "RASTERSIZE");
- IupGLMakeCurrent(canvas);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluOrtho2D(0, w, 0, h);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
+ SimpleUpdateSize(NULL);
+ IupUpdate(IupGetHandle("SimpleCanvas"));
#endif
IupMainLoop();