Exemple #1
0
        public CDrawWinForm()
        {
            this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));

            _Textures = new List<STexture>();
            _Bitmaps = new List<Bitmap>();

            _Keys = new CKeys();
            _Mouse = new CMouse();
            this.ClientSize = new Size(1280, 720);

            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);

            // Create the backbuffer
            _backbuffer = new Bitmap(CSettings.iRenderW, CSettings.iRenderH);
            _g = Graphics.FromImage(_backbuffer);
            _g.Clear(Color.DarkBlue);

            this.Paint += new PaintEventHandler(this.OnPaintEvent);
            this.Closing += new CancelEventHandler(this.OnClosingEvent);
            this.KeyDown += new KeyEventHandler(this.OnKeyDownEvent);
            this.KeyPress += new KeyPressEventHandler(this.OnKeyPressEvent);
            this.KeyUp += new KeyEventHandler(this.OnKeyUpEvent);
            this.Resize += new EventHandler(this.OnResizeEvent);

            this.MouseMove += new MouseEventHandler(this.OnMouseMove);
            this.MouseDown += new MouseEventHandler(this.OnMouseDown);
            this.MouseUp += new MouseEventHandler(this.OnMouseUp);

            FlipBuffer();
            Cursor.Show();
        }
Exemple #2
0
 private void update()
 {
     CMouse.update();
     CKeyboard.update();
     mState.update();
     mCamera.update();
 }
Exemple #3
0
        public CDrawWinForm()
        {
            this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));

            _Textures = new List <STexture>();
            _Bitmaps  = new List <Bitmap>();

            _Keys           = new CKeys();
            _Mouse          = new CMouse();
            this.ClientSize = new Size(1280, 720);

            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);

            // Create the backbuffer
            _backbuffer = new Bitmap(CSettings.iRenderW, CSettings.iRenderH);
            _g          = Graphics.FromImage(_backbuffer);
            _g.Clear(Color.DarkBlue);

            this.Paint    += new PaintEventHandler(this.OnPaintEvent);
            this.Closing  += new CancelEventHandler(this.OnClosingEvent);
            this.KeyDown  += new KeyEventHandler(this.OnKeyDownEvent);
            this.KeyPress += new KeyPressEventHandler(this.OnKeyPressEvent);
            this.KeyUp    += new KeyEventHandler(this.OnKeyUpEvent);
            this.Resize   += new EventHandler(this.OnResizeEvent);

            this.MouseMove += new MouseEventHandler(this.OnMouseMove);
            this.MouseDown += new MouseEventHandler(this.OnMouseDown);
            this.MouseUp   += new MouseEventHandler(this.OnMouseUp);

            FlipBuffer();
            Cursor.Show();
        }
Exemple #4
0
    //Es como un manager de tiles
    public void update()
    {
        //Si la iteracion no pasa el maximo se repite
        for (int y = 0; y < MAP_HEIGHT; y++)
        {
            //Si la iteracion no pasa el maximo se repite
            for (int x = 0; x < MAP_WIDTH; x++)
            {
                //se update los tiles a medida que cambie
                mMap[y][x].update();
            }
        }
        int   col  = (int)(CMouse.getX() / TILE_WIDTH);
        int   row  = (int)(CMouse.getY() / TILE_HEIGHT);
        CTile tile = getTile(col, row);

        if (tile != null)
        {
            if (CMouse.firstPress())
            {
                int index = tile.getTileIndex();
                if (index == 0)
                {
                    tile.setTileIndex(1);
                    tile.setImage(mTiles[1]);
                }
                else if (index == 1)
                {
                    tile.setTileIndex(0);
                    tile.setImage(mTiles[0]);
                }
            }
        }
    }
Exemple #5
0
    void Awake()
    {
        if (mInstance != null)
        {
            throw new UnityException("Error in CGame(). You are not allowed to instantiate it more than once.");
        }

        //CGameConstants.HIGH_SCORE =int.Parse( System.IO.File.ReadAllText("score.txt"));


        mInstance = this;

        CMouse.init();
        CurrentStageData.init();
        LevelsInfo.init();
        imgBackground = new CSprite();

        //Handheld.PlayFullScreenMovie("IntroGame2.mp4", Color.black, FullScreenMovieControlMode.CancelOnInput);
        setState(new CMenuState());

        mSpriteManager = new CSpriteManager();


        //setImage("Sprites/Placeholders_Prototype/level_Background");
    }
Exemple #6
0
 private void update()
 {
     CMouse.update();
     imgBackground.update();
     mState.update();
     mSpriteManager.update();
 }
Exemple #7
0
        public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse)
        {
            bool _Run = true;

            _Cursor.CursorVisible = Mouse.Visible;

            Mouse.CopyEvents();
            Keys.CopyEvents();

            CSound.Update();
            CBackgroundMusic.Update();
            CInput.Update();

            if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
            {
                CSongs.LoadCover(30L, 1);
            }

            if (CSettings.GameState != EGameState.EditTheme)
            {
                _Run &= HandleInputs(Keys, Mouse);
                _Run &= Update();
            }
            else
            {
                _Run &= HandleInputThemeEditor(Keys, Mouse);
                _Run &= Update();
            }

            return(_Run);
        }
Exemple #8
0
 private void update()
 {
     CMouse.update();
     CKeyboard.update();
     mState.update();
     if (mState is CLevelState)
     {
         if (mState.getState() == CLevelState.FINISHED)
         {
             setState(new BattleState());
             return;
         }
     }
     else if (mState is BattleState)
     {
         if (mState.getState() == BattleState.PLAYER_WON)
         {
             //GIVE player rewards.
             BattleData.lastBattleOutcome = BattleData.BattleOutcome.WON;
             BattleData.battlesWon++;
             setState(new CLevelState());
             return;
         }
         else if (mState.getState() == BattleState.PLAYER_LOST)
         {
             //GAME OVER
             BattleData.lastBattleOutcome = BattleData.BattleOutcome.LOST;
             BattleData.battlesWon++;
             setState(new CLevelState());
             return;
         }
     }
 }
Exemple #9
0
        public CDrawWinForm()
        {
            Icon = new Icon(Path.Combine(CSettings.ProgramFolder, CSettings.FileNameIcon));

            _Keys      = new CKeys();
            _Mouse     = new CMouse();
            ClientSize = new Size(1280, 720);

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.Opaque, true);

            // Create the backbuffer
            _Backbuffer = new Bitmap(CSettings.RenderW, CSettings.RenderH);
            _G          = Graphics.FromImage(_Backbuffer);
            _G.Clear(Color.DarkBlue);

            Closing  += _OnClosingEvent;
            KeyDown  += _OnKeyDownEvent;
            KeyPress += _OnKeyPressEvent;
            KeyUp    += _OnKeyUpEvent;
            Resize   += _OnResizeEvent;

            MouseMove += _OnMouseMove;
            MouseDown += _OnMouseDown;
            MouseUp   += _OnMouseUp;

            _FlipBuffer();
            Cursor.Show();
        }
Exemple #10
0
    virtual public void update()
    {
        //Chequear por click y activar poder dependiendo del click.
        //Si se activo uno de los poderes entonces hay que empezar a correr el cooldown

        if (CMouse.firstPress(CMouse.BUTTONS.LEFT) && isActivePower && leftPowerElapsedCooldown >= leftPowerBaseCooldown)
        {
            this.leftClickPower();

            leftPowerElapsedCooldown = 0f;
        }
        else if (CMouse.firstPress(CMouse.BUTTONS.RIGHT) && isActivePower && rightPowerElapsedCooldown >= rightPowerBaseCooldown)
        {
            this.rightClickPower();

            rightPowerElapsedCooldown = 0f;
        }

        if (leftPowerElapsedCooldown < leftPowerBaseCooldown)
        {
            leftPowerElapsedCooldown += Time.deltaTime;
        }

        if (rightPowerElapsedCooldown < rightPowerBaseCooldown)
        {
            rightPowerElapsedCooldown += Time.deltaTime;
        }
    }
Exemple #11
0
    private CTile getMouseTile()
    {
        int col = (int)(CMouse.getX() / CTileMap.Instance.getTileWidth());
        int row = (int)(CMouse.getY() / CTileMap.Instance.getTileHeight());

        return(CTileMap.Instance.getTile(col, row));
    }
 public override void update()
 {
     base.update();
     if (CMouse.firstPress())
     {
         CGame.inst().setState(new CMenuState());
     }
 }
Exemple #13
0
 public void destroy()
 {
     CMouse.destroy();
     CKeyboard.destroy();
     if (mState != null)
     {
         mState.destroy();
         mState = null;
     }
     mInstance = null;
 }
Exemple #14
0
    //Comportamiento del Board en STATE_NORMAL
    public void tokenSelection()
    {
        if (CMouse.firstPress(0))
        {
            int[] mousePos = getMouseTile();
            if (mousePos[0] != -1 & secondSelect[0] == -1)
            {
                firstSelect[0] = mousePos[0];
                firstSelect[1] = mousePos[1];
                matrixBoard[firstSelect[0]][firstSelect[1]].select();
            }
        }
        if (CMouse.pressed(0))
        {
            int[] mousePos = getMouseTile();
            if (mousePos[0] != firstSelect[0] | mousePos[1] != firstSelect[1])
            {
                if (mousePos[0] == -1 & firstSelect[0] != -1)
                {
                    matrixBoard[firstSelect[0]][firstSelect[1]].deselect();
                    firstSelect[0] = -1;
                    firstSelect[1] = -1;
                }
                if (mousePos[0] != -1 & firstSelect[0] != -1)
                {
                    secondSelect[0] = mousePos[0];
                    secondSelect[1] = mousePos[1];
                    matrixBoard[secondSelect[0]][secondSelect[1]].select();

                    if (contiguousTiles(firstSelect[0], firstSelect[1], secondSelect[0], secondSelect[1]))
                    {
                        switchTokens(firstSelect[0], firstSelect[1], secondSelect[0], secondSelect[1]);
                        current_state = STATE_CHANGING;
                        matrixBoard[firstSelect[0]][firstSelect[1]].deselect();
                        matrixBoard[secondSelect[0]][secondSelect[1]].deselect();
                    }
                    else
                    {
                        matrixBoard[firstSelect[0]][firstSelect[1]].deselect();
                        matrixBoard[secondSelect[0]][secondSelect[1]].deselect();
                        firstSelect[0]  = -1;
                        firstSelect[1]  = -1;
                        secondSelect[0] = -1;
                        secondSelect[1] = -1;
                    }
                }
            }
        }
        if (CMouse.release(0) & firstSelect[0] != -1)
        {
            matrixBoard[firstSelect[0]][firstSelect[1]].deselect();
        }
    }
Exemple #15
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent   = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            bool Resume = true;

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInacive();
                    _Cursor.FadeOut();
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
                    }
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
                {
                    Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
                }
            }
            return(Resume);
        }
Exemple #16
0
 public void destroy()
 {
     CMouse.destroy();
     CurrentStageData.destroy();
     //CSpriteManager.destroy();
     if (mState != null)
     {
         mState.destroy();
         mState = null;
     }
     mInstance = null;
 }
Exemple #17
0
    override public void update()
    {
        base.update();
        CMouse.update();
        storyBtn.update();
        endlessBtn.update();
        exit.update();
        creditsBtn.update();
        if (creditsClick())
        {
            CGame.inst().setState(new CCreditsState());
        }
        if (storyClick())
        {
            SoundList.instance.playNewGame();
            storyBtn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Story_Mode_p"));
            buttonClicked = 1;

            return;
        }
        else
        if (endlessClick())
        {
            endlessBtn.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Endless_p"));
            buttonClicked = 2;

            return;
        }
        else if (exitClick())
        {
            exit.setImage(Resources.Load <Sprite>("Sprites/Buttons/Button_Exit_p"));
            buttonClicked = 3;
        }
        CSpriteManager.inst().update();
        switch (buttonClicked)
        {
        case 0:
            break;

        case 1:
            CGame.inst().setState(new CLevelState(1));
            break;

        case 2:
            CGame.inst().setState(new CKaijuSelectionState());
            break;

        case 3:
            Application.Quit();
            break;
        }
    }
Exemple #18
0
    void Awake()
    {
        if (mInstance != null)
        {
            throw new UnityException("Error in CGame(). You are not allowed to instantiate it more than once.");
        }

        mInstance = this;

        CMouse.init();
        CKeyboard.init();

        setState(new CLevelState());
    }
Exemple #19
0
    public bool clicked()
    {
        Vector3 mousePos = CMouse.getPos();

        if (CMouse.release())
        {
            if (CMath.pointInRect(mousePos.x, mousePos.y, getX() - getWidth() / 2, getY() - getHeight() / 2, getWidth(), getHeight()))
            {
                return(true);
            }
        }

        return(false);
    }
Exemple #20
0
    override protected void leftClickPower()
    {
        AireDisparo bullet = new AireDisparo();
        //La direcion de la bala
        CVector playerCenter = new CVector(player.getX() + player.getWidth() / 2, player.getY() + player.getHeight() / 2);
        float   radius       = player.getHeight() > player.getWidth() ? player.getHeight() / 2 : player.getWidth() / 2;
        float   xDiff        = CMouse.getX() - playerCenter.x;
        float   yDiff        = CMouse.getY() - playerCenter.y;
        float   angRad       = Mathf.Atan2(yDiff, xDiff);

        bullet.setRotation(CMath.radToDeg(angRad));
        // X: Centro del personaje + ancho / 2 * angulo
        bullet.setX(playerCenter.x + radius * Mathf.Cos(angRad));
        // Y: Centro del personaje + alto / 2 * angulo
        bullet.setY(playerCenter.y + radius * Mathf.Sin(angRad));
        bullet.setVelXY(AireDisparo.SPEED * Mathf.Cos(angRad), AireDisparo.SPEED * Mathf.Sin(angRad));
        bullet.setBounds(0, 0, CTileMap.Instance.getMapWidth() * CTileMap.Instance.getTileWidth(), CTileMap.Instance.getMapHeight() * CTileMap.Instance.getTileHeight());
        CBulletManager.inst().add(bullet);
    }
Exemple #21
0
    override protected void rightClickPower()
    {
        int direction = 1;



        if (CMouse.getX() <= player.getX() + player.getWidth() / 2)
        {
            direction = -1;
            player.setFlip(true);
        }
        else
        {
            player.setFlip(false);
        }

        player.setState(CAndy.STATE_DASHING);
        player.setVelX(DASH_VELOCITY * direction);
    }
Exemple #22
0
    public int[] getMouseTile()
    {
        Vector3 mousePos = CMouse.getPos();

        int[] ret = { -1, -1 };

        float minX = matrixBoard[0][0].background.getX() - matrixBoard[0][0].background.getWidth() / 2;
        float maxX = matrixBoard[0][boardWidth - 1].background.getX() + matrixBoard[0][boardWidth - 1].background.getWidth() / 2;
        float minY = matrixBoard[0][0].background.getY() - matrixBoard[0][0].background.getHeight() / 2;
        float maxY = matrixBoard[boardHeight - 1][0].background.getY() + matrixBoard[boardHeight - 1][0].background.getHeight() / 2;


        if (mousePos.x >= minX & mousePos.x <= maxX & mousePos.y >= minY & mousePos.y <= maxY)
        {
            ret[1] = (int)((mousePos.x - minX) / matrixBoard[0][0].background.getWidth());
            ret[0] = (int)((mousePos.y - minY) / matrixBoard[0][0].background.getHeight());
        }
        return(ret);
    }
    public bool nextScreenClick()
    {
        bool clicked = false;

        if (CMouse.firstPress())
        {
            float button1MinX = btnNextScreen.getX() - btnNextScreen.getWidth() / 2;
            float button1MaxX = btnNextScreen.getX() + btnNextScreen.getWidth() / 2;
            float button1MinY = btnNextScreen.getY() - btnNextScreen.getHeight() / 2;
            float button1MaxY = btnNextScreen.getY() + btnNextScreen.getHeight() / 2;
            float mouseX      = CMouse.getPos().x;
            float mouseY      = CMouse.getPos().y;
            if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY)
            {
                clicked = true;
            }
        }

        return(clicked);
    }
Exemple #24
0
    public bool exitClick()
    {
        bool clicked = false;

        if (CMouse.firstPress())
        {
            float button1MinX = exit.getX();
            float button1MaxX = exit.getX() + exit.getWidth();
            float button1MinY = exit.getY();
            float button1MaxY = exit.getY() + exit.getHeight();
            float mouseX      = CMouse.getPos().x;
            float mouseY      = CMouse.getPos().y;
            if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY)
            {
                clicked = true;
            }
        }

        return(clicked);
    }
    public bool optionsClick()
    {
        bool clicked = false;

        if (CMouse.firstPress())
        {
            float button1MinX = optionsBttn.getX() - optionsBttn.getWidth() / 2;
            float button1MaxX = optionsBttn.getX() + optionsBttn.getWidth() / 2;
            float button1MinY = optionsBttn.getY() - optionsBttn.getHeight() / 2;
            float button1MaxY = optionsBttn.getY() + optionsBttn.getHeight() / 2;
            float mouseX      = CMouse.getPos().x;
            float mouseY      = CMouse.getPos().y;
            if (mouseX >= button1MinX && mouseX <= button1MaxX && mouseY >= button1MinY && mouseY <= button1MaxY)
            {
                clicked = true;
            }
        }

        return(clicked);
    }
    private bool skill2Click()
    {
        bool clicked = false;

        if (CMouse.firstPress())
        {
            float button2MinX = button02.getX() - button02.getWidth() / 2;
            float button2MaxX = button02.getX() + button02.getWidth() / 2;
            float button2MinY = button02.getY() - button02.getHeight();
            float button2MaxY = button02.getY();
            float mouseX      = CMouse.getPos().x;
            float mouseY      = CMouse.getPos().y;
            if (mouseX >= button2MinX && mouseX <= button2MaxX && mouseY >= button2MinY && mouseY <= button2MaxY)
            {
                clicked = true;
            }
        }

        return(clicked);
    }
Exemple #27
0
    public override void update()
    {
        base.update();

        float scale = 1.0f;
        int   frame = 1;

        Vector3 mousePos = CMouse.getPos();

        mIsMouseOver = CMath.pointInRect(mousePos.x, mousePos.y, getX() - getWidth() / 2, getY() - getHeight() / 2, getWidth(), getHeight());

        if (CMouse.pressed())
        {
            if (mIsMouseOver)
            {
                scale = 0.9f;
                frame = 2;
            }
        }
        else
        {
            if (mIsMouseOver)
            {
                scale = 1.1f;
                frame = 1;
            }
            else
            {
                scale = 1.0f;
                frame = 1;
            }
        }

        setScale(scale);
        this.buttonText.setScale(scale);

        gotoAndStop(frame);

        this.buttonText.setXY(this.getX(), this.getY());
        this.buttonText.update();
    }
Exemple #28
0
        private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse)
        {
            KeyEvent   KeyEvent   = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.Normal;
                    _Screens[(int)_CurrentScreen].NextInteraction();
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        _Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent);
                    }
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (!_Fading)
                {
                    _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
            }
            return(true);
        }
Exemple #29
0
    public void update()
    {
        for (int y = 0; y < MAP_HEIGHT; y++)
        {
            for (int x = 0; x < MAP_WIDTH; x++)
            {
                mMap [y] [x].update();
            }
        }

        int   col  = (int)(CMouse.getX() / TILE_WIDTH);
        int   row  = (int)(CMouse.getY() / TILE_HEIGHT);
        CTile tile = getTile(col, row);

        //Aca TENGO LO DEL EL CLICK PARA LOS PODERES

        /*
         * if (tile != null)
         *      {
         *              if (CMouse.firstPress())
         *              {
         *                      int index = tile.getTileIndex ();
         *                      if (index == 0)
         *                      {
         *                              tile.setTileIndex (1);
         *                              tile.setImage (mTiles[3]);
         *                      }
         *
         *                      else if (index == 1)
         *                      {
         *                              tile.setTileIndex(0);
         *                              tile.setImage(mTiles[0]);
         *                      }
         *              }
         *
         *      }
         *
         */
    }
Exemple #30
0
    public void update()
    {
        for (int y = 0; y < MAP_HEIGHT; y++)
        {
            for (int x = 0; x < MAP_WIDTH; x++)
            {
                mMap [y] [x].update();


                // RUNNER
                //mMap[y][x].setVelX(-400);
            }
        }

        int   col  = (int)(CMouse.getX() / TILE_WIDTH);
        int   row  = (int)(CMouse.getY() / TILE_HEIGHT);
        CTile tile = getTile(col, row);

        if (tile != null)
        {
            if (CMouse.firstPress())
            {
                int index = tile.getTileIndex();
                if (index == 0)
                {
                    tile.setTileIndex(1);
                    tile.setImage(mTiles[1]);
                }
                else if (index == 1)
                {
                    tile.setTileIndex(0);
                    tile.setImage(mTiles[0]);
                }
            }
        }
    }
Exemple #31
0
    override protected void rightClickPower()
    {
        int   col  = (int)(CMouse.getX() / CTileMap.Instance.getTileWidth());
        int   row  = (int)(CMouse.getY() / CTileMap.Instance.getTileHeight());
        CTile tile = CTileMap.Instance.getTile(col, row);

        if (tile == null)
        {
            return;
        }

        CTile topTile = tile.getNeighbourTile(CTile.Direction.TOP);

        if (tile.getTileType() == CTile.Type.WATER && topTile.getTileType() == CTile.Type.AIR && iceTileCounter < MAX_ICE_TILES)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.ICE);
            iceTileCounter++;
        }
        else if (tile.getTileType() == CTile.Type.ICE && topTile.getTileType() == CTile.Type.AIR && iceTileCounter > 0)
        {
            CTileMap.Instance.changeTile(tile, CTile.Type.WATER);
            iceTileCounter--;
        }
    }
Exemple #32
0
        public COpenGL()
        {
            this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));

            _Textures = new Dictionary<int, STexture>();
            _Queque = new List<STextureQueque>();
            _IDs = new Queue<int>(1000000);

            for (int i = 1; i < 1000000; i++)
            {
                _IDs.Enqueue(i);
            }

            //Check AA Mode
            CConfig.AAMode = (EAntiAliasingModes)CheckAntiAliasingMode((int)CConfig.AAMode);

            OpenTK.Graphics.ColorFormat cf = new OpenTK.Graphics.ColorFormat(32);
            OpenTK.Graphics.GraphicsMode gm;

            bool ok = false;
            try
            {
                gm = new OpenTK.Graphics.GraphicsMode(cf, 24, 0, (int)CConfig.AAMode);
                control = new GLControl(gm, 2, 1, OpenTK.Graphics.GraphicsContextFlags.Default);
                if (control.GraphicsMode != null)
                    ok = true;
            }
            catch (Exception)
            {
                ok = false;
            }

            if (!ok)
                control = new GLControl();

            control.MakeCurrent();
            control.VSync = (CConfig.VSync == EOffOn.TR_CONFIG_ON);

            this.Controls.Add(control);

            _Keys = new CKeys();
            this.Paint += new PaintEventHandler(this.OnPaintEvent);
            this.Closing += new CancelEventHandler(this.OnClosingEvent);
            this.Resize += new EventHandler(this.OnResizeEvent);

            control.KeyDown += new KeyEventHandler(this.OnKeyDownEvent);
            control.PreviewKeyDown += new PreviewKeyDownEventHandler(this.OnPreviewKeyDownEvent);
            control.KeyPress += new KeyPressEventHandler(this.OnKeyPressEvent);
            control.KeyUp += new KeyEventHandler(this.OnKeyUpEvent);

            _Mouse = new CMouse();
            control.MouseMove += new MouseEventHandler(this.OnMouseMove);
            control.MouseWheel += new MouseEventHandler(this.OnMouseWheel);
            control.MouseDown += new MouseEventHandler(this.OnMouseDown);
            control.MouseUp += new MouseEventHandler(this.OnMouseUp);
            control.MouseLeave += new EventHandler(this.OnMouseLeave);
            control.MouseEnter += new EventHandler(this.OnMouseEnter);

            this.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
            this.CenterToScreen();
        }
Exemple #33
0
        /// <summary>
        /// Creates a new Instance of the CDirect3D Class
        /// </summary>
        public CDirect3D()
        {
            this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
            _Textures = new List<STexture>();
            _D3DTextures = new List<Texture>();
            _Queque = new List<STextureQueque>();

            _Keys = new CKeys();
            _D3D = new Direct3D();

            this.Paint += new PaintEventHandler(this.OnPaintEvent);
            this.Closing += new CancelEventHandler(this.OnClosingEvent);
            this.Resize += new EventHandler(this.OnResizeEvent);

            this.KeyDown += new KeyEventHandler(this.OnKeyDown);
            this.PreviewKeyDown += new PreviewKeyDownEventHandler(this.OnPreviewKeyDown);
            this.KeyPress += new KeyPressEventHandler(this.OnKeyPress);
            this.KeyUp += new KeyEventHandler(this.OnKeyUp);

            _Mouse = new CMouse();
            this.MouseMove += new MouseEventHandler(this.OnMouseMove);
            this.MouseWheel += new MouseEventHandler(this.OnMouseWheel);
            this.MouseDown += new MouseEventHandler(this.OnMouseDown);
            this.MouseUp += new MouseEventHandler(this.OnMouseUp);
            this.MouseLeave += new EventHandler(this.OnMouseLeave);
            this.MouseEnter += new EventHandler(this.OnMouseEnter);

            this.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
            _SizeBeforeMinimize = ClientSize;

            _PresentParameters = new PresentParameters();
            _PresentParameters.Windowed = true;
            _PresentParameters.SwapEffect = SwapEffect.Discard;
            _PresentParameters.BackBufferHeight = CConfig.ScreenH;
            _PresentParameters.BackBufferWidth = CConfig.ScreenW;
            _PresentParameters.BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format;
            _PresentParameters.Multisample = MultisampleType.None;
            _PresentParameters.MultisampleQuality = 0;

            //Apply antialiasing and check if antialiasing mode is supported
            #region Antialiasing
            int quality = 0;
            if (CConfig.AAMode == EAntiAliasingModes.x0)
            {
                _PresentParameters.Multisample = MultisampleType.None;
                _PresentParameters.MultisampleQuality = quality;
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x2)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.TwoSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.TwoSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x4)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.FourSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.FourSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x8)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.EightSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.EightSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x16 || CConfig.AAMode == EAntiAliasingModes.x32) //x32 is not supported, fallback to x16
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.SixteenSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.SixteenSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            #endregion Antialiasing

            //Apply the VSync configuration
            if (CConfig.VSync == EOffOn.TR_CONFIG_ON)
                _PresentParameters.PresentationInterval = PresentInterval.Default;
            else
                _PresentParameters.PresentationInterval = PresentInterval.Immediate;

            //GMA 950 graphics devices can only process vertices in software mode
            Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware);
            CreateFlags flags = CreateFlags.None;
            if ((caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0)
                flags = CreateFlags.HardwareVertexProcessing;
            else
                flags = CreateFlags.SoftwareVertexProcessing;
            _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);

            this.CenterToScreen();

            //This creates a new white texture and adds it to the texture pool
            //This texture is used for the DrawRect method
            blankMap = new Bitmap(1, 1);
            Graphics g = Graphics.FromImage(blankMap);
            g.Clear(Color.White);
            g.Dispose();
            blankTexture = AddTexture(blankMap);

            transparentTexture = new Texture(_Device, 1, 1, 0, Usage.None, Format.A8R8G8B8, Pool.Managed);
            blankMap.Dispose();
        }
Exemple #34
0
        /// <summary>
        /// Creates a new Instance of the CDirect3D Class
        /// </summary>
        public CDirect3D()
        {
            this.Icon = new System.Drawing.Icon(Path.Combine(System.Environment.CurrentDirectory, CSettings.sIcon));
            _Textures = new Dictionary<int, STexture>();
            _D3DTextures = new Dictionary<int, Texture>();
            _Queque = new List<STextureQueque>();
            _IDs = new Queue<int>();

            //Fill Queue with 100000 IDs
            for (int i = 0; i < 100000; i++)
                _IDs.Enqueue(i);

            _Vertices = new Queue<TexturedColoredVertex>();
            _VerticesTextures = new Queue<Texture>();
            _VerticesRotationMatrices = new Queue<Matrix>();

            _Keys = new CKeys();
            try
            {
                _D3D = new Direct3D();
            }
            catch (Direct3D9NotFoundException e)
            {
                MessageBox.Show("No DirectX runtimes were found, please download and install them " +
                    "from http://www.microsoft.com/download/en/details.aspx?id=8109",
                    CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                CLog.LogError(e.Message + " - No DirectX runtimes were found, please download and install them from http://www.microsoft.com/download/en/details.aspx?id=8109");
                Environment.Exit(Environment.ExitCode);
            }

            this.Paint += new PaintEventHandler(this.OnPaintEvent);
            this.Closing += new CancelEventHandler(this.OnClosingEvent);
            this.Resize += new EventHandler(this.OnResizeEvent);

            this.KeyDown += new KeyEventHandler(this.OnKeyDown);
            this.PreviewKeyDown += new PreviewKeyDownEventHandler(this.OnPreviewKeyDown);
            this.KeyPress += new KeyPressEventHandler(this.OnKeyPress);
            this.KeyUp += new KeyEventHandler(this.OnKeyUp);

            _Mouse = new CMouse();
            this.MouseMove += new MouseEventHandler(this.OnMouseMove);
            this.MouseWheel += new MouseEventHandler(this.OnMouseWheel);
            this.MouseDown += new MouseEventHandler(this.OnMouseDown);
            this.MouseUp += new MouseEventHandler(this.OnMouseUp);
            this.MouseLeave += new EventHandler(this.OnMouseLeave);
            this.MouseEnter += new EventHandler(this.OnMouseEnter);

            this.ClientSize = new Size(CConfig.ScreenW, CConfig.ScreenH);
            _SizeBeforeMinimize = ClientSize;

            _PresentParameters = new PresentParameters();
            _PresentParameters.Windowed = true;
            _PresentParameters.SwapEffect = SwapEffect.Discard;
            _PresentParameters.BackBufferHeight = CConfig.ScreenH;
            _PresentParameters.BackBufferWidth = CConfig.ScreenW;
            _PresentParameters.BackBufferFormat = _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format;
            _PresentParameters.Multisample = MultisampleType.None;
            _PresentParameters.MultisampleQuality = 0;

            //Apply antialiasing and check if antialiasing mode is supported
            #region Antialiasing
            int quality = 0;
            if (CConfig.AAMode == EAntiAliasingModes.x0)
            {
                _PresentParameters.Multisample = MultisampleType.None;
                _PresentParameters.MultisampleQuality = quality;
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x2)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.TwoSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.TwoSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x4)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.FourSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.FourSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x8)
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.EightSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.EightSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            else if (CConfig.AAMode == EAntiAliasingModes.x16 || CConfig.AAMode == EAntiAliasingModes.x32) //x32 is not supported, fallback to x16
            {
                if (_D3D.CheckDeviceMultisampleType(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, _D3D.Adapters.DefaultAdapter.CurrentDisplayMode.Format, false, MultisampleType.SixteenSamples, out quality))
                {
                    _PresentParameters.Multisample = MultisampleType.SixteenSamples;
                    _PresentParameters.MultisampleQuality = quality - 1;
                }
                else
                    CLog.LogError("[Direct3D] This AAMode is not supported by this device or driver, fallback to no AA");
            }
            #endregion Antialiasing

            //Apply the VSync configuration
            if (CConfig.VSync == EOffOn.TR_CONFIG_ON)
                _PresentParameters.PresentationInterval = PresentInterval.Default;
            else
                _PresentParameters.PresentationInterval = PresentInterval.Immediate;

            //GMA 950 graphics devices can only process vertices in software mode
            Capabilities caps = _D3D.GetDeviceCaps(_D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware);
            CreateFlags flags = CreateFlags.None;
            if ((caps.DeviceCaps & DeviceCaps.HWTransformAndLight) != 0)
                flags = CreateFlags.HardwareVertexProcessing;
            else
                flags = CreateFlags.SoftwareVertexProcessing;
            try
            {
                _Device = new Device(_D3D, _D3D.Adapters.DefaultAdapter.Adapter, DeviceType.Hardware, Handle, flags, _PresentParameters);
            }
            catch (Exception e)
            {
                MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " +
                    "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
                    CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                CLog.LogError(e.Message + " - Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
                Environment.Exit(Environment.ExitCode);
            }
            finally
            {
                if (_Device == null || _Device.Disposed)
                {
                    MessageBox.Show("Something went wrong during device creating, please check if your DirectX redistributables " +
                        "and graphic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109",
                        CSettings.sProgramName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    CLog.LogError("Something went wrong during device creating, please check if your DirectX redistributables and grafic card drivers are up to date. You can download the DirectX runtimes at http://www.microsoft.com/download/en/details.aspx?id=8109");
                    Environment.Exit(Environment.ExitCode);
                }
            }

            this.CenterToScreen();
        }
Exemple #35
0
        private static bool HandleInputThemeEditor(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.Normal;
                    Screens[(int)ActualScreen].NextInteraction();
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                        Screens[(int)ActualScreen].HandleInputThemeEditor(KeyEvent);
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                if (!_Fading)
                    Screens[(int)ActualScreen].HandleMouseThemeEditor(MouseEvent);

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
            }
            return true;
        }
Exemple #36
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();

            bool Resume = true;
            while (keys.PollEvent(ref KeyEvent))
            {
                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInacive();
                    _Cursor.FadeOut();
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter ))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                        Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
                }
            }

            while (Mouse.PollEvent(ref MouseEvent))
            {
                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
                    Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
            }
            return Resume;
        }
Exemple #37
0
        public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse)
        {
            bool _Run = true;
            _Cursor.CursorVisible = Mouse.Visible;

            Mouse.CopyEvents();
            Keys.CopyEvents();

            CSound.Update();

            if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && ActualScreen != EScreens.ScreenSing)
                CSongs.LoadCover(30L);

            if (CSettings.GameState != EGameState.EditTheme)
            {
                _Run &= HandleInputs(Keys, Mouse);
                _Run &= Update();
            }
            else
            {
                _Run &= HandleInputThemeEditor(Keys, Mouse);
                _Run &= Update();
            }

            return _Run;
        }
Exemple #38
0
        private static bool HandleInputs(CKeys keys, CMouse Mouse)
        {
            KeyEvent KeyEvent = new KeyEvent();
            MouseEvent MouseEvent = new MouseEvent();
            KeyEvent InputKeyEvent = new KeyEvent();
            MouseEvent InputMouseEvent = new MouseEvent();

            bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
                _CurrentScreen != EScreens.ScreenSong && _CurrentScreen != EScreens.ScreenCredits;

            bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits;

            bool Resume = true;
            bool EventsAvailable = false;
            bool InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);

            while ((EventsAvailable = keys.PollEvent(ref KeyEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                    KeyEvent = InputKeyEvent;

                if (KeyEvent.Key == Keys.Left || KeyEvent.Key == Keys.Right || KeyEvent.Key == Keys.Up || KeyEvent.Key == Keys.Down)
                {
                    CSettings.MouseInactive();
                    _Cursor.FadeOut();
                }
                
                if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                    else
                        HidePopup(EPopupScreens.PopupPlayerControl);
                }

                if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
                {
                    CSettings.GameState = EGameState.EditTheme;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter ))
                {
                    CSettings.bFullScreen = !CSettings.bFullScreen;
                }
                else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.P))
                {
                    CDraw.MakeScreenShot();
                }
                else
                {
                    if (!_Fading)
                    {
                        bool handled = false;
                        if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                            handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
                        
                        if (!handled)
                            Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
                    }
                }

                if (!EventsAvailable)
                    InputEventsAvailable = CInput.PollKeyEvent(ref InputKeyEvent);
            }

            InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);

            while ((EventsAvailable = Mouse.PollEvent(ref MouseEvent)) || InputEventsAvailable)
            {
                if (!EventsAvailable)
                    MouseEvent = InputMouseEvent;

                if (MouseEvent.Wheel != 0)
                {
                    CSettings.MouseActive();
                    _Cursor.FadeIn();
                }

                UpdateMousePosition(MouseEvent.X, MouseEvent.Y);

                bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
                if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
                        ShowPopup(EPopupScreens.PopupPlayerControl);
                }

                if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
                    HidePopup(EPopupScreens.PopupPlayerControl);

                bool isOverPopupVolumeControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupVolumeControl].ScreenArea, MouseEvent);
                if (PopupVolumeControlAllowed && isOverPopupVolumeControl)
                {
                    if (_CurrentPopupScreen == EPopupScreens.NoPopup)
                    {
                        ShowPopup(EPopupScreens.PopupVolumeControl);
                        _VolumePopupTimer.Reset();
                    }
                }

                if (!isOverPopupVolumeControl && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                {
                    HidePopup(EPopupScreens.PopupVolumeControl);
                    _VolumePopupTimer.Reset();
                }

                bool handled = false;
                if (_CurrentPopupScreen != EPopupScreens.NoPopup)
                    handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
                if (handled && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl)
                    _Screens[(int)_CurrentScreen].ApplyVolume();


                if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB || MouseEvent.MB))
                    Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); 
              
                if (!EventsAvailable)
                    InputEventsAvailable = CInput.PollMouseEvent(ref InputMouseEvent);
            }
            return Resume;
        }