1
WME sources discussion / Re: Game Vs. Monitor Aspect Ratios
« on: October 08, 2009, 12:09:04 PM »
I thought, that only window-type objects were needed in black bars. And made some progress.
1) Changed viewport in CUIWindow::Display
2) That wasn't enough for inventory box (as well as for response box, I thought). Changed CAdInventoryBox::Display as like as CUIWindow::Display. The conditions were only modified
3) Changed viewport for mouse cursor
By the way, do you know, that mouse cursor can be moved under black bars? I think, it's someway strange to have ability to move cursor, while can't see it. Before changing CBGame::DrawCursor I tried
4) In Game object there were provided new properties RealWidth and RealHeight. Scripts were changed a little
5) Current problem is in transparency of objects in black bars region: Game.ActiveObject doesn't detect objects out of ScreenRect. For example, if Inventory.Y is equal to -Inventory.Height/2, the window has transparent upper half of itself but active lower half. I have stuck in CBRenderer::GetObjectAt method. And here I pass. I can't understand clearly how m_RectList works with: why/where/when object-candidate for ActiveObject become transparent?
6*) May back buffer size be not (m_RealWidth x m_RealHeight)? (for example, (m_Width+m_DrawOffsetX x m_Height+m_DrawOffsetY)) Would it ever possible?
1) Changed viewport in CUIWindow::Display
Code: [Select]
.
.
.
if(!m_Visible) return S_OK;
#ifdef WME_D3D9
CBRenderD3D* rend = (CBRenderD3D*)Game->m_Renderer;
D3DVIEWPORT old_vp;
if(!m_ClipByScreen)
{
rend->m_Device->GetViewport(&old_vp);
D3DVIEWPORT vp = old_vp;
vp.X = 0;
vp.Y = 0;
vp.Width = rend->m_RealWidth;
vp.Height = rend->m_RealHeight;
rend->m_Device->SetViewport(&vp);
}
#endif
.
.
.
#ifdef WME_D3D9
if(!m_ClipByScreen)
{
rend->m_Device->SetViewport(&old_vp);
}
#endif
return S_OK;
}
m_ClipByScreen is new window bool property describing of whether the current window should be clipped by screen rectangle (I mean, ScreenRect = MonitorRect - BlackBars). Default value is TRUE. Also m_ClipByScreen was provided in scripts through ScGetProperty/ScSetProperty.2) That wasn't enough for inventory box (as well as for response box, I thought). Changed CAdInventoryBox::Display as like as CUIWindow::Display. The conditions were only modified
Code: [Select]
if(m_Window)if(!m_Window->m_ClipByScreen)
3) Changed viewport for mouse cursor
Code: [Select]
HRESULT CBGame::DrawCursor(CBSprite* Cursor)
{
if(!Cursor) return E_FAIL;
if(Cursor!=m_LastCursor)
{
Cursor->Reset();
m_LastCursor = Cursor;
}
#ifdef WME_D3D9
CBRenderD3D* rend = (CBRenderD3D*)Game->m_Renderer;
D3DVIEWPORT old_vp;
rend->m_Device->GetViewport(&old_vp);
D3DVIEWPORT vp = old_vp;
vp.X = 0;
vp.Y = 0;
vp.Width = rend->m_RealWidth;
vp.Height = rend->m_RealHeight;
rend->m_Device->SetViewport(&vp);
#endif
HRESULT res = Cursor->Draw(m_MousePos.x, m_MousePos.y);
#ifdef WME_D3D9
rend->m_Device->SetViewport(&old_vp);
#endif
return res;
}
By the way, do you know, that mouse cursor can be moved under black bars? I think, it's someway strange to have ability to move cursor, while can't see it. Before changing CBGame::DrawCursor I tried
Code: [Select]
Game.LockMouseRect(0, 0, Game.ScreenWidth, Game.ScreenHeight)
but it didn't have any effect. I'm not sure, but will not be better replace last part in CBGame::GetMousePos withCode: [Select]
if(m_MouseLockRect.left != 0 || m_MouseLockRect.right != 0 || m_MouseLockRect.top != 0 || m_MouseLockRect.bottom != 0)
{
.
.
.
}
"||"-version doesn't conflict with Game.LockMouseRect() behavior, but dislike "&&"- one can take parameter 0.4) In Game object there were provided new properties RealWidth and RealHeight. Scripts were changed a little
Code: [Select]
var Inventory = Game.GetInventoryWindow();
if((Game.RealHeight-Game.ScreenHeight)/2>=Inventory.Height)
{
Inventory.ClipByScreen = FALSE;
Inventory.Y = -Inventory.Height;
Game.InventoryVisible = TRUE;
Game.LockMouseRect(0, Inventory.Y, Game.ScreenWidth, Game.ScreenHeight);
}else{
Game.AttachScript("scripts\game_loop.script");
Game.LockMouseRect(0, 0, Game.ScreenWidth, Game.ScreenHeight);
}
Of course, that's not beginner level, but not bad ability, I suppose.5) Current problem is in transparency of objects in black bars region: Game.ActiveObject doesn't detect objects out of ScreenRect. For example, if Inventory.Y is equal to -Inventory.Height/2, the window has transparent upper half of itself but active lower half. I have stuck in CBRenderer::GetObjectAt method. And here I pass. I can't understand clearly how m_RectList works with: why/where/when object-candidate for ActiveObject become transparent?
6*) May back buffer size be not (m_RealWidth x m_RealHeight)? (for example, (m_Width+m_DrawOffsetX x m_Height+m_DrawOffsetY)) Would it ever possible?