Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Scaling a sprite


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 mollekake   Members   -  Reputation: 143

Like
0Likes
Like

Posted 12 March 2013 - 07:35 AM

Hello fellas.

I want my game to have old-school graphics. and i figure the easiest way would be to create the sprites in 8-bit and scale it up.

But how do i scale it without it going all blurry?

i'm working in visual studio 2010 c#.



Sponsor:

#2 Nercury   Crossbones+   -  Reputation: 808

Like
0Likes
Like

Posted 12 March 2013 - 08:35 AM

Are you using XNA?

 

I did a quick search on google "xna texture filtering" and this seems to be your answer:

 

http://gamedev.stackexchange.com/questions/6820/how-do-i-disable-texture-filtering-for-sprite-scaling-in-xna-4-0

 

You need to set the sampler state. The default for SpriteBatch is SamplerState.LinearClamp (ie: linear interpolation - the smooth/blurry one).

Choose one of the SpriteBatch.Begin calls that takes a SamplerState and pass inSamplerState.PointClamp (selects the pixel at that precice "point").



#3 mollekake   Members   -  Reputation: 143

Like
0Likes
Like

Posted 13 March 2013 - 07:14 AM

Oh, thanks! But i don't understand what i'm supposed to do with my spritebatch. I'm a bit new to this.



#4 Racoonacoon   Members   -  Reputation: 443

Like
0Likes
Like

Posted 15 March 2013 - 11:01 AM

You should be able to set the texture filter to point to get the desired result.

 

 

 

Oh, thanks! But i don't understand what i'm supposed to do with my spritebatch. I'm a bit new to this.

 

The spritebatch Begin call takes several parameters. One of these parameters a SamplerState. Pass in SamplerState.PointClamp.

 

It would look something like this:

 

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Alpha, SamplerState.PointClamp, null, null);
 
//Draw all the sprites you want to have the 'old-school' look.
 
spriteBatch.End();
 

 

I'm assuming you are working in XNA 4.0.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS