Beispiel #1
0
        public void Update()
        {
            if (TInputManager.mouseClicked())
            {
                var mousePosition = TInputManager.getMousePosition();
                for (int i = 0; i < Panels.Count; i++)
                {
                    if (Panels[i].ContainsMouse(mousePosition))
                    {
                        Panels[i].RaiseClick();
                    }
                }
            }

            var CurrPos = TInputManager.getMousePosition();
            var PrevPos = TInputManager.getPrevMousePosition();

            for (int i = 0; i < Panels.Count; i++)
            {
                var prev = Panels[i].ContainsMouse(PrevPos);
                var curr = Panels[i].ContainsMouse(CurrPos);

                if (curr && !prev)
                {
                    Panels[i].RaiseMouseEnter();
                }
                else if (!curr && prev)
                {
                    Panels[i].RaiseMouseLeave();
                }
            }
        }
Beispiel #2
0
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            gameContentManager.UpdateCurrent(gameTime);

            //must be at the end of update
            TInputManager.Update();
        }
Beispiel #3
0
        protected override void Initialize()
        {
            batch           = new SpriteBatch(graphics.GraphicsDevice);
            graphicsManager = new TGraphicsManager(batch);

            //must be before gameContentManager.initialize so that frames get valid graphics device for creating panels
            gameContentManager.AddGraphics(graphics.GraphicsDevice);

            gameContentManager.InitializeAll();
            TInputManager.Init();

            //very important for calling loadcontent
            base.Initialize();
        }