From 91cb54015437f9087f6679288295c8604a21228b Mon Sep 17 00:00:00 2001 From: scuri Date: Mon, 21 Jun 2010 23:52:19 +0000 Subject: *** empty log message *** --- test/simple/iupmain.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'test/simple/iupmain.c') 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 +#include + #include #include #include @@ -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(); -- cgit v1.2.3