The Error specifically is ArgumentNullException on the texture of my Main_Menu_Spritebatch which is probably the result of my order that things are loading specifically in my Main_Menu_Graphics class possibly with my content manager. Thank you.
//Preprocessor Directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
//Namespace for ease of use.
namespace Xna_Menu_Cleaned_Up_2
{
//Main Menu Graphics Master Class
class Main_Menu_Graphics
{
//Global Variable Class Call.
Global_Variables_And_Initilizations Global_Variable_And_Init = new Global_Variables_And_Initilizations();
//Spritebatch
SpriteBatch Main_Menu_Spritebatch = new SpriteBatch(Global_Variables_And_Initilizations.Master_Global_Graphics_Device);
//2D Textures For Use.
Texture2D Texture_Button_Textbox;
//Graphic Positions
Vector2 Position_Button_Textbox = Vector2.Zero;
//Main Menu Load Function
public void Main_Menu_Graphics_Load()
{
//Load Graphics to Textures.
Texture_Button_Textbox = Global_Variables_And_Initilizations.Master_Global_Content_Manager.Load<Texture2D>("Main_Menu/2D_Graphics/Main_Menu_Textbox");
}
//Main Menu Graphics Function
public void Main_Menu_Graphics_Draw()
{
//Clear Screen to Teal.
Global_Variables_And_Initilizations.Master_Global_Graphics_Device.Clear(Color.Teal);
Main_Menu_Spritebatch.Begin();
Main_Menu_Spritebatch.Draw(Texture_Button_Textbox, Position_Button_Textbox, Color.White);
Main_Menu_Spritebatch.End();
}
}
}
//Preprocessor Directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
//Namespace for ease of use.
namespace Xna_Menu_Cleaned_Up_2
{
//Class for global variables and inits.
class Global_Variables_And_Initilizations
{
//Enable the main menu at all.
public static int Main_Menu_Enable = 1;
//Value for Graphics device manager for all classes.
public static GraphicsDeviceManager Master_Global_Graphics_Device_Manager;
//Value for all Content to be managed.
public static ContentManager Master_Global_Content_Manager;
//Value for all Graphics Devices.
public static GraphicsDevice Master_Global_Graphics_Device;
}
}
//Preprocessor Directives
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
//Namespace for ease of use.
namespace Xna_Menu_Cleaned_Up_2
{
//Core program class.
public class Program_Core : Microsoft.Xna.Framework.Game
{
//Graphics Device Pass
GraphicsDeviceManager Master_Graphice_Device_Manager_Passthrough;
//Program core main.
public Program_Core()
{
//Init the device and passthrough for use.
Master_Graphice_Device_Manager_Passthrough = new GraphicsDeviceManager(this);
//Points to content directory.
Content.RootDirectory = "Content";
}
//Init Method
protected override void Initialize()
{
//Define Global Content Manager
Global_Variables_And_Initilizations.Master_Global_Content_Manager = this.Content;
//Define Global Graphics Device
Global_Variables_And_Initilizations.Master_Global_Graphics_Device = GraphicsDevice;
//Define Global Graphics Device Manager
Global_Variables_And_Initilizations.Master_Global_Graphics_Device_Manager = Master_Graphice_Device_Manager_Passthrough;
//Base init call.
base.Initialize();
}
//Load Content Method
protected override void LoadContent()
{
//Define Menu Class For Use.
Main_Menu_Graphics Main_Menu_Call = new Main_Menu_Graphics();
//Main Menu Load Content Call
Main_Menu_Call.Main_Menu_Graphics_Load();
}
//Unload Content Method
protected override void UnloadContent()
{
}
//Update Method and Game Time
protected override void Update(GameTime gameTime)
{
//Update base call.
base.Update(gameTime);
}
//Draw Method and Game Time
protected override void Draw(GameTime gameTime)
{
//Define Menu Class For Use.
Main_Menu_Graphics Main_Menu_Call = new Main_Menu_Graphics();
//Main Menu Draw
Main_Menu_Call.Main_Menu_Graphics_Draw();
//Draw Base call.
base.Draw(gameTime);
}
}
}

New Topic/Question
Reply


MultiQuote



|