コード例 #1
0
        public void update(long elapsedTicks)
        {
            if (testMapping.HasInput(MovementAction.ActionDown))
            {
                view.Center += new Position(0, 1);
            }

            if (testMapping.HasInput(MovementAction.ActionUp))
            {
                view.Center -= new Position(0, 1);
            }

            if (testMapping.HasInput(MovementAction.ActionLeft))
            {
                view.Center -= new Position(1, 0);
            }

            if (testMapping.HasInput(MovementAction.ActionRight))
            {
                view.Center += new Position(1, 0);
            }
        }
コード例 #2
0
ファイル: TestScene.cs プロジェクト: nshcat/roguelikeNET
        public void update(long elapsedTicks)
        {
            system.Update(elapsedTicks);
            system2.Update(elapsedTicks);

            if (cntr.UpdateSimple(elapsedTicks))
            {
                l.Intensity = 0.7f * ((float)rnd.NextDouble() / 2.0f) + 0.5f;
            }

            if (testMapping.HasInput(TestActions.ActionUp))
            {
                Logger.PostMessageTagged(SeverityLevel.Debug, "InputTest", "\"ActionUp\" was pressed");
            }

            if (testMapping.HasInput(TestActions.ActionDown))
            {
                Logger.PostMessageTagged(SeverityLevel.Debug, "InputTest", "\"ActionDown\" was pressed");
            }

            if (Input.HasKey(Key.Enter) && !hasSpawned)
            {
                //new MapGenerator(p => this.prog = p, new Dimensions(1500U, 1500U), new Random().Next(), outImg).Run();
                //new TestBackgroundTask(p => this.prog = p).Run();
                hasSpawned = true;
            }

            /*if(Input.hasKey(Key.K))
            *   clr = Color.Green;
            *  else clr = Color.Black;*/


            selection = 0;

            g.Begin();

            g.Style = new GuiStyle(g.Style)
            {
                ButtonStyle = new ButtonStyle()
                {
                    InvertOnSelection   = false,
                    SelectedTemplate    = "> {0}",
                    NonSelectedTemplate = "  {0}"
                }
            };
            g.Window("test", Position.Origin, new Dimensions(20, 25));

            g.Label("meow");
            g.IntegerBox("bla", 6, 3, ref x);
            g.Nest();
            g.Label("nyan");
            g.Button("test1");
            g.Unnest();
            g.Button("test2");
            if (g.IsSelected)
            {
                selection = 1;
            }

            g.Label("blab");
            g.Button("test3");
            if (g.IsSelected)
            {
                selection = 2;
            }
            g.Nest();
            g.Button("test4");
            if (g.IsSelected)
            {
                selection = 3;
            }
            g.Label("blabbb");
            g.Button("test5");
            if (g.IsSelected)
            {
                selection = 4;
            }
            g.Label("blabb");
            g.Unnest();
            g.Button("test6");
            if (g.IsSelected)
            {
                selection = 5;
            }
            g.Button("test7");
            if (g.IsSelected)
            {
                selection = 6;
            }
            g.End();
        }