Programming 2D Games

The official forum for "Programming 2D Games" the book by: Charles Kelly

It is currently Fri Feb 28, 2020 8:42 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: DirectX FullScreen Demo!
PostPosted: Fri Jan 17, 2014 6:06 pm 
Offline
User avatar

Joined: Mon Oct 14, 2013 8:33 am
Posts: 39
Location: Burnham On Sea, Somerset, United Kingdom
Hi Prof a really dumb question, just going through the book and reached the end of the FullScreen Window code, So in Constants.h we defined

Code:
const bool FULLSCREEN = false; // windowed or fullscreen


how could I edit this to switch between full screen mode and windowed mode??

I guess i would have to add a key press in winmain.cpp to switch the bool between true or false??

Do you have an example of how this can be accomplished :)

Thanks in advance.

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2014 9:32 pm 
Offline
User avatar

Joined: Wed Oct 30, 2013 11:46 pm
Posts: 30
of course :)

You could also do it in game.
I would personally do it in class::Game as it's the place where everything should be in terms of "behaviour".
First change it from constant to variable

then in game you go:

Code:
if (KeyDownPressed) { if (fullScreen == false) { fullScreen = true;}
                               else if (fullScreen == true) { fullScreen = false;} }



Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2014 9:50 pm 
Offline
User avatar

Joined: Mon Oct 14, 2013 8:33 am
Posts: 39
Location: Burnham On Sea, Somerset, United Kingdom
Cla wrote:
of course :)

You could also do it in game.
I would personally do it in class::Game as it's the place where everything should be in terms of "behaviour".
First change it from constant to variable

then in game you go:

Code:
if (KeyDownPressed) { if (fullScreen == false) { fullScreen = true;}
                               else if (fullScreen == true) { fullScreen = false;} }



Thanks prof your a legend, and yes I was just reading that in your game engine part 1 that you move the message handling from win main, so I will try your above method thanks again, best book I ever bought, and most helpful forums I have ever been on!

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 18, 2014 11:11 am 
Offline
User avatar

Joined: Mon Oct 14, 2013 8:33 am
Posts: 39
Location: Burnham On Sea, Somerset, United Kingdom
Cla wrote:
of course :)

You could also do it in game.
I would personally do it in class::Game as it's the place where everything should be in terms of "behaviour".
First change it from constant to variable

then in game you go:

Code:
if (KeyDownPressed) { if (fullScreen == false) { fullScreen = true;}
                               else if (fullScreen == true) { fullScreen = false;} }



haha i just realized you replied to that cla, don't know what possessed me to reply to the prof! whoops my bad haha

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 18, 2014 6:25 pm 
Offline
User avatar

Joined: Wed Oct 30, 2013 11:46 pm
Posts: 30
:lol: lol


Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 19, 2014 2:14 pm 
Offline
User avatar

Joined: Mon Oct 14, 2013 8:33 am
Posts: 39
Location: Burnham On Sea, Somerset, United Kingdom
Ahhh i also found in the later examples the prof has added the toggle functionality anyway using the Alt + Tab keys :)

_________________
Image


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2014 9:53 pm 
Offline
Site Admin
User avatar

Joined: Sat Jan 28, 2012 4:36 pm
Posts: 554
Glad to be of help...err, get credit for helping anyway. :ugeek:

_________________
Professor Kelly


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2014 9:58 pm 
Offline
User avatar

Joined: Mon Oct 14, 2013 8:33 am
Posts: 39
Location: Burnham On Sea, Somerset, United Kingdom
profkelly wrote:
Glad to be of help...err, get credit for helping anyway. :ugeek:


Haha yea not sure what happened there prof had the deep thought code brain on lol

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group