diff --git a/doomsday/client/include/games.h b/doomsday/client/include/games.h index 1e72f476e5..d357728ef0 100644 --- a/doomsday/client/include/games.h +++ b/doomsday/client/include/games.h @@ -22,6 +22,7 @@ #define LIBDENG_GAMES_H #include "game.h" +#include "dd_share.h" #include #include #include diff --git a/doomsday/client/include/render/rendpoly.h b/doomsday/client/include/render/rendpoly.h index 47b1f89e1d..87024d9a1f 100644 --- a/doomsday/client/include/render/rendpoly.h +++ b/doomsday/client/include/render/rendpoly.h @@ -23,6 +23,7 @@ #define LIBDENG_RENDER_RENDPOLY_H #include "color.h" +#include "api_gl.h" #include #ifdef __cplusplus diff --git a/doomsday/client/include/ui/dd_input.h b/doomsday/client/include/ui/dd_input.h index e7b60aecae..eb1f54581c 100644 --- a/doomsday/client/include/ui/dd_input.h +++ b/doomsday/client/include/ui/dd_input.h @@ -28,6 +28,7 @@ #include #include +#include "api_event.h" #if _DEBUG # include // For the debug visual. diff --git a/doomsday/client/include/ui/window.h b/doomsday/client/include/ui/window.h index f4139f261e..55322f03ff 100644 --- a/doomsday/client/include/ui/window.h +++ b/doomsday/client/include/ui/window.h @@ -29,10 +29,7 @@ #include "dd_types.h" #include "resource/image.h" - -#ifdef __cplusplus -extern "C" { -#endif +#include "canvaswindow.h" #define WINDOW_MIN_WIDTH 320 #define WINDOW_MIN_HEIGHT 240 @@ -340,17 +337,11 @@ void Window_GLDone(Window* wnd); void* Window_NativeHandle(const Window* wnd); -#ifdef __cplusplus -} // extern "C" - -// C++ API -class QWidget; - /** * Returns the window's native widget, if one exists. */ QWidget* Window_Widget(Window* wnd); -#endif // __cplusplus +CanvasWindow *Window_CanvasWindow(Window *wnd); #endif /* LIBDENG_SYS_WINDOW_H */ diff --git a/doomsday/client/src/dd_loop.cpp b/doomsday/client/src/dd_loop.cpp index 521d5cb3b0..5d748f080e 100644 --- a/doomsday/client/src/dd_loop.cpp +++ b/doomsday/client/src/dd_loop.cpp @@ -67,8 +67,6 @@ boolean stopTime = false; // If true the time counters won't be incremented boolean tickUI = false; // If true the UI will be tick'd boolean tickFrame = true; // If false frame tickers won't be tick'd (unless netGame) -boolean drawGame = true; // If false the game viewport won't be rendered - static int gameLoopExitCode = 0; static double lastRunTicsTime; @@ -237,65 +235,10 @@ void DD_GameLoopDrawer(void) glClear(GL_COLOR_BUFFER_BIT); } - if(drawGame) - { - if(App_GameLoaded()) - { - // Interpolate the world ready for drawing view(s) of it. - if(theMap) - { - R_BeginWorldFrame(); - } - R_RenderViewPorts(); - } - else if(titleFinale == 0) - { - // Title finale is not playing. Lets do it manually. - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0, SCREENWIDTH, SCREENHEIGHT, 0, -1, 1); - - R_RenderBlankView(); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - } - - if(!(UI_IsActive() && UI_Alpha() >= 1.0)) - { - UI2_Drawer(); - - // Draw any full window game graphics. - if(App_GameLoaded() && gx.DrawWindow) - gx.DrawWindow(Window_Size(theWindow)); - } - } - - if(Con_TransitionInProgress()) - Con_DrawTransition(); - - if(drawGame) - { - // Debug information. - Net_Drawer(); - S_Drawer(); - - // Finish up any tasks that must be completed after view(s) have been drawn. - R_EndWorldFrame(); - } - - if(UI_IsActive()) - { - // Draw user interface. - UI_Drawer(); - } - - // Draw console. - Rend_Console(); + CanvasWindow *win = Window_CanvasWindow(Window_Main()); + DENG_ASSERT(win != 0); - // End any open DGL sequence. - DGL_End(); + win->root().draw(); // Finish GL drawing and swap it on to the screen. GL_DoUpdate(); diff --git a/doomsday/client/src/render/vignette.cpp b/doomsday/client/src/render/vignette.cpp index 63e2729219..37b723340c 100644 --- a/doomsday/client/src/render/vignette.cpp +++ b/doomsday/client/src/render/vignette.cpp @@ -79,7 +79,7 @@ void Vignette_Render(const RectRaw* viewRect, float fov) glBegin(GL_TRIANGLE_STRIP); for(i = 0; i <= DIVS; ++i) { - float ang = (float)(2 * PI * i) / (float)DIVS; + float ang = (float)(2 * de::PI * i) / (float)DIVS; float dx = cos(ang); float dy = sin(ang); diff --git a/doomsday/client/src/ui/busyvisual.cpp b/doomsday/client/src/ui/busyvisual.cpp index ded3ac4684..9fa80c9780 100644 --- a/doomsday/client/src/ui/busyvisual.cpp +++ b/doomsday/client/src/ui/busyvisual.cpp @@ -266,7 +266,7 @@ static void drawPositionIndicator(float x, float y, float radius, float pos, // Vertices along the edge. for(i = 0; i <= edgeCount; ++i) { - float angle = 2 * PI * pos * (i / (float)edgeCount) + PI/2; + float angle = 2 * de::PI * pos * (i / (float)edgeCount) + de::PI/2; glTexCoord2f(.5f + cos(angle)*.5f, .5f + sin(angle)*.5f); glVertex2f(x + cos(angle)*radius*1.05f, y + sin(angle)*radius*1.05f); } diff --git a/doomsday/client/src/ui/legacywidget.cpp b/doomsday/client/src/ui/legacywidget.cpp index 0da11ce7a9..f840460fa7 100644 --- a/doomsday/client/src/ui/legacywidget.cpp +++ b/doomsday/client/src/ui/legacywidget.cpp @@ -17,6 +17,19 @@ */ #include "ui/legacywidget.h" +#include "ui/dd_input.h" +#include "ui/ui_main.h" +#include "ui/ui2_main.h" +#include "ui/busyvisual.h" +#include "dd_main.h" +#include "map/gamemap.h" +#include "network/net_main.h" +#include "render/rend_list.h" +#include "render/rend_console.h" +#include "audio/s_main.h" +#include "gl/sys_opengl.h" + +boolean drawGame = true; // If false the game viewport won't be rendered using namespace de; @@ -45,6 +58,65 @@ void LegacyWidget::update() void LegacyWidget::draw() { + if(drawGame) + { + if(App_GameLoaded()) + { + // Interpolate the world ready for drawing view(s) of it. + if(theMap) + { + R_BeginWorldFrame(); + } + R_RenderViewPorts(); + } + else if(titleFinale == 0) + { + // Title finale is not playing. Lets do it manually. + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrtho(0, SCREENWIDTH, SCREENHEIGHT, 0, -1, 1); + + R_RenderBlankView(); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + } + + if(!(UI_IsActive() && UI_Alpha() >= 1.0)) + { + UI2_Drawer(); + + // Draw any full window game graphics. + if(App_GameLoaded() && gx.DrawWindow) + gx.DrawWindow(Window_Size(theWindow)); + } + } + + if(Con_TransitionInProgress()) + Con_DrawTransition(); + + if(drawGame) + { + // Debug information. + Net_Drawer(); + S_Drawer(); + + // Finish up any tasks that must be completed after view(s) have been drawn. + R_EndWorldFrame(); + } + + if(UI_IsActive()) + { + // Draw user interface. + UI_Drawer(); + } + + // Draw console. + Rend_Console(); + + // End any open DGL sequence. + DGL_End(); } bool LegacyWidget::handleEvent(Event const &/*event*/) diff --git a/doomsday/client/src/ui/window.cpp b/doomsday/client/src/ui/window.cpp index b7229ae641..67e4ca683d 100644 --- a/doomsday/client/src/ui/window.cpp +++ b/doomsday/client/src/ui/window.cpp @@ -1584,3 +1584,9 @@ QWidget* Window_Widget(Window* wnd) if(!wnd) return 0; return wnd->widget; } + +CanvasWindow *Window_CanvasWindow(Window *wnd) +{ + if(!wnd) return 0; + return wnd->widget; +}