c# - IsFullScreen from my GraphicsDeviceManager doesn't work using XNA -


i'm coming make game xna, got issue. when use isfullscreen graphicsdevicemanager , put true in game contructor, game doesn't go full screen, it's staying windowed.

i looked value of isfullscreen, , while i'm in game constructor value true, when @ value in update or draw valoue false.

i tried put value true when press f, nothing changed. tried use togglefullscreen, value of isfullscreen changed nothing happening. tried set preferredbackbuffer width , height, need use applychanges , put isfullscreen false every time call it. if changes window size, it's not in full screen, not want.

here code, tell me if see anything, advice welcome.

using system; using system.collections.generic; using system.linq; using microsoft.xna.framework; using microsoft.xna.framework.audio; using microsoft.xna.framework.content; using microsoft.xna.framework.gamerservices; using microsoft.xna.framework.graphics; using microsoft.xna.framework.input; using microsoft.xna.framework.media;  namespace mygames {   /// <summary>   /// main type game   /// </summary>   public class spaceinvader : game   {     private readonly graphicsdevicemanager graphics_;     private keyboardstate oldkeyboardstate_;     private keyboardstate newkeyboardstate_;     private spritebatch spritebatch_;     private ship playership_;      public spaceinvader()     {       graphics_ = new graphicsdevicemanager(this);       content.rootdirectory = "content";       // set device frame rate 60 fps.       targetelapsedtime = timespan.fromseconds(1 / 60.0);       graphics_.preferredbackbufferwidth = 480;       graphics_.preferredbackbufferheight = 268;     }      protected override void initialize()     {       playership_ = new ship(new vector2(window.clientbounds.width / 2, window.clientbounds.height - 150), new vector2(10,10));       base.initialize();     }      protected override void loadcontent()     {       // create new spritebatch, can used draw textures.       spritebatch_ = new spritebatch(graphicsdevice);       playership_.loadcontent(content);     }      protected override void unloadcontent()     {       // todo: unload non contentmanager content here     }      protected override void update(gametime gametime)     {       newkeyboardstate_ = keyboard.getstate();       // allows game exit       if (newkeyboardstate_.iskeydown(keys.escape))         exit();        // todo: add update logic here       playership_.update(window, newkeyboardstate_, oldkeyboardstate_);        base.update(gametime);     }      protected override void draw(gametime gametime)     {       if (oldkeyboardstate_.iskeydown(keys.f) && newkeyboardstate_.iskeyup(keys.f))         graphics_.togglefullscreen();       graphics_.graphicsdevice.clear(color.cornflowerblue);       //set rendering back buffer        // draw sprite.       spritebatch_.begin(spritesortmode.backtofront, blendstate.alphablend);       playership_.draw(spritebatch_);       spritebatch_.end();        base.draw(gametime);       oldkeyboardstate_ = newkeyboardstate_;     }   } } 

i'm using windows 7, , visualstudio ultimate 2012.

edit1: tried visualstudio 2010 , works perfectly.

i've noticed issue had before, in program.cs cannot use:

 using (spaceinvader game = new spaceinvader())  {    game.run();  } 

i need use instead:

spaceinvader game = new spaceinvader(); game.run(); 

i don't know if it's changing throw me exception nullreferenceexception unhandled on second brace.

edit2: read on download page of xna allows me use visualstudio 2010 not talking visualstudio 2012. , after reading these kind of pages guess normal it's not working because didn't of sort install xna.

i guess issue due vs2012.

haha. small mistake, need add: this.graphics.applychanges();. did same thing once. understand need every time want change something, there no changes until called.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -