I am writing a GameObject class for monogame(sprite's position, alpha, rotation, ect...)
And I got a problem when i've started scaling images. Is there a way to scale images without losing quality?
Here is how I am rendering everything
foreach (KeyValuePair<int, GameObject> go in RenderObjects)
{
spriteBatch.Draw(go.Value.img, go.Value.getRect(), go.Value.RenderArea, Color.White * (float)go.Value.alpha, (float)go.Value.rotation, go.Value.getCenter(), SpriteEffects.None, 0f);
}
And here is what happends if you try to scale a 16x64 image to 160x640
^^^^^^^^^^^^^^^^^^
I've been messing around with monogame, and I've accidently found the solution. You just need to add some parameters to spriteBatch.Begin();
spriteBatch.Begin(... , ... ,SamplerState.PointClamp);
foreach (KeyValuePair<int, GameObject> go in RenderObjects)
{
spriteBatch.Draw(go.Value.img, go.Value.getRect(), go.Value.RenderArea, Color.White * (float)go.Value.alpha, (float)go.Value.rotation, go.Value.getCenter(), SpriteEffects.None, 0f);
}
spriteBatch.End();
There are actualy more ways to do it, but I don't quite understand how. Something to do with graphics.GraphicsDevice