protected override void OnStart()
		{
			selector = new ScrollingSelector<int, Control>(CreateController())
			{
				Position = new Vector2DF(320 - 200, 60),
				LineSpan = 52,
				LineWidth = 400,
				BoundLines = 4,
				IsControllerUpdated = true,
				Loop = true,
			};
			selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel);
			selector.Cursor.IsDrawn = false;

			var scene = new ReactiveScene();

			var background = new Layer2D();
			background.AddObject(new GeometryObject2D()
			{
				Shape = new RectangleShape() { DrawingArea = new RectF(0, 0, 640, 480) },
				Color = new Color(255, 255, 255, 255),
			});
			scene.AddLayer(background);

			scene.AddLayer(selector);
			Engine.ChangeScene(scene);

			for(int i = 0; i < 1; i++)
			{
				selector.AddChoice(i, new HomeItem(i));
			}

			selector.SetDebugCameraUp();
			selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10);
		}
Exemplo n.º 2
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj = new HogeObject();

            Engine.ChangeScene( scene );
            scene.AddLayer( layer );
            layer.AddObject( obj );
        }
Exemplo n.º 3
0
        public void AddLayer(asd.Layer2D layer)
        {
            _geometryObj       = new asd.GeometryObject2D();
            _geometryObj.Color = _color;
            var rect = new asd.RectangleShape();

            rect.DrawingArea   = new asd.RectF(width * _x + offsetx, height * _y + offsety, width, height);
            _geometryObj.Shape = rect;

            layer.AddObject(_geometryObj);
        }
Exemplo n.º 4
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj = new TextureObject2D();

            Engine.ChangeScene( scene );
            scene.AddLayer( layer );
            layer.AddObject( obj );

            AssertMembers( obj );
        }
        protected override void OnStart()
        {
            selector = new ScrollingSelector<int, Control>(CreateController())
            {
                Position = new Vector2DF(60, 32),
                CursorOffset = new Vector2DF(-5, 3),
                LineSpan = 36,
                LineWidth = 360,
                BoundLines = 8,
                ExtraLinesOnStarting = 1,
                ExtraLinesOnEnding = 1,
                IsControllerUpdated = true,
				Loop = true,
            };
            selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel);
            selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png");
            selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10);

            font = Engine.Graphics.CreateFont("MPlusB.aff");

            var scene = new ReactiveScene();

			var background = new Layer2D();
			background.AddObject(new GeometryObject2D()
			{
				Shape = new RectangleShape() { DrawingArea = new RectF(0, 0, 640, 480) },
				Color = new Color(255, 255, 255, 255),
			});
			background.AddObject(new TextureObject2D()
			{
				Texture = Engine.Graphics.CreateTexture2D("ListWindowLarge.png"),
				Position = new Vector2DF(30, 30),
				DrawingPriority = 1,
			});
			scene.AddLayer(background);

			scene.AddLayer(selector);
			Engine.ChangeScene(scene);

			for(int i = 0; i < 15; i++)
            {
                var obj = new TextObject2D()
                {
                    Font = font,
                    Text = $"アイテム{i}",
					Color = new Color(225, 160, 0, 255),
                };
                selector.AddChoice(i, obj);
            }

            selector.SetDebugCameraUp();
        }
Exemplo n.º 6
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj = new ObjectAddingObject();

            Engine.ChangeScene(scene);
            scene.AddLayer(layer);
            layer.AddObject(obj);

            scene.AddComponent(new ComponentAddingScene(), "Add");
            layer.AddComponent(new ComponentAddingLayer(), "Add");
            obj.AddComponent(new ComponentAddingObject(), "Add");
        }
Exemplo n.º 7
0
        private Tuple<Layer2D, MyComponent> CreateSampleLayer( float x )
        {
            var layer = new Layer2D();
            var obj = new TextureObject2D
            {
                Position = new Vector2DF( x, 240 ),
                Texture = Engine.Graphics.CreateTexture2D( CloudTexturePath ),
            };
            var component = new MyComponent();

            layer.AddObject( obj );
            layer.AddComponent( component, "Black" );

            return Tuple.Create( layer, component );
        }
Exemplo n.º 8
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();

            var obj1 = GetObject( 160 );
            var obj2 = GetObject( 480 );

            Engine.ChangeScene( scene );
            scene.AddLayer( layer );
            layer.AddObject( obj1.Item1 );
            layer.AddObject( obj2.Item1 );

            obj2.Item2.Vanish();
        }
Exemplo n.º 9
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            obj = new TextureObject2D()
            {
                Texture = Engine.Graphics.CreateTexture2D( "Data/Texture/Cloud1.png" ),
                Position = new Vector2DF( 320, 240 ),
                Angle = 5,
                CenterPosition = new Vector2DF( 128, 128 ),
            };

            layer.AddObject( obj );
            scene.AddLayer( layer );
            Engine.ChangeScene( scene );
        }
Exemplo n.º 10
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj = new MyObject( 100, 128 );
            var notDrawnObject = new MyObject( 300, 128 );
            var notUpdatedObject = new MyObject( 500, 128 );

            notDrawnObject.IsDrawn = false;
            notUpdatedObject.IsUpdated = false;

            layer.AddObject( obj );
            layer.AddObject( notDrawnObject );
            layer.AddObject( notUpdatedObject );
            scene.AddLayer( layer );
            Engine.ChangeScene( scene );
        }
Exemplo n.º 11
0
		public void Run()
		{
			while(true)
			{
				ISample selected = null;

				Engine.Initialize("サンプルブラウザ", 640, 480, new EngineOption(){ GraphicsDevice = GraphicsDeviceType.DirectX11 });

				var scene = new Scene();
				var layer = new SampleBrowserLayer(samples);
                var infoLayer = new SampleInfoLayer(layer.TotalHeight)
                {
	                DrawingPriority = 2
                };

				layer.OnScroll.Subscribe(y => infoLayer.MoveScrollBar(y));
				layer.OnSelectionChanged.Subscribe(s => infoLayer.Show(s));
				layer.OnDecide.Subscribe(s => selected = s);

				Engine.ChangeScene(scene);
				scene.AddLayer(layer);
                scene.AddLayer(infoLayer);

				var hintLayer = new Layer2D();
				hintLayer.AddObject(new TextureObject2D()
				{
					Texture = Engine.Graphics.CreateTexture2D("Data/Browser/Hint.png")
				});

				scene.AddLayer(hintLayer);

				while(Engine.DoEvents() && selected == null)
				{
					Engine.Update();
				}

				Engine.Terminate();

				if(selected == null)
				{
					break;
				}
				selected.Run();
			}
		}
Exemplo n.º 12
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer1 = new Layer2D() { Name = "Test1" };
            var layer2 = new Layer2D() { Name = "Test2" };

            var texture = Engine.Graphics.CreateTexture2D(CloudTexturePath);
            for(int i = 0; i < 100; i++)
            {
                var obj = new TextureObject2D
                {
                    Texture = texture,
                };
                layer1.AddObject(obj);
            }

            Engine.ChangeScene(scene);
            scene.AddLayer(layer1);
            scene.AddLayer(layer2);

            Console.WriteLine("Writeで負荷を掛けます");
        }
Exemplo n.º 13
0
        protected override void OnStart()
        {
            scene = new Scene();
            layer = new Layer2D();
            var notDrawnLayer = new Layer2D();
            var notUpdatedLayer = new Layer2D();
            var object1 = new MyObject( 100, 128 );
            var object2 = new MyObject( 300, 128 );
            var object3 = new MyObject( 500, 128 );

            notDrawnLayer.IsDrawn = false;
            notUpdatedLayer.IsUpdated = false;

            layer.AddObject( object1 );
            notDrawnLayer.AddObject( object2 );
            notUpdatedLayer.AddObject( object3 );
            scene.AddLayer( layer );
            scene.AddLayer( notDrawnLayer );
            scene.AddLayer( notUpdatedLayer );

            Engine.ChangeScene( scene );
        }
Exemplo n.º 14
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var child = new TextureObject2D();
            parent = new TextureObject2D();

            parent.AddChild( child, ChildMode.All );
            layer.AddObject( parent );
            layer.AddObject( child );
            scene.AddLayer( layer );
            Engine.ChangeScene( scene );

            var texture = Engine.Graphics.CreateTexture2D( CloudTexturePath );

            parent.Position = new Vector2DF( 320, 240 );
            parent.CenterPosition = new Vector2DF( 128, 128 );
            parent.Texture = texture;

            child.Position = new Vector2DF( 50, 50 );
            child.Texture = texture;
        }
Exemplo n.º 15
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;
            }
        }
Exemplo n.º 16
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);
            }
        }
Exemplo n.º 17
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer = new Layer2D();
            var obj = new TextureObject2D()
            {
                Texture = Engine.Graphics.CreateTexture2D("Data/Texture/Sample1.png"),
            };
            obj.Scale = new Vector2DF(2.0f, 2.0f);

            layer.AddObject(obj);
            layer.AddPostEffect(new PostEffect(Engine.Graphics));
            scene.AddLayer(layer);

            Engine.ChangeScene(scene);
        }
Exemplo n.º 18
0
 public void AddLayer(asd.Layer2D layer)
 {
     _valueText      = new asd.TextObject2D();
     _valueText.Font = Singleton.Font;
     layer.AddObject(_valueText);
 }
		protected override void OnStart()
		{
			Func<Object2D> cursorCreator = () => new TextureObject2D()
			{
				Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"),
				Color = new Color(0, 255, 0, 128),
			};

			selector = new ScrollingMultiSelector<int, Control>(CreateController(), cursorCreator)
			{
				Position = new asd.Vector2DF(60, 35),
				CursorOffset = new asd.Vector2DF(-5, 3),
				LineSpan = 36,
				LineWidth = 360,
				BoundLines = 9,
				ExtraLinesOnStarting = 1,
				ExtraLinesOnEnding = 0,
				IsControllerUpdated = true,
				Loop = true,
			};
			selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel, Control.Sub);
			selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png");
			selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10);

			var font = Engine.Graphics.CreateFont("MPlusB.aff");

			var scene = new ReactiveScene();

			var background = new Layer2D();
			background.AddObject(new GeometryObject2D()
			{
				Shape = new RectangleShape() { DrawingArea = new RectF(0, 0, 640, 480) },
				Color = new Color(255, 255, 255, 255),
			});
			background.AddObject(new TextureObject2D()
			{
				Texture = Engine.Graphics.CreateTexture2D("ListWindowLarge.png"),
				Position = new Vector2DF(30, 30),
				DrawingPriority = 1,
			});
			scene.AddLayer(background);

			scene.AddLayer(selector);
			Engine.ChangeScene(scene);

			for(int i = 0; i < 24; i++)
			{
				var obj = new TextObject2D()
				{
					Font = font,
					Text = $"アイテム{i}",
					Color = new Color(225, 160, 0, 255),
				};
				selector.AddChoice(i, obj);
			}

			var moveSound = Engine.Sound.CreateSoundSource("kachi38.wav", true);
			var decideSound = Engine.Sound.CreateSoundSource("pi78.wav", true);
			var cancelSound = Engine.Sound.CreateSoundSource("pi11.wav", true);

			selector.OnSelectionChanged.Subscribe(i =>
			{
				var handle = Engine.Sound.Play(moveSound);
				Engine.Sound.SetVolume(handle, 0.3f);
			});
			selector.OnDecide.Subscribe(i =>
			{
				var handle = Engine.Sound.Play(decideSound);
				Engine.Sound.SetVolume(handle, 0.3f);
			});
			selector.OnCancel.Subscribe(i => Engine.Sound.Play(cancelSound));
			selector.OnAdd.Subscribe(i => Engine.Sound.Play(decideSound));
			selector.OnRemove.Subscribe(i => Engine.Sound.Play(cancelSound));
			selector.OnDecideForMulti.Subscribe(xs =>
			{
				foreach(var x in xs.ToList())
				{
					selector.GetItemForChoice(x)?.Dispose();
					selector.RemoveChoice(x);
				}
			});

			//selector.SetDebugCameraUp();
		}
Exemplo n.º 20
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);
            }
        }