Hello. I already created my menu with the following code, but it looks to simple, I would like the text to be more well designed, I dont know, maybe shadow or something else.
Can you point me to the right direction please?
#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
#endregion
namespace MayoFighter
{
public class menu
{
private static int MAX = 20;
private int menuItemCount;
private int curMenuItem;
private string[ menuItems;
private Vector2[ pos;
private double[ scale;
private Color unselected;
private Color selected;
private SpriteFont font;
public menu(Color unslectedColor, Color selectedColor, SpriteFont sp)
{
font = sp;
menuItems = new string[MAX];
pos = new Vector2[MAX];
scale = new double[MAX];
unselected = unslectedColor;
selected = selectedColor;
menuItemCount = 0;
curMenuItem = 0;
}
public void addMenuItem(string name, Vector2 p)
{
if (menuItemCount < MAX)
{
menuItems[menuItemCount] = name;
scale[menuItemCount] = 1.0f;
pos[menuItemCount++] = p;
}
}
public void update(GameTime gameTime)
{
for (int x = 0; x < menuItemCount; x++)
{
if (x == curMenuItem)
{
if (scale[x] < 2.0f)
{
scale[x] += 0.04 + 10.0f * gameTime.ElapsedGameTime.Seconds;
//pos[x].Y += 0.04f + 10.0f * gameTime.ElapsedGameTime.Seconds;
}
}
else if (scale[x] > 1.0f && x != curMenuItem)
{
scale[x] -= 0.04 + 10.0f * gameTime.ElapsedGameTime.Seconds;
//pos[x].Y -= 0.04f + 10.0f * gameTime.ElapsedGameTime.Seconds;
}
}
}
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Begin();
for (int x = 0; x < menuItemCount; x++)
{
if (x == curMenuItem)
{
Vector2 p = pos[x];
p.X += (float)(22 * scale[x] / 2);
p.Y -= (float)(22 * scale[x] / 2);
spriteBatch.DrawString(font,
menuItems[x],
p,
selected,
0.0f,
new Vector2(0, 0),
(float)scale[x],
SpriteEffects.None,
0);
}
else
{
Vector2 p = pos[x];
p.X -= (float)(22 * scale[x] / 2);
p.Y -= (float)(22 * scale[x] / 2);
spriteBatch.DrawString(font,
menuItems[x],
p,
unselected,
0.0f,
new Vector2(0, 0),
(float)scale[x],
SpriteEffects.None,
0);
}
}
spriteBatch.End();
}
public int getSelectedNum()
{
return curMenuItem;
}
public string getSelectedName()
{
return menuItems[curMenuItem];
}
public void selectNext()
{
if (curMenuItem < menuItemCount - 1)
{
curMenuItem++;
}
else
{
curMenuItem = 0;
}
}
public void selectPrev()
{
if (curMenuItem > 0)
{
curMenuItem--;
}
else
{
curMenuItem = menuItemCount - 1;
}
}
}
}