protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
            #if WINDOWS
                bool locked = false;
            #elif XBOX
                Monitor.Enter(this);
            #endif
                try
                {
            #if WINDOWS
                    Monitor.Enter(this, ref locked);
            #endif
                    _graphicsEngineService.Dispose();
                    _assetEngineService.Dispose();
                }
                finally
                {
                    _graphicsEngineService = null;
                    _assetEngineService = null;
            #if WINDOWS
                    if (locked)
                        Monitor.Exit(this);
            #elif XBOX
                    Monitor.Exit(this);
            #endif
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
#if WINDOWS
            ConsoleHelper.OpenConsole();
#endif
            _assetEngineService = new AssetEngineService(this);

            // Create storage
            _gameStorage = _assetEngineService.AssetEngine.CreateStorage(StorageName);
            Output.WriteLine(AssetMessages.StorageCreated, StorageName);

            // Create folder in storage
            _gameStorage.AddFolder(CustomAssetFolder);
            Output.WriteLine(AssetMessages.FolderCreated, CustomAssetFolder);

            /*
             * A loader must implement the IAssetLoader interface
             * When a loader is added to the engine, it is available for all storage
             * To add a new loader you have to call the AddLoader method of the AssetEngine :
             */
            _assetEngineService.AssetEngine.AddLoader(new CustomAssetLoader());
            Output.WriteLine(AssetMessages.AssetLoaderAdded, typeof(CustomAssetLoader));

            base.Initialize();
        }
Exemple #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
#if WINDOWS
            ConsoleHelper.OpenConsole();
#endif
            _assetEngineService = new AssetEngineService(this);
            _gameStorage = _assetEngineService.AssetEngine.CreateStorage(StorageName);
            Output.WriteLine(AssetMessages.StorageCreated, StorageName);

            _gameStorage.AddFolder(MeshFolder);
            Output.WriteLine(AssetMessages.FolderCreated, MeshFolder);

            base.Initialize();
        }
Exemple #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Creates a new instance of AssetEngineService
            // This instance has a reference to the AssetEngine
            // The AssetEngineService instance is automatically added to the services provider of the game
            _assetEngineService = new AssetEngineService(this);

            /*
             * You can also create directly an AssetEngine instance, but it will not be added to the services provider :
             * AssetEngine assetEngine = new AssetEngine(Services);
             * 
             * Otherwise you can create your own AssetEngine service by implementing IAssetEngineService interface
             */

            base.Initialize();
        }
Exemple #5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _assetEngineService = new AssetEngineService(this);

            // Creates a storage by calling CreateStorage method and give any name you want
            Storage storage = _assetEngineService.AssetEngine.CreateStorage("MyGameStorage");

            /* 
             * Previous example store the storage in a variable when it is created 
             * But there are other way to get it from AssetEngine :
             * 
             * Storage storage = _assetEngineService.AssetEngine["MyGameStorage"];
             * 
             * or
             * 
             * Storage storage = _assetEngineService.AssetEngine.GetStorage("MyGameStorage");
             */

            /*
             * Each storage is organized by folders, one folder represents one path in a content project
             * In one storage you can have multiple folders that target different content project
             * The following example will create folders that use the root of two different content project :
             */
            storage.AddFolder("Content");
            storage.AddFolder("OtherContent");

            /*
             * You can also go deeper with folder path, this will allow you to organize asset as you want :
             * 
             * storage.AddFolder("Content/Mesh");
             * storage.AddFolder("Content/Textures");
             * storage.AddFolder("OtherContent/Sounds");
             */

            base.Initialize();
        }
        /// <summary>
        /// Initialize the game
        /// </summary>
        protected override void Initialize()
        {
            _assetEngineService = new AssetEngineService(this);
            _graphicsEngineService = new GraphicsEngineService(this);
            _inputService = new InputService(this);

            base.Initialize();
        }