예제 #1
0
        public override void Draw(SpriteBatch batch)
        {
            game.Window.Title = string.Format("{0} - Sh.Framework", ScreenManager.Instance.currentscreen);

            batch.Draw(pixel, new Rectangle(0, 0, 160, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.DarkGray);

            int i = 0;

            newState = Mouse.GetState();

            foreach (testcase t in testcases)
            {
                Vector2 position = new Vector2(4, 55 * i + 45 + scrollmanager.offset.Y);
                buttonsize = new Rectangle((int)position.X, (int)position.Y, 150, 50);
                batch.Draw(pixel, buttonsize, Color.DarkSlateGray);

                batch.DrawString(font, t.testcasename ?? "<not specified>", new Vector2(buttonsize.X, buttonsize.Y), Color.White);

                if (MouseTouching.RectWithIn(buttonsize) && MouseStroke.LeftButtonDown(oldState, newState))
                {
                    ScreenManager.Instance.currentscreen = t;
                    ScreenManager.Instance.reloadscreen();
                }

                i++;
            }

            oldState = newState;

            scrollmanager.Update();

            base.Draw(batch);
        }
예제 #2
0
        public override void Update()
        {
            base.Update();

            Head.Update();

            newState = Mouse.GetState();

            focused = Head.pressed;

            if (!Head.hovering)
            {
                if (MouseStroke.LeftButtonDown(oldState, newState))
                {
                    foreach (Button b in entries)
                    {
                        if (b.pressed)
                        {
                            Selection = b.label;
                            b.pressed = false;
                        }
                    }
                    Head.pressed = false;
                }
            }

            oldState = newState;

            foreach (Button b in entries)
            {
                b.Update();

                if (b.pressed)
                {
                    Selection = b.label;
                    b.pressed = false;
                }
            }
        }