コード例 #1
0
ファイル: EngineTest.cs プロジェクト: Pctg-x8/Altseed
        public override void Test(GraphicsDeviceType graphicsType)
        {
            Time = 0;

            Console.WriteLine("[{0}_{1}]", Title, graphicsType);

            var option = new EngineOption
            {
                IsFullScreen = false,
                GraphicsDevice = graphicsType,
            };

            var result = Engine.Initialize(Title, 640, 480, option);

            if (!result)
            {
                throw new Exception("ACEの初期化に失敗しました。");
            }

            OnStart();

            while (Engine.DoEvents())
            {
                OnUpdating();
                Engine.Update();
                OnUpdated();

                if (Time == ExitTime)
                {
                    if (!Directory.Exists(PathOfSS))
                    {
                        Directory.CreateDirectory(PathOfSS);
                    }
                    var path = string.Format("{0}/{1}_{2}.png", PathOfSS, Title, graphicsType);
                    Engine.TakeScreenshot(path);
                }
                else if (Time == ExitTime + 2)
                {
                    break;
                }

                ++Time;
            }

            OnFinish();

            Engine.Terminate();
        }
コード例 #2
0
ファイル: Engine.cs プロジェクト: Pctg-x8/Altseed
        /// <summary>
        /// 外部ウインドウにゲーム画面を表示する初期化を行う。
        /// </summary>
        /// <param name="handle1">ハンドル1</param>
        /// <param name="handle2">ハンドル2</param>
        /// <param name="width">横幅</param>
        /// <param name="height">縦幅</param>
        /// <param name="option">オプション</param>
        /// <returns>成否</returns>
        public static bool InitializeByExternalWindow(IntPtr handle1, IntPtr handle2, int width, int height, EngineOption option)
        {
            if(core != null) return false;

            if(!Particular.Helper.CheckInitialize()) return false;

            core = Particular.Helper.CreateCore();
            if (core == null) return false;

            var graphicsType = option.GraphicsDevice;
            if(graphicsType == GraphicsDeviceType.Default)
            {
                graphicsType = Particular.Helper.GetDefaultDevice();
            }

            var coreOption = new swig.CoreOption();
            coreOption.GraphicsDevice = (swig.GraphicsDeviceType)graphicsType;
            coreOption.IsFullScreen = option.IsFullScreen;
            coreOption.IsReloadingEnabled = option.IsReloadingEnabled;

            var result = core.InitializeByExternalWindow(handle1, handle2, width, height, coreOption);

            if(result)
            {
                GC.Initialize();
                SetupMembers();

                if(option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer2D)
                {
                    var scene = new Scene();
                    var layer = new Layer2D();
                    scene.AddLayer(layer);
                    ChangeScene(scene);
                }
                else if(option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer3D)
                {
                    var scene = new Scene();
                    var layer = new Layer3D();
                    scene.AddLayer(layer);
                    ChangeScene(scene);
                }

                return true;
            }
            else
            {
                core.Release();
                core = null;
                return false;
            }
        }
コード例 #3
0
        /// <summary>
        /// 外部ウインドウにゲーム画面を表示する初期化を行う。
        /// </summary>
        /// <param name="handle1">ハンドル1</param>
        /// <param name="handle2">ハンドル2</param>
        /// <param name="width">横幅</param>
        /// <param name="height">縦幅</param>
        /// <param name="option">オプション</param>
        /// <returns>成否</returns>
        public static bool InitializeByExternalWindow(IntPtr handle1, IntPtr handle2, int width, int height, EngineOption option)
        {
            if (core != null)
            {
                return(false);
            }

            if (!Particular.Helper.CheckInitialize())
            {
                return(false);
            }

            core = Particular.Helper.CreateCore();
            if (core == null)
            {
                return(false);
            }


            var graphicsType = option.GraphicsDevice;

            if (graphicsType == GraphicsDeviceType.Default)
            {
                graphicsType = Particular.Helper.GetDefaultDevice();
            }

            var coreOption = new swig.CoreOption();

            coreOption.GraphicsDevice     = (swig.GraphicsDeviceType)graphicsType;
            coreOption.IsFullScreen       = option.IsFullScreen;
            coreOption.WindowPosition     = (swig.WindowPositionType)option.WindowPosition;
            coreOption.IsWindowResizable  = option.IsWindowResizable;
            coreOption.IsReloadingEnabled = option.IsReloadingEnabled;
            coreOption.ColorSpace         = (swig.ColorSpaceType)option.ColorSpace;

            var result = core.InitializeByExternalWindow(handle1, handle2, width, height, coreOption);

            if (result)
            {
                GC.Initialize();
                SetupMembers();

                if (option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer2D)
                {
                    var scene = new Scene();
                    var layer = new Layer2D();
                    scene.AddLayer(layer);
                    ChangeScene(scene, true);
                }
                else if (option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer3D)
                {
                    var scene = new Scene();
                    var layer = new Layer3D(null);
                    scene.AddLayer(layer);
                    ChangeScene(scene, true);
                }

                CommitChanges();
                transitionState.Proceed();

                return(true);
            }
            else
            {
                core.Release();
                core = null;
                return(false);
            }
        }
コード例 #4
0
ファイル: Engine.cs プロジェクト: neofuji/Altseed
        /// <summary>
        /// 初期化を行う。
        /// </summary>
        /// <param name="title">タイトル</param>
        /// <param name="width">横幅</param>
        /// <param name="height">縦幅</param>
        /// <param name="option">オプション</param>
        /// <returns>成否</returns>
        public static bool Initialize(string title, int width, int height, EngineOption option)
        {
            if (core != null)
            {
                return(false);
            }

            if (!Particular.Helper.CheckInitialize())
            {
                return(false);
            }

            core = Particular.Helper.CreateCore();
            if (core == null)
            {
                return(false);
            }

            var graphicsType = option.GraphicsDevice;

            if (graphicsType == GraphicsDeviceType.Default)
            {
                graphicsType = Particular.Helper.GetDefaultDevice();
            }

            var coreOption = new swig.CoreOption();

            coreOption.GraphicsDevice     = (swig.GraphicsDeviceType)graphicsType;
            coreOption.IsFullScreen       = option.IsFullScreen;
            coreOption.WindowPosition     = (swig.WindowPositionType)option.WindowPosition;
            coreOption.IsReloadingEnabled = option.IsReloadingEnabled;

            var result = core.Initialize(title, width, height, coreOption);

            if (result)
            {
                GC.Initialize();
                SetupMembers();

                if (option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer2D)
                {
                    var scene = new Scene();
                    var layer = new Layer2D();
                    scene.AddLayer(layer);
                    ChangeScene(scene);
                }
                else if (option.AutoGeneratedLayer == AutoGeneratedLayerType.Layer3D)
                {
                    var scene = new Scene();
                    var layer = new Layer3D();
                    scene.AddLayer(layer);
                    ChangeScene(scene);
                }

                return(true);
            }
            else
            {
                core.Release();
                core = null;
                return(false);
            }
        }