protected override void OnStart()
		{
			scene = new Scene();
			scene.AddLayer(new Layer2D());
			Engine.ChangeScene(scene);
			RunAsync();
		}
예제 #2
0
		protected override void OnStart()
		{
			var layout = new LinearPanel()
			{
				ItemSpan = new Vector2DF(0, 36),
			};
			var selector = new Selector<int, Control>(CreateController(), layout);
			selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel);
			selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png");
			selector.IsControllerUpdated = true;

			var font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 0, 0, 255), 0, new Color(0, 0, 0, 0));

			var size = selector.Cursor.Texture.Size;

			var scroll = new ScrollLayer()
			{
				Position = new Vector2DF(30, 30),
				CameraSize = new Vector2DF(200, 200),
				BindingAreaRange = new RectF(0, 25, 200, 150),
				BoundaryStartingPosition = new Vector2DF(0, 0),
				BoundaryEndingPosition = layout.ItemSpan * 10 + new Vector2DF(200, 0),
			};
			var areaChanged = selector.OnSelectionChanged
				.Select(c => selector.GetItemForChocie(c).Position)
				.Select(p => new RectF(p.X, p.Y, size.X, size.Y));
			scroll.SubscribeSeeingArea(areaChanged);

			var scene = new Scene();
			Engine.ChangeScene(scene);
			scene.AddLayer(scroll);
			scroll.AddObject(selector);

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

			var heart1 = new TextureObject2D()
			{
				Position = scroll.BoundaryEndingPosition - new Vector2DF(50, 50),
				Texture = Engine.Graphics.CreateTexture2D("Heart.png"),
			};
			scroll.AddObject(heart1);
			var heart2 = new TextureObject2D()
			{
				Position = scroll.BoundaryStartingPosition - new Vector2DF(0, 50),
				Texture = Engine.Graphics.CreateTexture2D("Heart.png"),
			};
			scroll.AddObject(heart2);

			var viewer = new ScrollBoundViewer(scroll);
			scroll.AddObject(viewer);
		}
예제 #3
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 );
        }
예제 #4
0
        protected override void OnStart()
        {
            var scene = new Scene();
            var layer1 = CreateSampleLayer( 240 );
            var layer2 = CreateSampleLayer( 400 );

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

            layer2.Item2.Vanish();
        }
예제 #5
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 );
        }
예제 #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");
        }
예제 #7
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();
        }
예제 #8
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 );
        }
예제 #9
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 );
        }
예제 #10
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();
			}
		}
예제 #11
0
파일: Profiler.cs 프로젝트: Pctg-x8/Altseed
        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で負荷を掛けます");
        }
예제 #12
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 );
        }
예제 #13
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;
        }
		protected override void OnStart()
		{
			font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 0, 0, 255), 0, new Color(0, 0, 0, 0));

			selector = new ScrollingSelector<int, Control>(CreateController())
			{
				IsControllerUpdated = true,
				Position = new Vector2DF(30, 30),
				LineSpan = 36,
				BoundLines = 4,
				LineWidth = 360,
				ExtraLinesOnStarting = 1,
				ExtraLinesOnEnding = 1,
			};
			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);

			collection = new ObservableCollection<int>();

			for(int i = 0; i < 5; i++)
			{
				collection.Add(i);
			}

			CollectionBinderForSelector<int>.Bind(selector, collection, i => new ActivatableItem($"アイテム{i}"), true);

			for(int i = 5; i < 10; i++)
			{
				collection.Add(i);
			}

			var scene = new Scene();
			scene.AddLayer(selector);
			Engine.ChangeScene(scene);
		}
		protected override void OnStart()
		{
			obj = new ReactiveTextureObject2D()
			{
				Texture = Engine.Graphics.CreateTexture2D("Heart.png"),
			};
			seeingAreaUpdate = new Subject<RectF>();

			var scroll = new ScrollLayer()
			{
				CameraSize = new Vector2DF(640, 480),
				BoundaryStartingPosition = new Vector2DF(-180 - 320, -160 - 240),
				BoundaryEndingPosition = new Vector2DF(320 + 180, 240 + 160),
				BindingAreaRange = new RectF(0, 0, 640, 480),
			};
			scroll.SetEasingBehaviorUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 15);
			scroll.SubscribeSeeingArea(seeingAreaUpdate);
			scroll.SetScrollPosition(new RectI(-320, -240, 640, 480), GetObjectArea());

			var scene = new Scene();
			scroll.AddObject(obj);
			scene.AddLayer(scroll);
			Engine.ChangeScene(scene);

			var rand = new Random();
			for (int i = 0; i < 60; i++)
			{
				int x = rand.Next()%1000 - 180 - 320;
				int y = rand.Next()%800 - 160 - 240;
				scroll.AddObject(new TextureObject2D
				{
					Texture = Engine.Graphics.CreateTexture2D("ZKey.png"),
					Position = new Vector2DF(x, y)
				});
			}
		}
예제 #16
0
파일: Engine.cs 프로젝트: Pctg-x8/Altseed
        /// <summary>
        /// 終了処理を行う。
        /// </summary>
        public static void Terminate()
        {
            if(core == null) return;

            if(CurrentScene != null)
            {
                CurrentScene.CallDestroy();
            }

            if(nextScene != null)
            {
                nextScene.CallDestroy();
            }

            if(previousScene != null)
            {
                previousScene.CallDestroy();
            }

            CurrentScene = null;
            nextScene = null;
            previousScene = null;
            transition = null;

            GC.Terminate();

            core.Terminate();
            core.Release();
            core = null;

            Mouse = null;

            var refCount = swig.asd_core.GetGlobalReferenceCount__();

            if(refCount > 0)
            {
                Particular.Helper.ThrowUnreleasedInstanceException(refCount);
            }
        }
예제 #17
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;
            }
        }
예제 #18
0
파일: Engine.cs 프로젝트: Pctg-x8/Altseed
        /// <summary>
        /// イベントを実行し、進行可否を判断する。
        /// </summary>
        /// <returns>進行可能か?</returns>
        public static bool DoEvents()
        {
            if(core == null) return false;

            GC.Update();

            bool mes = core.DoEvents();

            if(Mouse != null)
            {
                Mouse.RefreshAllState();
            }

            if(transition != null)
            {
                if(transition.SwigObject.GetIsSceneChanged() && nextScene != null)
                {
                    if(CurrentScene != null)
                    {
                        CurrentScene.CallChanging();
                    }
                    previousScene = CurrentScene;
                    CurrentScene = nextScene;
                    core.ChangeScene(nextScene.CoreScene);
                    nextScene.Start();
                    nextScene = null;
                }

                if(transition.SwigObject.GetIsFinished())
                {
                    if(previousScene != null)
                    {
                        previousScene.CallDestroy();
                        previousScene = null;
                    }

                    transition = null;
                    CurrentScene.CallTransitionFinished();
                }
            }
            else
            {
                if(nextScene != null)
                {
                    if(CurrentScene != null)
                    {
                        CurrentScene.CallChanging();
                        CurrentScene.CallDestroy();
                    }

                    CurrentScene = nextScene;
                    core.ChangeScene(nextScene.CoreScene);
                    nextScene.Start();
                    nextScene = null;
                }

            }

            return mes;
        }
예제 #19
0
파일: Engine.cs 프로젝트: Pctg-x8/Altseed
 /// <summary>
 /// 描画する対象となるシーンを画面遷移効果ありで変更する。
 /// </summary>
 /// <param name="scene">次のシーン</param>
 /// <param name="transition">画面遷移効果</param>
 public static void ChangeSceneWithTransition(Scene scene, Transition transition)
 {
     nextScene = scene;
     Engine.transition = transition;
 }
예제 #20
0
파일: Engine.cs 프로젝트: Pctg-x8/Altseed
 /// <summary>
 /// 描画する対象となるシーンを変更する。
 /// </summary>
 /// <param name="scene">次のシーン</param>
 public static void ChangeScene(Scene scene)
 {
     nextScene = scene;
 }
예제 #21
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);
        }