jalgames
jalgames

Reputation: 789

SharpDX toolkit SamplerState.PointClamp

I'm trying to create a kinda retro game using the SharpDX tookit. So as it's a retro game, the pixels should be huge, somthing like 8 x 8 screen pixels. I simply achive that by scaling up the drawing rectangle. But the sprites become blurry then. So I searched the internet and there it says that I should use SamplerState.PointClamp in the spriteBatch.Begin call. But SamplerState doesn't look like an enumeration, but more like a normal class containing only - Equals - New - ReferenceEquals Have I forgotten a using statement, is this function not implemented in SharpDX toolkit yet or what am I doing wrong?

Upvotes: 0

Views: 348

Answers (1)

xoofx
xoofx

Reputation: 3762

Use GraphicsDevice.SamplerStates.PointClamp. In SharpDX Toolkit, stock sampler states (PointClamp, LinearClamp...etc.) are instantiated after a GraphicsDevice is created, and thus they are only accessible through the GraphicsDevice instance.

XNA was probably using some kind of dirty hack/non-optimized-path to allow accessing SamplerState.PointClamp (they were also probably assuming there was only a single GraphicsDevice active)

Note that you can also create your own SamplerState with SamplerState.New.

Upvotes: 1

Related Questions