Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could use a <code>RenderTarget</code>to achieve your goal. It sounds like you don't want to have to render accordingly to every possible screen size, so if your graphics aren't dependant on other graphical features like a mouse, then I would use a <code>RenderTarget</code> and draw all the pixel data to that and afterwards draw it to the actual screen allowing the screen to stretch it.</p> <p>This technique can be used in other ways too. I use it to draw objects in my game, so I can easily change the rotation and location without having to calculate every sprite for the object.</p> <p>Example:</p> <pre><code>void PreDraw() // You need your graphics device to render to GraphicsDevice graphicsDevice = Settings.GlobalGraphicsDevice; // You need a spritebatch to begin/end a draw call SpriteBatch spriteBatch = Settings.GlobalSpriteBatch; // Tell the graphics device where to draw too graphicsDevice.SetRenderTarget(renderTarget); // Clear the buffer with transparent so the image is transparent graphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(); flameAnimation.Draw(spriteBatch); spriteBatch.Draw(gunTextureToDraw, new Vector2(100, 0), Color.White); if (!base.CurrentPowerUpLevel.Equals(PowerUpLevels.None)) { powerUpAnimation.Draw(spriteBatch); } // DRAWS THE IMAGE TO THE RENDERTARGET spriteBatch.Draw(shipSpriteSheet, new Rectangle(105,0, (int)Size.X, (int)Size.Y), shipRectangleToDraw, Color.White); spriteBatch.End(); // Let the graphics device know you are done and return to drawing according to its dimensions graphicsDevice.SetRenderTarget(null); // utilize your render target finishedShip = renderTarget; } </code></pre> <p>Remember, in your case, you would initialize your <code>RenderTarget</code> with dimensions of 568x320 and draw according to that and not worry about any other possible sizes. Once you give the <code>RenderTarget</code> to the spritebatch to draw to the screen, it will "stretch" the image for you!</p> <p>EDIT: </p> <p>Sorry, I skimmed through the question and missed that you don't want to "stretch" your result. This could be achieved by drawing the final <code>RenderTarget</code> to your specified dimensions according to the graphics device. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload