Пример #1
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);
            }
        }
Пример #2
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.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="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);
            }
        }