Ejemplo n.º 1
0
        public override void DrawPage()
        {
            //SwinGame.DrawBitmap ("bg.jpg", 0, 0);
            SwinGame.DrawBitmap("bg2.jpg", 0, 0);

            //UtilityFunction.gameStateStack.Push (GameState.ChangingCar);
            for (int i = 0; i < menu.Length; i++)
            {
                //SwinGame.DrawBitmap ("SportCar.png", ButtonX, ButtonY);
                //SwinGame.DrawBitmap ("player.png", ButtonX, ButtonY + 51);
                SwinGame.FillRectangle(Color.Transparent, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                if (UtilityFunction.IsMouseInRectangle(ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
                {
                    if (SwinGame.MouseDown(MouseButton.LeftButton))
                    {
                        SwinGame.FillRectangle(Color.LimeGreen, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                    else
                    {
                        SwinGame.DrawRectangle(Color.Azure, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                }
                SwinGame.DrawText(menu [i], Color.GhostWhite, ButtonX + 10 * Spacing, ButtonY + ButtonHeight / 2 + (Spacing + ButtonHeight) * i);
            }
        }
Ejemplo n.º 2
0
        public override void DrawPage()
        {
            SwinGame.DrawBitmap("bg2.jpg", 0, 0);

            for (int i = 0; i < menu.Length; i++)
            {
                SwinGame.FillRectangle(Color.Transparent, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                SwinGame.DrawBitmap("play_button.png", ButtonX, ButtonY);
                SwinGame.DrawBitmap("high.png", ButtonX, ButtonY + 51);
                SwinGame.DrawBitmap("setting.png", ButtonX, ButtonY + 101);
                SwinGame.DrawBitmap("instruction.png", ButtonX, ButtonY + 151);
                SwinGame.DrawBitmap("vehicle.png", ButtonX, ButtonY + 201);
                if (UtilityFunction.IsMouseInRectangle(ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
                {
                    if (SwinGame.MouseDown(MouseButton.LeftButton))
                    {
                        SwinGame.FillRectangle(Color.LimeGreen, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                    else
                    {
                        SwinGame.DrawRectangle(Color.Azure, ButtonX, ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                }
                //SwinGame.DrawText (menu [i], Color.Black, ButtonX + 10 * Spacing, ButtonY + ButtonHeight / 2 + (Spacing + ButtonHeight) * i);
            }
        }
Ejemplo n.º 3
0
        void DrawSecondLevelButtons(int row)
        {
            UtilityFunction.gameStateStack.Push(GameState.ChangingDifficulty);
            int Level = 1;

            for (int i = 0; i < secondLevelList[row].Length; i++)
            {
                //Sub button
                SwinGame.DrawBitmap("easy.png", ButtonX + 185, ButtonY);
                SwinGame.DrawBitmap("medium.png", ButtonX + 185, ButtonY + 51);
                SwinGame.DrawBitmap("hard.png", ButtonX + 185, ButtonY + 101);
                SwinGame.DrawBitmap("extreme.png", ButtonX + 185, ButtonY + 151);


                SwinGame.FillRectangle(Color.Transparent, ButtonX + (Spacing + ButtonWidth) * (Level), ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                if (UtilityFunction.IsMouseInRectangle(ButtonX + (Spacing + ButtonWidth) * (Level), ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
                {
                    if (SwinGame.MouseDown(MouseButton.LeftButton))
                    {
                        SwinGame.FillRectangle(Color.LimeGreen, ButtonX + (Spacing + ButtonWidth) * (Level), ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                    else
                    {
                        SwinGame.DrawRectangle(Color.Azure, ButtonX + (Spacing + ButtonWidth) * (Level), ButtonY + (Spacing + ButtonHeight) * i, ButtonWidth, ButtonHeight);
                    }
                }
                SwinGame.DrawText(secondLevelList [row][i], Color.Black, ButtonX + 10 * Spacing + (Spacing + ButtonWidth) * (Level), ButtonY + ButtonHeight / 2 + (Spacing + ButtonHeight) * i);
            }
        }
Ejemplo n.º 4
0
 private void HandleMenuInput()
 {
     for (int i = 0; i < menu.Length; i++)
     {
         if (SwinGame.MouseClicked(MouseButton.LeftButton) &&
             UtilityFunction.IsMouseInRectangle(ButtonX, ButtonY + (Spacing + ButtonHeight) * i,
                                                ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
         {
             PerformMenuAction(i);
         }
     }
 }
Ejemplo n.º 5
0
 void HandleSelectionButtonInput()
 {
     for (int i = 0; i < menu.Length; i++)
     {
         if (SwinGame.MouseClicked(MouseButton.LeftButton) &&
             UtilityFunction.IsMouseInRectangle(ButtonX, ButtonY + (Spacing + ButtonHeight) * i,
                                                ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
         {
             PerformSelectionAction(i);
             //PerformCarSelectionChanges (i);
         }
     }
 }
Ejemplo n.º 6
0
        void HandleCarButtonInput()
        {
            int Level = 1;

            for (int i = 0; i < menu [0].Length; i++)
            {
                if (SwinGame.MouseClicked(MouseButton.LeftButton) &&
                    UtilityFunction.IsMouseInRectangle(ButtonX + (Spacing + ButtonWidth) * (Level), ButtonY + (Spacing + ButtonHeight) * i,
                                                       ButtonWidth, ButtonHeight, SwinGame.MousePosition()))
                {
                    PerformCarSelectionChanges(i);
                    break;
                }
            }
            while (UtilityFunction.gameStateStack.Peek() == GameState.ChangingCar)
            {
                UtilityFunction.gameStateStack.Pop();
            }
        }