Пример #1
0
        private void Init()
        {
            NativeObjectAdapter curLevel = GameEngine.GetGameLevel();

            try
            {
                // create new document by creating a Dom node of the root type defined by the schema
                DomNode   rootNode = new DomNode(m_schemaLoader.GameType, m_schemaLoader.GameRootElement);
                INameable nameable = rootNode.Cast <INameable>();
                nameable.Name = "ThumbnailGenerator";

                NativeObjectAdapter gameLevel = rootNode.Cast <NativeObjectAdapter>();
                GameEngine.CreateObject(gameLevel);
                GameEngine.SetGameLevel(gameLevel);
                gameLevel.UpdateNativeOjbect();
                NativeGameWorldAdapter gworld = rootNode.Cast <NativeGameWorldAdapter>();

                m_game = rootNode.Cast <IGame>();
                IGameObjectFolder rootFolder = m_game.RootGameObjectFolder;
                m_renderSurface          = new TextureRenderSurface(96, 96);
                m_renderState            = new RenderState();
                m_renderState.RenderFlag = GlobalRenderFlags.Solid | GlobalRenderFlags.Textured | GlobalRenderFlags.Lit | GlobalRenderFlags.Shadows;
            }
            finally
            {
                GameEngine.SetGameLevel(curLevel);
            }


            m_mainWindow.Closed += delegate
            {
                GameEngine.DestroyObject(m_game.Cast <NativeObjectAdapter>());
                m_renderSurface.Dispose();
                m_renderState.Dispose();
            };
        }
Пример #2
0
        private void Init()
        {
            NativeObjectAdapter curLevel = GameEngine.GetGameLevel();
            try
            {
                // create new document by creating a Dom node of the root type defined by the schema                 
                DomNode rootNode = new DomNode(m_schemaLoader.GameType, m_schemaLoader.GameRootElement);
                INameable nameable = rootNode.Cast<INameable>();
                nameable.Name = "ThumbnailGenerator";

                NativeObjectAdapter gameLevel = rootNode.Cast<NativeObjectAdapter>();
                GameEngine.CreateObject(gameLevel);
                GameEngine.SetGameLevel(gameLevel);
                gameLevel.UpdateNativeOjbect();
                NativeGameWorldAdapter gworld = rootNode.Cast<NativeGameWorldAdapter>();

                m_game = rootNode.Cast<IGame>();
                IGameObjectFolder rootFolder = m_game.RootGameObjectFolder;                
                m_renderSurface = new TextureRenderSurface(96, 96);
                m_renderState = new RenderState();
                m_renderState.RenderFlag = GlobalRenderFlags.Solid | GlobalRenderFlags.Textured | GlobalRenderFlags.Lit | GlobalRenderFlags.Shadows;


            }
            finally
            {
                GameEngine.SetGameLevel(curLevel);
            }


            m_mainWindow.Closed += delegate
            {
                GameEngine.DestroyObject(m_game.Cast<NativeObjectAdapter>());
                m_renderSurface.Dispose();
                m_renderState.Dispose();
            };

        }