Example #1
0
        /// <summary>
        /// Constructor used to create a new game engine object.
        /// </summary>
        public GameEngine(int width, int height, bool fullScreen)
            : base()
        {
            // Normally we will setup the engine to log only warnings and errors
            Log.Level = LogLevels.Warning;

            // Create a new configuration object
            Configuration = new GameConfig(this);

            // Setup the content directory to the default nibiru folder.
            ContentDirectory = "Content";

            // Create the graphics device that will be used by the engine.
            graphics = new GraphicsDeviceManager(this);

            // We require Vertex/Pixel Shaders version 2.0 or higher.
            graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
            graphics.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;

            // Setup the screen resolution and set to fullscreen.
            graphics.PreferredBackBufferWidth = width;
            graphics.PreferredBackBufferHeight = height;
            graphics.IsFullScreen = fullScreen;

            // Create the content cache used to load any resource.
            cache = new ContentCache(this);

            // Create all the manager components needed by the engine.
            scenes = new SceneManager(this);
            sounds = new SoundManager(this);
            players = new PlayerManager(this);
            models = new ModelManager(this);
            sprites = new SpriteManager(this);
            particles = new ParticleManager(this);

            // Add the base components that the engine requires to run.
            Components.Add(players);
            Components.Add(sounds);
            Components.Add(Scenes);
        }
Example #2
0
 public abstract void Unload(ContentCache cache);
Example #3
0
 public override void Unload(ContentCache cache)
 {
 }
Example #4
0
        public override void Unload(ContentCache cache)
        {
            Log.Write(this, "Removing the old scene's camera from the engine.");
            Game.Components.Remove(currentScene.Camera);

            currentScene.Unload(Game.Cache);
            currentScene = null;
        }
Example #5
0
        public override void Load(ContentCache cache)
        {
            // Now that the game has decided to load content, lets do it.
            if (currentScene != null)
            {
                currentScene.Load(Game.Cache);

                Log.Write(this, "Adding the new scene's camera to the game engine.");
                Game.Components.Add(currentScene.Camera);
            }
        }
Example #6
0
 public override void Unload(ContentCache cache)
 {
     spriteBatch = null;
 }
Example #7
0
 public override void Load(ContentCache cache)
 {
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
 }