Beispiel #1
0
        private void tmrOverlay_Tick(object sender, EventArgs e)
        {
            if (!windowFinder.ProcessFound)
            {
                this.Close();                             // attempts to close when the process isn't found, does not really work
            }
            fixPosition();

            bool refresh = false;

            // redraw if window state changed
            bool newWindowActiveState = windowFinder.IsWindowActive();

            if (newWindowActiveState != windowActive)
            {
                windowActive = newWindowActiveState;
                refresh      = true;
            }

            // redraw if key state changed
            List <PhysicalSignal>[] newGameState = owner.GetPhysicalGameState();
            if (newGameState != physicalGameState)
            {
                physicalGameState = newGameState;
                refresh           = true;
            }

            if (refresh)
            {
                this.Refresh();
            }
        }