Be a Supporter!

C# Xna Graphics Scaling

  • 433 Views
  • 2 Replies
New Topic Respond to this Topic
doondeka
doondeka
  • Member since: Mar. 25, 2007
  • Offline.
Forum Stats
Member
Level 20
Blank Slate
C# Xna Graphics Scaling 2013-02-01 11:55:26 Reply

Alrighty-ho. I have a problem, one that seems to be going on without much as an answer at all.
My desire is to make a 600x600 window with double-sized graphics.
What do I mean by that? Well, I mean it would sorta retro.
I want to attach Texture2D's that automatically scale up to their twice their normal scale without blurring
Anyway to go about that?

C# Xna Graphics Scaling

PandaexpressMan
PandaexpressMan
  • Member since: Apr. 10, 2011
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to C# Xna Graphics Scaling 2013-02-01 19:27:42 Reply

At 2/1/13 11:55 AM, doondeka wrote: Alrighty-ho. I have a problem, one that seems to be going on without much as an answer at all.
My desire is to make a 600x600 window with double-sized graphics.
What do I mean by that? Well, I mean it would sorta retro.
I want to attach Texture2D's that automatically scale up to their twice their normal scale without blurring
Anyway to go about that?

Hmmmmm well, For adjusting the screen height, I know there is plenty of ways to do this but I do this in the initialization method in the main class:

graphics.PreferredBackBufferWidth = width;
               graphics.PreferredBackBufferHeight = height;
               graphics.ApplyChanges();

As far as the double-sized graphics go... Well I know in the draw method when you do the spriteBatch.Draw("BLAH BLAH");
on of the overloaded methods calls for a float that would essentially be the scale at which you are drawing your textures on. Other than that I really don't know. I hope this was helpful :D

polym
polym
  • Member since: Oct. 2, 2007
  • Offline.
Forum Stats
Member
Level 14
Audiophile
Response to C# Xna Graphics Scaling 2013-02-02 14:06:55 Reply

Yeah it's common sense when you scale an image, it's going to blur. This is especially noticable in XNA if the image is too small and you try to scale it using the spritebatch function. You can try to replicate the image programmatically by looping through the image and redrawing it pixel by pixel, except expanding it, then store it in a texture variable. This would is not the same thing as resizing it in an image program so you wouldn't 'stretch' it, you're simply expanding it.


BBS Signature