#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Australia
    Posts
    24
    Rep Power
    0

    C# Variable Problem


    I've only just started C# programming and have already hit a snag that I don't understand, here it is:
    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace TestGame
    {
        public class Globals
        {
            public static ContentManager Content;
            public static GraphicsDeviceManager Graphics;
            public static SpriteBatch spriteBatch;
            public static GameTime gameTime;
            public static bool WindowFocused;
            public static Vector2 GameSize;
            public static RenderTarget2D BackBuffer;
        }
    }
    the namespaces/fields ContentManager, GraphicsDeviceManager, SpriteBatch, GameTime, Vector2 and RenderTarget2D have become errors for some reason. Will I have to change them? Any help is much appreciated.

    These are the errors that are occuring
    Error 10 'TestGame.Globals' does not contain a definition for 'SprteBatch' F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Game1.cs 64 18 TestGame
    Error 7 'TestGame.Globals' does not contain a definition for 'X' F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Game1.cs 30 65 TestGame
    Error 8 'TestGame.Globals' does not contain a definition for 'Y' F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Game1.cs 31 66 TestGame
    Error 4 'TestGame.Globals.GameTime' is a 'field' but is used like a 'type' F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Globals.cs 13 23 TestGame
    Error 3 'TestGame.Globals.SpriteBatch' is a 'field' but is used like a 'type' F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Globals.cs 12 23 TestGame
    Error 9 The name 'RenderTargetUsagePreserveContents' does not exist in the current context F:\Other files\Visual C# Documents\TestGame\TestGame\TestGame\Game1.cs 33 175 TestGame[/code]
    Anything I should do?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Location
    Australia
    Posts
    24
    Rep Power
    0
    DON'T RESPOND I solved my own problem

IMN logo majestic logo threadwatch logo seochat tools logo