Show
Ignore:
Timestamp:
01/23/2012 07:59:32 PM (2 years ago)
Author:
acarter
Message:

Adding radio buttons, need to refactor to own class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Code/oMaE/oMaE/MiniGames/Match.cs

    r4 r5  
    1616    { 
    1717        SpriteFont font; 
    18         public Match(SpriteFont font) 
     18        // should be refactored 
     19        Texture2D[] RadioButton = new Texture2D[2]; 
     20 
     21        int[] offset = new int[]{22, 17, 0, 25, 38}; 
     22        String[] energies = new String[] { "Kinetic Energy", "Electric Energy", "Chemical Energy", "Sound Energy", "Light Energy" }; 
     23        public Match(ContentManager Content) 
    1924        { 
    20             this.font = font; 
     25            this.font = Content.Load<SpriteFont>("Fonts/Arial"); 
     26            this.RadioButton[0] = Content.Load<Texture2D>("Interface/RadioButton_Unclicked"); 
    2127        } 
    2228        public void Draw(SpriteBatch sb) 
    2329        { 
     30            Color fontColor = Color.Black; 
    2431            sb.Begin(); 
    25             sb.DrawString(font, "Testing 1, 2, 3 ...", new Vector2(20, 45), Color.White); 
     32            for (int i = 0; i < energies.Length; ++i) 
     33            { 
     34                sb.DrawString(font, energies[i], new Vector2(20 + offset[i], 40 * i + 100), fontColor); 
     35                sb.Draw(RadioButton[0], new Rectangle(165, 40 * i + 106, 10, 10), Color.White); 
     36                sb.Draw(RadioButton[0], new Rectangle(590, 40 * i + 106, 10, 10), Color.White); 
     37                sb.DrawString(font, energies[i], new Vector2(600, 40 * i + 100), fontColor); 
     38            } 
    2639            sb.End(); 
    2740        }