Exemple #1
0
        public static void drawL1(int coor_x, int coor_y, Orientation orient)
        {
            switch (orient)
            {
            case ShapeRenderer.Orientation.ORIENT_0:
                SOM.drawBox(coor_x + 0, coor_y, GetL1AnchorColor());
                SOM.drawBox(coor_x + 1, coor_y, GetL1Color());
                SOM.drawBox(coor_x + 2, coor_y, GetL1Color());
                SOM.drawBox(coor_x + 0, coor_y - 1, GetL1Color());
                break;

            case ShapeRenderer.Orientation.ORIENT_1:

                SOM.drawBox(coor_x - 1, coor_y, GetL1Color());
                SOM.drawBox(coor_x + 0, coor_y + 0, GetL1AnchorColor());
                SOM.drawBox(coor_x + 0, coor_y - 1, GetL1Color());
                SOM.drawBox(coor_x + 0, coor_y - 2, GetL1Color());


                break;

            case ShapeRenderer.Orientation.ORIENT_2:
                SOM.drawBox(coor_x - 2, coor_y, GetL1Color());
                SOM.drawBox(coor_x - 1, coor_y, GetL1Color());
                SOM.drawBox(coor_x + 0, coor_y, GetL1AnchorColor());
                SOM.drawBox(coor_x + 0, coor_y + 1, GetL1Color());
                break;

            case ShapeRenderer.Orientation.ORIENT_3:
                SOM.drawBox(coor_x, coor_y + 2, GetL1Color());
                SOM.drawBox(coor_x, coor_y + 1, GetL1Color());
                SOM.drawBox(coor_x, coor_y + 0, GetL1AnchorColor());
                SOM.drawBox(coor_x + 1, coor_y + 0, GetL1Color());
                break;

            default:
                break;
            }
        }
Exemple #2
0
        public void erase(Orientation orient)
        {
            switch (orient)
            {
            case Shape.Orientation.ORIENT_0:
                SOM.drawBox(coor_x + 0, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 1, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 2, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y - 1, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                break;

            case Shape.Orientation.ORIENT_1:

                SOM.drawBox(coor_x - 1, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y + 0, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y - 1, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y - 2, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                break;

            case Shape.Orientation.ORIENT_2:
                SOM.drawBox(coor_x - 2, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x - 1, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 0, coor_y + 1, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                break;

            case Shape.Orientation.ORIENT_3:
                SOM.drawBox(coor_x, coor_y + 2, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x, coor_y + 1, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x, coor_y + 0, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                SOM.drawBox(coor_x + 1, coor_y + 0, DrawColor.Shade.COLOR_BACKGROUND_CUSTOM);
                break;

            default:
                break;
            }
        }
Exemple #3
0
        public static void drawLine(int coor_x, int coor_y, Orientation orient)
        {
            switch (orient)
            {
            case ShapeRenderer.Orientation.ORIENT_0:     // Horizontal
                SOM.drawBox(coor_x - 1, coor_y, GetLineColor());
                SOM.drawBox(coor_x + 0, coor_y, GetLineAnchorColor());
                SOM.drawBox(coor_x + 1, coor_y, GetLineColor());
                SOM.drawBox(coor_x + 2, coor_y, GetLineColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_1:     // Vertical
                SOM.drawBox(coor_x, coor_y + 1, GetLineColor());
                SOM.drawBox(coor_x, coor_y + 0, GetLineAnchorColor());
                SOM.drawBox(coor_x, coor_y - 1, GetLineColor());
                SOM.drawBox(coor_x, coor_y - 2, GetLineColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_2:     // Horizontal
                SOM.drawBox(coor_x - 2, coor_y, GetLineColor());
                SOM.drawBox(coor_x - 1, coor_y, GetLineColor());
                SOM.drawBox(coor_x + 0, coor_y, GetLineAnchorColor());
                SOM.drawBox(coor_x + 1, coor_y, GetLineColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_3:     // Vertical
                SOM.drawBox(coor_x, coor_y + 2, GetLineColor());
                SOM.drawBox(coor_x, coor_y + 1, GetLineColor());
                SOM.drawBox(coor_x, coor_y + 0, GetLineAnchorColor());
                SOM.drawBox(coor_x, coor_y - 1, GetLineColor());
                break;

            default:
                break;
            }
        }
Exemple #4
0
        public static void drawSquare(int coor_x, int coor_y, Orientation orient)
        {
            switch (orient)
            {
            case ShapeRenderer.Orientation.ORIENT_0:    // Anchor -- Top-left
                SOM.drawBox(coor_x + 0, coor_y, GetSquareAnchorColor());
                SOM.drawBox(coor_x + 1, coor_y, GetSquareColor());
                SOM.drawBox(coor_x + 1, coor_y - 1, GetSquareColor());
                SOM.drawBox(coor_x + 0, coor_y - 1, GetSquareColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_1:    // Anchor -- Top-right
                SOM.drawBox(coor_x + 0, coor_y, GetSquareAnchorColor());
                SOM.drawBox(coor_x - 1, coor_y, GetSquareColor());
                SOM.drawBox(coor_x - 1, coor_y - 1, GetSquareColor());
                SOM.drawBox(coor_x + 0, coor_y - 1, GetSquareColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_2:    // Anchor -- Bottom-right
                SOM.drawBox(coor_x + 0, coor_y, GetSquareAnchorColor());
                SOM.drawBox(coor_x - 1, coor_y, GetSquareColor());
                SOM.drawBox(coor_x - 1, coor_y + 1, GetSquareColor());
                SOM.drawBox(coor_x + 0, coor_y + 1, GetSquareColor());
                break;

            case ShapeRenderer.Orientation.ORIENT_3:    // Anchor -- Bottom-left
                SOM.drawBox(coor_x + 0, coor_y, GetSquareAnchorColor());
                SOM.drawBox(coor_x + 1, coor_y, GetSquareColor());
                SOM.drawBox(coor_x + 1, coor_y + 1, GetSquareColor());
                SOM.drawBox(coor_x + 0, coor_y + 1, GetSquareColor());
                break;

            default:
                break;
            }
        }
Exemple #5
0
        //-----------------------------------------------------------------------------
        // Game::Draw()
        //		This function is called once per frame
        //	    Use this for draw graphics to the screen.
        //      Only do rendering here
        //-----------------------------------------------------------------------------
        public override void Draw()
        {
            // Draw sprite with texture
            //pRedBird.Render();

            // Update background
            SOM.drawBackground();
            SOM.drawStrings(stats);

            active_piece.draw();
            future_piece.draw();

            printGrid();


            //test drawing all shapes
            //if statement to make sure this only happens once, for testing purposes. Remove later to do stuff every frame

            /*if (only_one_run == 0)
             *          {
             *                  t.draw(t.orientation);
             *                  line.draw(line.orientation);
             *                  l1.draw(l1.orientation);
             *                  l2.draw(l2.orientation);
             *                  z1.draw(z1.orientation);
             *                  z2.draw(z2.orientation);
             *                  s.draw(s.orientation);
             *
             *                  only_one_run++;
             *
             *
             *                  t.erase(t.orientation);
             *                  line.erase(line.orientation);
             *                  l1.erase(l1.orientation);
             *                  l2.erase(l2.orientation);
             *                  z1.erase(z1.orientation);
             *                  z2.erase(z2.orientation);
             *                  s.erase(s.orientation);
             *
             *          }*/


            //test drawing a turned T, if staement is so that it only does it once

            /*if (turned.orientation == Shape.Orientation.ORIENT_0)
             *          {
             *                  turned.turn();
             *          }
             *          turned.draw(turned.orientation);
             *
             */

            /*
             *
             * // Draw one box, demo at position 1,1
             * SOM.drawBox(1, 1, DrawColor.Shade.COLOR_LT_GREEN);
             *
             * // Test play field
             * SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_ORANGE);
             * SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_YELLOW);
             * SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_RED);
             * SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_BLUE);
             */
        }
Exemple #6
0
        //-----------------------------------------------------------------------------
        // Game::Draw()
        //		This function is called once per frame
        //	    Use this for draw graphics to the screen.
        //      Only do rendering here
        //-----------------------------------------------------------------------------
        public override void Draw()
        {
            // Draw sprite with texture
            //pRedBird.Render();

            if (gameover)
            {
                SOM.drawBackground();
                SOM.drawStrings(stats);
                active_piece.draw();
                future_piece.draw();
                printGrid();
                SOM.drawGameOver(stats);
                stats = new GameStats();
                return;
            }
            // Update background
            SOM.drawBackground();
            SOM.drawStrings(stats);


            if (!startgame)
            {
                SOM.drawStartTetris();
                SOM.drawHighScores(stats);
            }

            if (startgame)
            {
                active_piece.draw();
                future_piece.draw();
            }

            if (paused && startgame)
            {
                SOM.drawPaused();
                //soundEngine.getAE().SetAllSoundsPaused(true);
            }

            if (!paused && startgame)
            {
                if (!muted)
                {
                    SOM.drawMenu();
                }
                if (muted)
                {
                    SOM.drawMutedMenu();
                }

                //soundEngine.getAE().SetAllSoundsPaused(false);
            }
            printGrid();


            //test drawing all shapes
            //if statement to make sure this only happens once, for testing purposes. Remove later to do stuff every frame

            /*if (only_one_run == 0)
             *          {
             *                  t.draw(t.orientation);
             *                  line.draw(line.orientation);
             *                  l1.draw(l1.orientation);
             *                  l2.draw(l2.orientation);
             *                  z1.draw(z1.orientation);
             *                  z2.draw(z2.orientation);
             *                  s.draw(s.orientation);
             *
             *                  only_one_run++;
             *
             *
             *                  t.erase(t.orientation);
             *                  line.erase(line.orientation);
             *                  l1.erase(l1.orientation);
             *                  l2.erase(l2.orientation);
             *                  z1.erase(z1.orientation);
             *                  z2.erase(z2.orientation);
             *                  s.erase(s.orientation);
             *
             *          }*/


            //test drawing a turned T, if staement is so that it only does it once

            /*if (turned.orientation == Shape.Orientation.ORIENT_0)
             *          {
             *                  turned.turn();
             *          }
             *          turned.draw(turned.orientation);
             *
             */

            /*
             *
             * // Draw one box, demo at position 1,1
             * SOM.drawBox(1, 1, DrawColor.Shade.COLOR_LT_GREEN);
             *
             * // Test play field
             * SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_ORANGE);
             * SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_YELLOW);
             * SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_RED);
             * SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_BLUE);
             */
        }
Exemple #7
0
 public void draw(DrawColor.Shade color)
 {
     SOM.drawBox(x, y, color);
 }
Exemple #8
0
 public void draw()
 {
     SOM.drawBox(x, y, color);
 }
Exemple #9
0
        //-----------------------------------------------------------------------------
        // Game::Draw()
        //		This function is called once per frame
        //	    Use this for draw graphics to the screen.
        //      Only do rendering here
        //-----------------------------------------------------------------------------
        public override void Draw()
        {
            // Draw sprite with texture
            pRedBird.Render();

            // Update background
            SOM.drawBackground();
            // SOM.drawStrings(stats);

            // Draw one box, demo at position 1,1
            SOM.drawBox(1, 1, DrawColor.Shade.COLOR_LT_GREEN);

            // Test play field
            SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_ORANGE);
            SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MIN_Y, DrawColor.Shade.COLOR_YELLOW);
            SOM.drawBox(Constants.GAME_MIN_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_RED);
            SOM.drawBox(Constants.GAME_MAX_X, Constants.GAME_MAX_Y, DrawColor.Shade.COLOR_BLUE);

            // Cycle all the tetris pieces
            if (count < 2 * 10)
            {
                ShapeRenderer.drawLine(Constants.PREVIEW_WINDOW_X, Constants.PREVIEW_WINDOW_Y, ShapeRenderer.Orientation.ORIENT_0);

                ShapeRenderer.drawLine(3, 3, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawL1(5, 8, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawL2(5, 14, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawT(5, 19, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawZ1(5, 23, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawZ2(5, 28, ShapeRenderer.Orientation.ORIENT_0);
                ShapeRenderer.drawSquare(8, 4, ShapeRenderer.Orientation.ORIENT_0);
            }
            else if (count < 2 * 20)
            {
                ShapeRenderer.drawLine(Constants.PREVIEW_WINDOW_X, Constants.PREVIEW_WINDOW_Y, ShapeRenderer.Orientation.ORIENT_1);

                ShapeRenderer.drawLine(3, 3, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawL1(5, 8, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawL2(5, 14, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawT(5, 19, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawZ1(5, 23, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawZ2(5, 28, ShapeRenderer.Orientation.ORIENT_1);
                ShapeRenderer.drawSquare(8, 4, ShapeRenderer.Orientation.ORIENT_1);
            }
            else if (count < 2 * 30)
            {
                ShapeRenderer.drawLine(Constants.PREVIEW_WINDOW_X, Constants.PREVIEW_WINDOW_Y, ShapeRenderer.Orientation.ORIENT_2);

                ShapeRenderer.drawLine(3, 3, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawL1(5, 8, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawL2(5, 14, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawT(5, 19, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawZ1(5, 23, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawZ2(5, 28, ShapeRenderer.Orientation.ORIENT_2);
                ShapeRenderer.drawSquare(8, 4, ShapeRenderer.Orientation.ORIENT_2);
            }
            else
            {
                ShapeRenderer.drawLine(Constants.PREVIEW_WINDOW_X, Constants.PREVIEW_WINDOW_Y, ShapeRenderer.Orientation.ORIENT_3);

                ShapeRenderer.drawLine(3, 3, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawL1(5, 8, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawL2(5, 14, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawT(5, 19, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawZ1(5, 23, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawZ2(5, 28, ShapeRenderer.Orientation.ORIENT_3);
                ShapeRenderer.drawSquare(8, 4, ShapeRenderer.Orientation.ORIENT_3);
            }

            if (count > 2 * 40)
            {
                count = 0;
            }
            else
            {
                count++;
            }
        }