Skip to main content
gamedev.net
🔒 Locked

Full Screen Issues

Started by WebsiteWill Jan 12, 2004 at 7:20 PM 5 replies 450+ views
Original Post
WebsiteWill
WebsiteWill
I have a full screen DX app running with Direct Input. I have my cursor (currently a simple polygon) moving around the screen with the mouse. Basically I''m just adding or subtracting the relative movement to the absolute position each time through my input functions. I''m bounding my quad inside of the screen by checking if current input will place it in a legam area (0-width or 0-height). However, if I push it to any extreme corner of the screen, my polygon stops like it should but the windows pointer appears there (even though I have it turned off). If I click on the extreme top (the very last pixel) then the app minimizes because it is clicking the window behind it. Is this common and how would I go about fixing it? I''m running at 800 x 600 but the input adjusts to different resolutions and gives the same problem on all of them. Is there a way to disable the mouse from giving windows any input at all so that my app is the oNLY one to recieve input when it is running? Thanks, Webby
Dreddnafious Maelstrom
Dreddnafious Maelstrom
make sure and use the EXCLUSIVE flag when you are aquiring the device and all will be well, if that doesnt fix your problem then you are somehow loosing the focus on your app and it is giving the desktop or another app focus.

Dredd
________________________________________

"To die with your sword still in its sheath is most regrettable" -- Miyomoto Musashi


"Let Us Now Try Liberty"-- Frederick Bastiat
WebsiteWill
WebsiteWill
Checked for the EXCLUSIVITY. It''s in there
m_mouse->SetCooperativeLevel(hWnd, DISCL_BACKGROUND |
DISCL_EXCLUSIVE);

Any other ideas? I can''t find it still after 1.5 days.

If you need to see how I am doing certain parts of the code just let me know which parts you need to see. It''s a lot of code so I''m not gonna post everything.

Webby
RenderTarget
RenderTarget
Are you correctly createing a fullscreen app? Not just a big windowed app, but fullscreen parameters in the device creation code?

Also, does your window specify TOPMOST in its styles? That might be it, too.

I like pie.
[sub]My spoon is too big.[/sub]
WebsiteWill
WebsiteWill
This isn''t making much sense at all.
Still deactivating my window when I click on the extreem top
left or right corners of the screen. When the Windows cursor gets to withint one pixel of those areas, the windows pointer
becomes visible and clicking when it is visible makes my game
minimize and gives focus to whatever window was just below it.
Any ideas? All the code I think is relevant is posted below. Thanks to anyone who can help.

Webby

Mouse is set to DISCL_BACKGROUND|DISCL_EXCLUSIVE

Fullscreen present paramaters are
m_ppFullscreen.BackBufferHeight = FSHeight(); //600

m_ppFullscreen.BackBufferWidth = FSWidth(); //800

m_ppFullscreen.BackBufferFormat = D3DFMT_A8R8G8B8;
m_ppFullscreen.BackBufferCount = 1;
m_ppFullscreen.MultiSampleType = D3DMULTISAMPLE_NONE;
m_ppFullscreen.MultiSampleQuality = 0;
m_ppFullscreen.SwapEffect = D3DSWAPEFFECT_DISCARD;
m_ppFullscreen.hDeviceWindow = GethWnd();
m_ppFullscreen.Windowed = false;
m_ppFullscreen.EnableAutoDepthStencil = true;
m_ppFullscreen.AutoDepthStencilFormat = D3DFMT_D16;
m_ppFullscreen.Flags = DDPRESENTFLAG_DISCARD_DEPTHSTENCIL;
m_ppFullscreen.FullScreen_RefreshRateInHz = RefreshRate(); //85

m_ppFullscreen.PresentationInterval =
D3DPRESENT_INTERVAL_IMMEDIATE;

//Device created with

m_pD3D->CreateDevice(m_iCurrentAdapterIndex, D3DDEVTYPE_HAL,
GethWnd(), D3DCREATE_HARDWARE_VERTEXPROCESSING,
&m_ppFullscreen, &m_pd3ddCurrentDevice);


Main window created before DX takes over

m_hInst = GetModuleHandle(NULL);
m_sGameName = "Game";
m_sClassName = "Game Class";
m_sWindowCaption = "The Game";

m_iStyle = 281673728 //WS_OVERLAPPED|

//WS_MINIMIZEBOX|WS_VISIBLE|

//WS_CAPTION|WS_SYSMENU


m_iXPos = 0;
m_iYPos = 0;
m_iWidth = 800;
m_iHeight = 600;
// Set default WNDCLASSEX structure

m_wcex.cbSize = sizeof(WNDCLASSEX);
m_wcex.style = CS_CLASSDC;
m_wcex.lpfnWndProc = AppWindowProc;
m_wcex.cbClsExtra = 0;
m_wcex.cbWndExtra = 0;
m_wcex.hInstance = m_hInst;
m_wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
m_wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
m_wcex.hbrBackground = NULL;
m_wcex.lpszMenuName = NULL;
m_wcex.lpszClassName = m_sClassName.c_str();
m_wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

Reading the mouse buffered like this

switch (m_odMouse[i].dwOfs)
{
// Mouse horizontal motion

case DIMOFS_X:
if(m_absPosition.x >= 0 &&
m_absPosition.x <= GetGameWidth() &&
m_absPosition.x + m_odMouse[i].dwData >= 0 &&
m_absPosition.x + m_odMouse[i].dwData <=
GetGameWidth())
{
m_absPosition.x += m_odMouse[i].dwData;
m_relPosition.x = m_odMouse[i].dwData;
}
else
{
SetCursorPos(m_absPosition.x,m_absPosition.y);
Test to try and keep the cursor on the game screen
since I''m never letting the m_absPositions go below
0 or above GameWidth - 1 or GameHeight - 1
}
break;
// Mouse vertical motion

case DIMOFS_Y:
if(m_absPosition.y >= 0 &&
m_absPosition.y <= GetGameHeight() &&
m_absPosition.y + m_odMouse[i].dwData >= 0 &&
m_absPosition.y + m_odMouse[i].dwData <=
GetGameHeight() )
{
m_absPosition.y += m_odMouse[i].dwData;
m_relPosition.y = m_odMouse[i].dwData;
}
else
{
SetCursorPos(m_absPosition.x,m_absPosition.y);
//Test to try and keep cursor on the screen

}
break;



Endurion
Endurion
For fullscreen change your windows styles to WS_POPUP and make sure you have no borders/caption/menu. Your windows client area needs to hog the entire screen.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>
WebsiteWill
WebsiteWill
Finally found it.

I was setting up the style to WS_POPUP|WS_VISIBLE and was storing it inside a private member of my graphics class.
BUT, I was never calling SetWindowLong in my startup procedure.
I was doing it when switching screen modes and when minimizing/maximizing but never on the initial startup!.

Well, thanks all, the lead led to the right place

Webby

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.