• Advertisement
Sign in to follow this  

Unity [C++, Win32] Nasty resizing/rendering issue

This topic is 2674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello community!

I have some nasty resizing issue with my toolbar-windows of my engine's editor.
Each toolbar-window is a child of the main dialog, and they are aligned around the main viewport.
That gives me 4 windows which all render their own scene.
One for the top, one for the left, one for the bottom and one for the right.
The layout works well, and resizing them all does, too, but one thing isn't working as it should: Rendering after the resize.

Here is a picture of how it looks after I dragged the bottom-right corner of the window a bit:


Those white borders are pretty ugly and pretty annoying. How do I get rid of them?

Here is how it should look like (After some playing around with the debugger to force a redraw):


Just for sure, I do call the render-function in WM_PAINT, and also test-wise in WM_SIZE (Doesn't help, though).

Here is the first part of the DlgProc:

switch(msg)
{
case WM_SIZE:
// Resize our main windows controls
RECT r;
GetClientRect(hWnd, &r);

// Main Viewport
SetWindowPos(GetDlgItem(hWnd, IDC_Viewport),
HWND_TOP,
EE_WNDB_MainVP_LEFT,
EE_WNDB_MainVP_TOP,
(r.right - EE_WNDB_MainVP_RIGHT) - (EE_WNDB_MainVP_LEFT),
(r.bottom - EE_WNDB_MainVP_BOTTOM) - EE_WNDB_MainVP_TOP,
0);

// Right browser window
SetWindowPos(GetDlgItem(hWnd, IDC_wbrowser),
HWND_TOP,
r.right - EE_WNDB_MainVP_RIGHT,
0,
EE_WNDB_MainVP_RIGHT,
r.bottom,
0);

// left toolbar window
SetWindowPos(GetDlgItem(hWnd, IDC_SideBar1),
HWND_TOP,
0,
EE_WNDB_MainVP_TOP,
EE_WNDB_MainVP_LEFT,
r.bottom-EE_WNDB_MainVP_TOP-EE_WNDB_MainVP_BOTTOM,
0);

// upper toolbar window
SetWindowPos(GetDlgItem(hWnd, IDC_MainToolbar),
HWND_TOP,
0,
0,
r.right - EE_WNDB_MainVP_RIGHT,
EE_WNDB_MainVP_TOP,
0);

// sub toolbar window
SetWindowPos(GetDlgItem(hWnd, IDC_SubToolbar),
HWND_TOP,
0,
r.bottom - EE_WNDB_MainVP_BOTTOM,
r.right - EE_WNDB_MainVP_RIGHT,
EE_WNDB_MainVP_BOTTOM,
0);


//Set the viewport area to the toolbars and the browser
GetWindowRect(GetDlgItem(hWnd, IDC_Viewport), &r);
Engine->GetLeftToolbar()->SetMainViewportArea(&r);
Engine->GetMainToolbar()->SetMainViewportArea(&r);
Engine->GetBottomToolbar()->SetMainViewportArea(&r);
Engine->GetWBrowser()->SetMainViewportArea(&r);

//Resize swapchain
Engine->GetToSwapchainRenderer()->ResizeBuffers(0, 0);
break;
}

//Pass the messages to the registered SF_Dialog windows
Engine->GetMainEditorWindowSFContainer()->OnWindowMessage(hWnd,msg,wParam,lParam);




And this is the call inside the last line of the upper code:

case WM_PAINT:
GetD2DObjects()->bNeedsRedraw=true;
RenderScene(true);
break;
case WM_SIZE:
RECT s;
GetClientRect(WindowHW,&s);
GetD2DObjects()->WindowSize.left=s.left;
GetD2DObjects()->WindowSize.top=s.top;
GetD2DObjects()->WindowSize.right=s.right;
GetD2DObjects()->WindowSize.bottom=s.bottom;

GetD2DObjects()->RenderTarget->Resize(SizeU(s.right,s.bottom));
GetBaseObject()->SetSize(&D3DXVECTOR2(s.right,s.bottom));

RenderScene(true);
break;


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By nihitori
      The Emotional Music Vol. I pack focuses on beautiful and esoteric orchestral music, capable of creating truly emotive and intimate moods. It features detailed chamber strings, cello and piano as the main instruments, resulting in a subtle and elegant sound never before heard in video game royalty-free music assets.

      The pack includes 5 original tracks, as well as a total of 47 loops based on these tracks (long loops for simple use and short loops for custom / complex music layering).

      Unity Asset Store link: https://www.assetstore.unity3d.com/en/#!/content/107032
      Unreal Engine Marketplace link: https://www.unrealengine.com/marketplace/emotional-music-vol-i

      A 15 seconds preview of each main track is available on Soundcloud:
       
    • By RoKabium Games
      Another one of our new UI for #screenshotsaturday. This is the inventory screen for showing what animal fossils you have collected so far. #gamedev #indiedev #sama
    • By eldwin11929
      We're looking for programmers for our project.
      Our project is being made in Unity
      Requirements:
      -Skills in Unity
      -C#
      -Javascript
      -Node.js
      We're looking for programmers who can perform a variety of functions on our project.
      Project is a top-down hack-and-slash pvp dungeon-crawler like game. Game is entirely multiplayer based, using randomized dungeons, and a unique combat system with emphasis on gameplay.
      We have a GDD to work off of, and a Lead Programmer you would work under.
      Assignments may include:
      -Creating new scripts of varying degrees specific to the project (mostly server-side, but sometimes client-side)
      -Assembling already created monsters/characters with existing or non-existing code.
      -Creating VFX
      -Assembling already created environment models
      If interested, please contact: eldwin11929@yahoo.com
      This project is unpaid, but with royalties.
       
      ---
      Additional Project Info:
      Summary:
      Bassetune Reapers is a Player-verus-Player, competitive dungeon crawler. This basically takes on aspects of dungeon crawling, but with a more aggressive setting. Players will have the option to play as the "dungeon-crawlers" (called the 'Knights', or "Knight Class", in-game) or as the "dungeon" itself (literally called the 'Bosses', or "Boss Class", in-game). What this means is that players can choose to play as the people invading the dungeon, or as the dungeon-holders themselves.
      Key Features:
      -Intense, fast-paced combat
      -Multiple skills, weapons, and ways to play the game
      -Tons of different Bosses, Minibosses, creatures and traps to utilize throughout the dungeon
      -Multiple unique environments
      -Interesting, detailed lore behind both the game and world
      -Intricate RPG system
      -Ladder and ranking system
      -Lots of customization for both classes s of customization for both classes
    • By RoKabium Games
      Custom coffee mugs have arrived... More caffeine!
      Have a great weekend everyone! 
      #gamedev #indiedev #sama #caffeine
    • By Atwo Studios
       
      Hey guys,

      Anthony here from Atwo Studios bringing you some new updates for the new year!
      In this video I go over our game ROY, the new games and some general updates to the company!

      If you have not checked out ROY feel free to give it a try! Many people have said they enjoyed the game thus far!
      ROY: https://goo.gl/o6JJ5P
       
  • Advertisement