5 Replies - 418 Views - Last Post: 04 January 2012 - 01:51 PM

#1 TheCompBoy  Icon User is offline

  • D.I.C Regular

Reputation: 11
  • View blog
  • Posts: 314
  • Joined: 21-April 11

Making resolution for all screens?

Posted 03 January 2012 - 11:23 AM

Hello people!

Im working hard on my game im making with XNA but i have some problem here..

When i go fullscreen with my game for example then the sprites are not covering the screen. I want my game to be universal, I want it too look good at any screen.

Maybe i can make somehow a way to draw my game so it always fits the screen, Or how would i do something like it.

All my sprties for my game are right now 32*32 and i can tell i worked hard with theese sprites that i have.. Realy many horus put in and try drawing, Im not good at drawing at all but i did it and im happy but is there also someway i can save the work i put into theese sprites?

Is This A Good Question/Topic? 0
  • +

Replies To: Making resolution for all screens?

#2 ShadowsEdge19  Icon User is offline

  • D.I.C Addict

Reputation: 142
  • View blog
  • Posts: 664
  • Joined: 16-January 10

Re: Making resolution for all screens?

Posted 03 January 2012 - 11:57 AM

Look at the different overrides for the spritebatch.draw() method, several of them allow you to use a floating point Scale value to draw the sprite a specific percentage of it's default size. Say 1.5f is 50% bigger or 0.5f is 50% smaller. Use that in conjunction with the overall screen viewport dimensions and you can create an automated scaling value to use depending on the size of the user's screen dimensions.
Was This Post Helpful? 0
  • +
  • -

#3 TheCompBoy  Icon User is offline

  • D.I.C Regular

Reputation: 11
  • View blog
  • Posts: 314
  • Joined: 21-April 11

Re: Making resolution for all screens?

Posted 03 January 2012 - 12:13 PM

Oh, Thank you!
Was This Post Helpful? 0
  • +
  • -

#4 Fib  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 161
  • View blog
  • Posts: 554
  • Joined: 12-March 09

Re: Making resolution for all screens?

Posted 04 January 2012 - 07:44 AM

Instead of using the scale parameter in the SpriteBatch.Draw method, I suggest using a scaling matrix and passing that to the SpriteBatch.Begin method so it creates a universal scaling of all sprites.

You can do this:

float scaleValue = 1.5f;
Matrix globalScale = Matrix.CreateScale(scaleValue);

public void Draw(GameTime gameTime)
{
     spriteBatch.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null, globalScale);
 
     // Now all of your sprites will be scaled by your scaleValue

     spriteBatch.End();
}



I hope that helps!
Was This Post Helpful? 1
  • +
  • -

#5 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: Making resolution for all screens?

Posted 04 January 2012 - 12:19 PM

Using the transformation matrix does sound like the better approach as it would scale everything rather than having to scale each individual object. If you're going to be scaling things you may come into problems with lines around objects that are in sprite sheets. Make sure that you use SamplerState.PointClamp for the third parameter to the call to Begin.

spriteBatch.Begin(
    SpriteSortMode.FrontToBack, 
    BlendState.AlphaBlend, 
    SamplerState.PointClamp, 
    null, 
    null, 
    null, 
    globalScale);


Was This Post Helpful? 1
  • +
  • -

#6 Fib  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 161
  • View blog
  • Posts: 554
  • Joined: 12-March 09

Re: Making resolution for all screens?

Posted 04 January 2012 - 01:51 PM

Thanks for the insight Six.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1