Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate Rounded Rectangle Texture2D
    primarykey
    data
    text
    <p>I am building a game with dialog boxes, and I would like to be able to procedurally generate textures for the boxes, in a very similar style to that of the Final Fantasy Series (think like <a href="http://i79.photobucket.com/albums/j148/Xngears/Final%20Fantasy/FFVII%20Retranslated/ff72009-03-1900-26-46-30.jpg" rel="nofollow noreferrer">Final Fantasy VII</a>). Here is a code snippet of what I have so far:</p> <pre><code>public class DialogBox { public Rectangle BoxArea { get; set; } public List&lt;Color&gt; BoxColors { get; set; } public List&lt;Color&gt; BorderColors { get; set; } public int BorderThickness { get; set; } public int BorderRadius { get; set; } private Texture2D texture; public void CreateBackdrop(ref GraphicsDevice graphics) { texture = new Texture2D(graphics, BoxArea.Width, BoxArea.Height, true, SurfaceFormat.Color); Color[] color = new Color[texture.Width * texture.Height]; for(int x = 0; x &lt; texture.Width; x++) { for(int y = 0; y &lt; texture.Height; y++) { switch(BoxColors.Count) { case 4: Color leftColor = Color.Lerp(BoxColor[0], BoxColor[1], (y / (texture.Height - 1))); Color rightColor = Color.Lerp(BoxColor[2], BoxColor[3], (y / (texture.Height - 1))); color[x + y * texture.Width] = Color.Lerp(leftColor, RightColor, (x / (texture.Width - 1))); break; case 2: color[x + y * texture.Width] = Color.Lerp(BoxColors[0], BoxColors[1], (x / (texture.Width - 1))); break; default: color[x + y * texture.Width]; break; } } } texture.SetData&lt;Color&gt;(color); } } </code></pre> <p>What I am looking for is the following:</p> <ul> <li>4-way gradient color (implemented)</li> <li>Rounded Rectangle</li> <li>Border with gradient</li> </ul> <p>Any help would be greatly appreciated.</p> <p>I figured out the rectangle via <a href="https://stackoverflow.com/questions/2792694/draw-rectangle-with-xna">this question</a>.</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.
 

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