Example #1
0
        //public

        //private
        protected override void OnEnter()
        {
            atlas = new TextureAtlas(TextureUtil.BitmapFromBytes(FileUtil.Read(atlasPath, 0)), 32, 32);

            b                  = new Button(ref atlas, atlas.GetNames()[MathUtil.FairRoundedRandom(0, atlas.GetNames().Length - 1)], atlas.GetNames()[MathUtil.FairRoundedRandom(0, atlas.GetNames().Length - 1)], atlas.GetNames()[MathUtil.FairRoundedRandom(0, atlas.GetNames().Length - 1)]);
            b.Entered         += onInteractableEntered;
            b.Exited          += onInteractableExited;
            b.Pressed         += onInteractablePressed;
            b.Released        += onInteractableReleased;
            b.ReleasedOutside += onInteractableReleasedOutside;
            AddChild(b);

            t                  = new TextBox(new Font("Times New Roman", 18.0f, FontStyle.Bold), "Hello, World!");
            t.X                = Window.Width / 2.0d - t.Width / 2.0d;
            t.Entered         += onInteractableEntered;
            t.Exited          += onInteractableExited;
            t.Pressed         += onInteractablePressed;
            t.Released        += onInteractableReleased;
            t.ReleasedOutside += onInteractableReleasedOutside;
            AddChild(t);

            sprite.X = Window.Width / 2.0d - sprite.Width / 2.0d;
            sprite.Y = Window.Height / 2.0d - sprite.Height / 2.0d;
            AddChild(sprite);
        }
Example #2
0
        //public

        //private
        protected override void OnEnter()
        {
            doorNames = doorAtlas.GetNames();

            currentDoor.ScaleX = currentDoor.ScaleY = 5.0d;
            getNewLevel();

            currentDoor.X = Window.Width / 2.0d - currentDoor.Width / 2.0d;
            currentDoor.Y = Window.Height / 4.0d - currentDoor.Height / 2.0d;
            AddChild(currentDoor);

            StringFormat sf = new StringFormat();

            sf.Alignment        = StringAlignment.Center;
            doorText.TextFormat = sf;
            AddChild(doorText);
        }