Skip to content

Commit

Permalink
UI: Resize UI page when window is resized
Browse files Browse the repository at this point in the history
Todo: Font resizing.
  • Loading branch information
skyjake committed Mar 17, 2012
1 parent 049756b commit 003ccf3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doomsday/engine/portable/include/ui_main.h
Expand Up @@ -233,6 +233,9 @@ void UI_InitPage(ui_page_t* page, ui_object_t* objects);
/// Change and prepare the active page.
void UI_SetPage(ui_page_t* page);

/// Update active page's layout for a new window size.
void UI_UpdatePageLayout(void);

/// Directs events through the ui and current page if active.
int UI_Responder(ddevent_t* ev);

Expand Down
6 changes: 6 additions & 0 deletions doomsday/engine/portable/src/ui_main.c
Expand Up @@ -409,6 +409,12 @@ int UI_ScreenH(int relh)
return (relh / UI_HEIGHT) * UI_AvailableHeight();
}

void UI_UpdatePageLayout(void)
{
if(!uiCurrentPage) return;
UI_SetPage(uiCurrentPage);
}

void UI_SetPage(ui_page_t* page)
{
ui_object_t* ob;
Expand Down
11 changes: 10 additions & 1 deletion doomsday/engine/portable/src/window.cpp
Expand Up @@ -324,8 +324,10 @@ static boolean winManagerInited = false;
static Window mainWindow;
static boolean mainWindowInited = false;

/*
static int screenWidth, screenHeight, screenBPP;
static boolean screenIsWindow;
*/

Window* Window_Main(void)
{
Expand Down Expand Up @@ -353,6 +355,7 @@ boolean Sys_ChangeVideoMode(int width, int height, int bpp)
{
LIBDENG_ASSERT_IN_MAIN_THREAD();

#if 0
// Do we need to change it?
if(width == screenWidth && height == screenHeight && bpp == screenBPP &&
screenIsWindow == !(theWindow->flags & DDWF_FULLSCREEN))
Expand All @@ -374,6 +377,8 @@ boolean Sys_ChangeVideoMode(int width, int height, int bpp)
screenHeight = height; //info->current_h;
screenBPP = bpp; //info->vfmt->BitsPerPixel;
screenIsWindow = (theWindow->flags & DDWF_FULLSCREEN? false : true);
#endif

return true;

#if 0
Expand Down Expand Up @@ -739,11 +744,15 @@ static void windowWasResized(Canvas& canvas)

// Update viewports.
R_SetViewGrid(0, 0);
if(Con_IsBusy())
if(Con_IsBusy() || UI_IsActive())
{
// Update for busy mode.
R_UseViewPort(0);
}
if(UI_IsActive())
{
UI_UpdatePageLayout();
}
}

static Window* createWindow(ddwindowtype_t type, const char* title)
Expand Down

0 comments on commit 003ccf3

Please sign in to comment.