How to change application to fullscreen

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
thetoddfather
Posts: 338
Joined: October 1st, 2012, 9:53 pm
Location: Canada

Re: How to change application to fullscreen

Post by thetoddfather » March 28th, 2013, 6:17 pm

ForRealzZzZz wrote:
Petzold taught me well. I have been trying to do video tutorials on API but, im so anal about getting every little detail I want to say out there that i keep deleting my recordings T_T. Heres a link to my channel http://www.youtube.com/user/ThingsThatM ... ature=mhee
I worked my way through most of Programing Windows. Amazing teacher and book. Perhaps I need to go back and do it again. It's been awhile.

ForRealzZzZz
Posts: 7
Joined: March 24th, 2013, 9:10 pm

Re: How to change application to fullscreen

Post by ForRealzZzZz » March 28th, 2013, 6:33 pm

albinopapa wrote:There is a difference between Fullscreen mode and having a window take up the whole screen. Unfortunately, I haven't figured this one out either. The DirectX API is way beyond my knowledge, that is the original reason for starting these tutorials...learn 3D programming using DirectX. I am glad that c++ was taught the way it was and I hope chili finishes through to the DX stuff.
Well, the example I gave doesnt have the power to draw on the whole screen I will admit but, its a stretch and you will have to have a extra window up in the background.

GetWindowDC(hwnd) has the ability to draw outside the client area. Its return is a HDC object that can make drawing outside the window possible. In your WndProc add a case for trapping WM_NCCLIENT and you can manipulate it. At this point utilize WM_NCHITTEST to your advantage to seperate your new established client and original window. I cant remember what the LOWORD or the HIWORD of WM_NCHITTEST is but, I believe one of them might be a pointer to the structure POINT where you can obtain all mouse info.

CreateDC works the same way but, its parameters are significantly larger.

Code: Select all

HDC CreateDC(pszDriver, pszDevice, pszOutput, pData);
The psz in these means null terminating pointer.
-edit- sorry I meant pointer to null terminating string D:

Be sure to release these objects after your done drawing on them with this code

for GetWindowDC(hwnd);
ReleaseDC(hwnd, hdc);

for CreateDC(pszDriver, pszDevice, pszOutput, pData);
DeleteDC(hdc);

I love the way Chili teaches elements of DirectX but, I would also focus on the underlying code of how his framework works as well. Look into an API book on the side and watch Chilis videos they really help to understand concepts of graphic development.

P.S. I'm not downing his framework because I have seen some amazing code based off it but, focus on how to create your own framework as well it will help you more later.

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: How to change application to fullscreen

Post by Musi » March 31st, 2013, 5:49 pm

To make the window full screen you just have to change the window style to WS_POPUP and set the position to 0,0 and the width and height to match the screen.

In Windows.cpp you should see a call to CreateWindow(); where you can set the style, position etc.

Also if you want to change to full screen during runtime you can call SetWindowLong(); to change the style and SetWindowPos(); to change the position and dimensions. No message handling required.
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: How to change application to fullscreen

Post by cameron » April 2nd, 2013, 5:32 pm

Thanks Musi I will try it some time today.
Computer too slow? Consider running a VM on your toaster.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: How to change application to fullscreen

Post by cameron » April 2nd, 2013, 6:43 pm

I still cant quite get it fullscreen its now showing part of the top of the window and its also still showing the bar at bot of screen with start menu and such.
Computer too slow? Consider running a VM on your toaster.

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: How to change application to fullscreen

Post by Musi » April 3rd, 2013, 3:40 pm

Would you mined if i have a look at you're project?
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: How to change application to fullscreen

Post by cameron » April 3rd, 2013, 4:56 pm

Heres my project.
Attachments
Income Wars Fixed - Copy - Copy.rar
(618.58 KiB) Downloaded 168 times
Computer too slow? Consider running a VM on your toaster.

Musi
Posts: 106
Joined: November 25th, 2012, 1:06 am

Re: How to change application to fullscreen

Post by Musi » April 3rd, 2013, 6:13 pm

Ah, a couple of problems. I see you've called AdjustWindowRect(); three times, you should only adjust the RECT once. This function increases the dimensions of the RECT to allow for the windows border depending on what window style you pass it.

You've also added the styles WS_POPUP and WS_OVERLAPPEDWINDOW together. You should only use one or the other. WS_POPUP is a window with nothing but the client area, no border, no buttons etc.

Since WS_POPUP has no border you don't really need to make a RECT object or call AdjustWindowRect();, you can just give it the exact dimensions you want.

Finally, instead of hard coding the screens width and height, a good way to get them is call GetSystemMetrics(); and it will return the size for you.

So the code should look something like this.

Code: Select all

     int width  = GetSystemMetrics( SM_CXSCREEN );
     int height = GetSystemMetrics( SM_CYSCREEN );
     HWND hWnd = CreateWindowW( L"Chili DirectX Framework Window",L"Chili DirectX Framework", WS_POPUP,
                                 0, 0, width, height, NULL,NULL,wc.hInstance,NULL );
Musi

There are 10 types of people that understand binary.
Those that do, and those that don't.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: How to change application to fullscreen

Post by albinopapa » April 16th, 2013, 10:40 pm

If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply