Exemple #1
0
    public void Show()
    {
        const int WIDTH = 200, HEIGHT = 100, GAP = 30;

        SplashKit.ProcessEvents();
        while (!SplashKit.KeyTyped(KeyCode.EscapeKey))
        {
            int i = 0, j = 0;
            SplashKit.ProcessEvents();
            _screen.Clear(Color.Gray);
            SplashKit.FillRectangle(Color.LightGray, X, Y, Width, Height);
            foreach (DashboardData assignment in _collection)
            {
                int x = X + WIDTH * j + GAP, y = Y + HEIGHT * i + GAP;
                SplashKit.DrawRectangle(Color.Black, x, y, WIDTH, HEIGHT);
                SplashKit.FillRectangle(GetUgrencyColor(assignment), x + 1, y + 1, WIDTH - 2, HEIGHT - 2);
                SplashKit.DrawTextOnWindow(_screen, assignment.unitName, Color.Black, "Fira", 25, x + 5, y + 5);
                SplashKit.DrawTextOnWindow(_screen, assignment.assignmentName, Color.Black, "Fira", 20, x + 5, y + 30);
                SplashKit.DrawTextOnWindow(_screen, assignment.dueDate.Day.ToString() + "-" + assignment.dueDate.Month.ToString() + "-" + assignment.dueDate.Year.ToString(), Color.Black, "Fira", 20, x + 5, y + 50);
                SplashKit.DrawTextOnWindow(_screen, assignment.dueDate.Subtract(DateTime.Today).Days.ToString() + " days left", Color.Black, "Fira", 20, x + 5, y + 75);

                if (++i > 3)
                {
                    j++;
                    i = 0;
                }
            }
            _screen.Refresh(60);
        }
    }
 /// <summary>
 /// Draws the cell on the screen
 /// </summary>
 public override void Draw()
 {
     // the outer rectangle of the cell, the walls of the cell
     SplashKit.FillRectangle(_color, _x, _y, _width, _height);
     // the inner rectangle
     SplashKit.FillRectangle(_foregroundColor, _x + _padding, _y + _padding, _width - (_padding * 2), _height - (_padding * 2));
 }
Exemple #3
0
 // draw
 public override void Draw(double x, double y)
 {
     for (int i = 0; i < Positions.Count; i++)
     {
         SplashKit.FillRectangle(Color.White, Positions[i].X, Positions[i].Y, 15.0, 15.0);
     }
 }
Exemple #4
0
 public void InputDraw()
 {
     _screen.Clear(Color.Gray);
     SplashKit.DrawRectangle(Color.Black, X, Y, Width, Height);
     SplashKit.FillRectangle(Color.LightGray, X + 1, Y + 1, Width - 2, Height - 2);
     SplashKit.DrawTextOnWindow(_screen, "Name: ", Color.Black, "Fira", 20, X + 10, Y + 10);
     SplashKit.FillRectangle(Color.White, X + 130, Y + 10, 400, 20);
     SplashKit.DrawTextOnWindow(_screen, "Assignments: ", Color.Black, "Fira", 20, X + 10, Y + 50);
     SplashKit.FillRectangle(Color.White, X + 130, Y + 50, 400, 20);
     SplashKit.FillRectangle(Color.DarkGray, X + 110, Y + 150, 80, 25);
     SplashKit.DrawTextOnWindow(_screen, "Next", Color.White, "Fira", 20, X + 130, Y + 150);
     if (_inp == 0)
     {
         SplashKit.DrawTextOnWindow(_screen, _name, Color.Black, "Fira", 19, X + 135, Y + 11);
         SplashKit.DrawTextOnWindow(_screen, Convert.ToString(_noOfAssignments), Color.Black, "Fira", 19, X + 135, Y + 51);
     }
     else if (_inp == 1)
     {
         SplashKit.DrawTextOnWindow(_screen, Convert.ToString(_noOfAssignments), Color.Black, "Fira", 19, X + 135, Y + 51);
     }
     else if (_inp == 2)
     {
         SplashKit.DrawTextOnWindow(_screen, _name, Color.Black, "Fira", 19, X + 135, Y + 11);
     }
 }
        // This is called when Space key is pressesd.
        public static void TestOnSpace(object sender, OnPathChangedEventArgs onPathChangedEventArgs)
        {
            PathFindingGUI pathFindingGUI = (PathFindingGUI)sender;

            if (onPathChangedEventArgs.pathFinding != null)
            {
                for (int i = 1; i < onPathChangedEventArgs.pathFinding.GetVisitedPath().Count; i++)
                {
                    PathNode searchNode = onPathChangedEventArgs.pathFinding.GetVisitedPath()[i];
                    SplashKit.FillRectangle(Color.LightBlue, searchNode.X * pathFindingGUI.CellSize + 2, searchNode.Y * pathFindingGUI.CellSize + 2, pathFindingGUI.CellSize - 2, pathFindingGUI.CellSize - 2);
                    if (i % 5 == 0)
                    {
                        pathFindingGUI.window.Refresh(60);
                    }
                }
                // If there is no path found, return.
                if (pathFindingGUI.pathNodes == null)
                {
                    return;
                }

                for (int i = 1; i < pathFindingGUI.pathNodes.Count - 1; i++)
                {
                    // Color Green, x is axis of pathNodes[i] in grid * cellSize, y is thr ordinate location of pathNodes[i] in grid * cellSize, with and height = cellSize
                    Util.FillSquare(Color.Yellow, pathFindingGUI.pathNodes[i].X, pathFindingGUI.pathNodes[i].Y, pathFindingGUI.CellSize);
                    pathFindingGUI.window.Refresh(60);
                }
                SplashKit.Delay(5000);
            }
        }
        /// <summary>
        /// Draws the button on the screen
        /// </summary>
        public override void Draw()
        {
            double midPointY = _y + _height / 2;

            /*
             *  If the button is not active draws it with the normal
             *  color otherwise draws it with the active color
             */
            if (!_active)
            {
                SplashKit.FillRectangle(_color, _x, _y, _width, _height);
            }
            else
            {
                SplashKit.FillRectangle(_activeColor, _x, _y, _width, _height);
            }

            /*
             *  If a caption string has been sets draws that text inside the button
             */
            if (_caption is string)
            {
                SplashKit.DrawText(_caption, _captionColor, _captionFont, _captionSize, _x + 10, midPointY - 10);
            }
        }
Exemple #7
0
        public void ProgressBar()
        {
            SplashKit.DrawRectangle(DefaultColor, -1, -1, SplashKit.ScreenWidth() + 2, 10);
            float percentage = (float)Timer.Ticks / (float)Duration.TotalMilliseconds;
            float progress   = percentage * SplashKit.ScreenWidth();

            SplashKit.FillRectangle(DefaultColor, -1, -1, (int)progress, 10);
        }
 public override void Draw()
 {
     if (Selected)
     {
         DrawOutline();
     }
     SplashKit.FillRectangle(Color, X, Y, Width, Height);
 }
Exemple #9
0
        /// <summary>
        /// Draws the slider on the screen
        /// </summary>
        public override void Draw()
        {
            double midY = _y + _height / 2;

            // draws the slider caption and the slider's current value
            SplashKit.DrawText($"{_caption} {(int)_sliderValue}", Color.Black, _captionFont, 16, _x, _y);
            SplashKit.FillRectangle(_color, _x, midY - _height / 8, _width, _height / 4);
            _sliderButton.Draw();
        }
Exemple #10
0
 // public void WinEffect(Window win)
 // {
 //   if (IsplayerWin)
 //   {
 //     // WinSound.Play();
 //     SplashKit.DrawText($"Congradulations! You Win!", Color.OrangeRed, "cool.ttf", 30, 50, 300);
 //     SplashKit.DrawText($"Your score is {Player.Score}", Color.OrangeRed, "cool.ttf", 30, 50, 260);
 //     win.Refresh(60);
 //   }
 // }
 public void GameOverEffect()
 {
     if (Quit)
     {
         SplashKit.FillRectangle(Color.LightYellow, 0, 200, 600, 700);
         SplashKit.DrawText($"Game Over", Color.OrangeRed, "cool.ttf", 30, 50, 400);
         SplashKit.DrawText($"Your score is {Player.Score}", Color.OrangeRed, "cool.ttf", 30, 50, 260);
         GameWindow.Refresh(60);
         SplashKit.Delay(8000);
     }
 }
Exemple #11
0
 public override void Draw()
 {
     if (Bomb)
     {
         SplashKit.FillRectangle(Color, X, Y, Width, Height);
     }
     else
     {
         SplashKit.DrawRectangle(Color, X, Y, Width, Height);
     }
 }
 public void GameOver()
 {
     if (_score == 10)
     {
         SplashKit.ResetTimer(t);
         SplashKit.FillRectangle(Color.DarkOrange, 200, 150, 400, 300);
         SplashKit.DrawText("Congratultions!", Color.Black, 340, 250);
         SplashKit.DrawText("You caught 10 ducks.", Color.Black, 322, 300);
         SplashKit.DrawText("Your time was " + _score.ToString() + " seconds", Color.Black, 310, 350);
     }
 }
Exemple #13
0
 public override void Draw()
 {
     SplashKit.FillRectangle(Color, X, Y, Width, Height);
     if (Text == "HP")
     {
         SplashKit.DrawText(Text, Color.White, Game.getInstance().DefaultFont, 15, X + 15, Y + 5);
     }
     else
     {
         SplashKit.DrawText(Text, Color.White, Game.getInstance().DefaultFont, 15, X + 7, Y + 5);
     }
 }
Exemple #14
0
    public override void Draw()
    {
        _HealthPercent = (double)_Health / _MaxHealth;

        SplashKit.DrawBitmap(_Image, 800 - _Image.Width - _ImageBuffer, _ImageBuffer);
        SplashKit.FillRectangle(Color.DarkBlue, BoxOuterBuffer, BoxOuterBuffer, BoxWidth, BoxHeight);
        SplashKit.DrawRectangle(Color.White, BoxOuterBuffer, BoxOuterBuffer, BoxWidth, BoxHeight);
        SplashKit.DrawText($"{_Name} ", Color.White, MainFont, 40, BoxOuterBuffer + BoxInnerBuffer, BoxOuterBuffer + BoxInnerBuffer);
        SplashKit.DrawText($"Lv: {_Level} ", Color.White, MainFont, 40, BoxOuterBuffer + BoxWidth / 2 + 50, BoxInnerBuffer + BoxOuterBuffer);
        SplashKit.DrawText($"HP:", Color.White, MainFont, 40, BoxOuterBuffer + BoxInnerBuffer, BoxOuterBuffer + BoxInnerBuffer + 40);
        SplashKit.FillRectangle(Color.Red, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, _HealthPercent * HealthBarWidth, HealthBarHeight);
        SplashKit.DrawRectangle(Color.White, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxOuterBuffer + 2 * BoxInnerBuffer + 40, BoxWidth - 2 * BoxInnerBuffer - 2 * BoxOuterBuffer, HealthBarHeight);
    }
Exemple #15
0
    public void Draw()
    {
        double leftX, rightX, eyeY, mouthY;

        leftX  = X + 12;
        rightX = X + 27;
        eyeY   = Y + 10;
        mouthY = Y + 30;
        SplashKit.FillRectangle(Color.Gray, X, Y, Width, Height);
        SplashKit.FillRectangle(MainColor, leftX, eyeY, 10, 10);
        SplashKit.FillRectangle(MainColor, rightX, eyeY, 10, 10);
        SplashKit.FillRectangle(MainColor, leftX, mouthY, 25, 10);
        SplashKit.FillRectangle(MainColor, leftX + 2, mouthY + 2, 21, 10);
    }
Exemple #16
0
    public override void Draw()
    {
        double leftX, rightX;
        double eyeY, mouthY;

        leftX  = X + 12;
        rightX = X + 27;
        eyeY   = Y + 10;
        mouthY = Y + 30;
        SplashKit.FillRectangle(Color.Gray, X, Y, 50, 50);
        SplashKit.DrawRectangle(MainColor, leftX, eyeY, 10, 10);
        SplashKit.DrawRectangle(MainColor, rightX, eyeY, 10, 10);
        SplashKit.DrawRectangle(MainColor, leftX, mouthY, 25, 10);
        SplashKit.DrawRectangle(MainColor, leftX + 2, mouthY + 2, 21, 6);
    }
Exemple #17
0
        // draw Hp bar and Exp bar
        /// <summary>
        /// Draw Hp bar and Experience bar on window
        /// </summary>
        /// <param name="windowWidth"></param>
        /// <param name="windowHeight"></param>
        /// <param name="player"></param>
        /// <param name="gameMap"></param>
        private void DrawHpExp(double windowWidth, double windowHeight, Player player)
        {
            // healthbar and score
            // frame - scale
            SplashKit.FillRectangle(Color.Black, windowWidth - 180, windowHeight - 7 * 60, 30, windowHeight / 3);
            SplashKit.FillRectangle(Color.Black, windowWidth - 90, windowHeight - 7 * 60, 30, windowHeight / 3);
            // value
            double hpRatio        = player.Hp / 100.0;
            double hpBarHeight    = hpRatio * windowHeight / 3;
            double hpPosY         = (windowHeight - 7 * 60) + (windowHeight / 3 - (hpRatio * windowHeight / 3));
            double scoreRatio     = player.Score / 2000.0;
            double scoreBarHeight = scoreRatio * windowHeight / 3;
            double scorePosY      = (windowHeight - 7 * 60) + (windowHeight / 3 - (scoreRatio * windowHeight / 3));

            SplashKit.FillRectangle(Color.Green, windowWidth - 180, hpPosY, 30, hpBarHeight);
            SplashKit.FillRectangle(Color.Yellow, windowWidth - 90, scorePosY, 30, scoreBarHeight);
        }
Exemple #18
0
        public void Display(GameFacade facade)
        {
            Frogger   game  = Frogger.Instance;
            GameTimer timer = GameTimer.Instance;

            game.RunGame();
            timer.ResetTimer();

            // sidebars
            SplashKit.FillRectangle(Color.Black, 0, 0, 25, 800);
            SplashKit.FillRectangle(Color.Black, 675, 0, 25, 800);

            if (SplashKit.KeyTyped(KeyCode.EscapeKey))
            {
                facade.SetState(new GameMenuState());
            }
        }
Exemple #19
0
    public override void Draw()
    {
        SplashKit.DrawBitmap(_Image, X, Y);

        SplashKit.FillRectangle(Color.DarkBlue, BoxX, BoxY, BoxWidth, BoxHeight);
        SplashKit.DrawRectangle(Color.White, BoxX, BoxY, BoxWidth, BoxHeight);

        _HealthPercent = (double)_Health / _MaxHealth;



        SplashKit.DrawText($"{_Name} ", Color.White, MainFont, 40, _GameWindow.Width - BoxWidth - BoxOuterBuffer + BoxInnerBuffer, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + BoxInnerBuffer);
        SplashKit.DrawText($"HP:", Color.White, MainFont, 40, _GameWindow.Width - BoxWidth - BoxOuterBuffer + BoxInnerBuffer, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + BoxInnerBuffer + 40);
        SplashKit.DrawText($"Lv: {_Level}", Color.White, MainFont, 40, _GameWindow.Width - BoxOuterBuffer - BoxWidth / 2 + 50, 3 * _GameWindow.Height / 4 - BoxOuterBuffer - BoxHeight + BoxInnerBuffer);
        SplashKit.FillRectangle(Color.Red, _GameWindow.Width - BoxWidth - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, _HealthPercent * HealthBarWidth, HealthBarHeight);
        SplashKit.DrawRectangle(Color.White, _GameWindow.Width - BoxWidth - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, 3 * _GameWindow.Height / 4 - BoxHeight - BoxOuterBuffer + 2 * BoxInnerBuffer + 40, HealthBarWidth, HealthBarHeight);
    }
Exemple #20
0
    public void DrawInstructions()
    {
        SplashKit.FillRectangle(Color.DarkBlue, _InstructionsX, _InstructionsY, 3 * gameWindow.Width / 4, 3 * gameWindow.Height / 4);
        SplashKit.DrawRectangle(Color.White, _InstructionsX, _InstructionsY, 3 * gameWindow.Width / 4, 3 * gameWindow.Height / 4);
        SplashKit.DrawText($"Welcome to C# Battler", Color.White, _MainFont, 40, _InstructionsX + 20, _InstructionsY);

        SplashKit.DrawText($"Use the menu to navigate", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 2 * _LineHeight);

        SplashKit.DrawText($"The Charge Attack is a mostly accurate but low damage attack", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 4 * _LineHeight);
        SplashKit.DrawText($"The Slash Attack is a semi accurate and high damage attack", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 5 * _LineHeight);
        SplashKit.DrawText($"The Spell Attack is a semi accurate low attack that ignores counters", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 6 * _LineHeight);

        SplashKit.DrawText("A counter is 50% likely to reflect back an attack for half damage", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 8 * _LineHeight);

        SplashKit.DrawText($"You begin with 10 potions which each heal 30 Health", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 10 * _LineHeight);
        SplashKit.DrawText($"A magic heal will heal a random amount relative to your level", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 11 * _LineHeight);
        SplashKit.DrawText("The button labelled Instructions in the top left will toggle this box", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 13 * _LineHeight);
        SplashKit.DrawText("Enjoy!", Color.White, _MainFont, 22, _InstructionsX + 20, _InstructionsY + 14 * _LineHeight);
    }
Exemple #21
0
    //Draw the game
    public void Draw()
    {
        _gameWindow.Clear(Color.Black);
        SplashKit.DrawText(Convert.ToString(Score), Color.White, _font, 25, _gameWindow.Width / 2 - Convert.ToString(Score).Length, 5);
        SplashKit.FillRectangle(Color.White, 0, topBorder - 5, _gameWindow.Width, 5);
        for (int i = 0; i < _Bullets.Count; i++)
        {
            _Bullets[i].Draw();
        }
        SplashKit.DrawText("Bullet: " + Convert.ToString(_Bullets.Count), Color.White, _font, 17, 0, 10);
        string strHighScore = "Top: " + Convert.ToString(HighScore);

        SplashKit.DrawText(strHighScore, Color.White, _font, 17, _gameWindow.Width - 13 * strHighScore.Length, 10);
        for (int i = 0; i < _Boxes.Count; i++)
        {
            _Boxes[i].Draw();
        }
        _player.Draw();
        _gameWindow.Refresh(60);
    }
Exemple #22
0
        public void Environment()
        {
            SplashKit.FillRectangle(Color.Black, 25, 750, 650, 50);
            SplashKit.FillRectangle(Color.Black, 25, 450, 650, 250);
            SplashKit.FillRectangle(SplashKit.RGBColor(4, 0, 66), 25, 0, 650, 400);

            string        filePath    = @"Resources/txtfiles/environment.txt";
            List <string> environment = File.ReadAllLines(filePath).ToList();

            for (int i = 25; i < 675; i += 50)
            {
                foreach (string line in environment)
                {
                    string[] entries = line.Split(',');
                    string   name    = entries[0];
                    int      x       = int.Parse(entries[1]);
                    SplashKit.DrawBitmap(SplashKit.BitmapNamed(name), i, x);
                }
            }
        }
Exemple #23
0
    public override void Draw()
    {
        double leftX  = X + 20;
        double rightX = X + 60;

        SplashKit.FillRectangle(BodyColor, leftX, Y + 40, 40, 20);

        SplashKit.FillTriangle(WingColor, X, Y + 40, X + 20, Y + 80, X + 20, Y + 20);
        SplashKit.FillTriangle(WingColor, rightX + 20, Y + 40, rightX, Y + 80, rightX, Y + 20);

        SplashKit.FillCircle(CirColor, X + 40, Y + 50, 4);


        SplashKit.FillTriangle(Color.Blue, leftX + 10, Y + 60, leftX + 30, Y + 60, leftX + 20, Y + 80);
        SplashKit.FillTriangle(HeadColor, leftX + 10, Y + 60, leftX + 30, Y + 60, leftX + 20, Y);


        SplashKit.FillCircle(CirColor, leftX - 10, Y + 40, 4);
        SplashKit.FillCircle(CirColor, rightX + 10, Y + 40, 4);
    }
Exemple #24
0
    public override void Draw()
    {
        double leftX;
        double rightX;

        // double eyeY;
        // double mouthY;

        leftX  = X + 12;
        rightX = X + 27;

        // eyeY = Y + 10;
        // mouthY = Y + 30;

        SplashKit.FillRectangle(Color.Random(), X, Y, Width, Height);

        // SplashKit.FillRectangle(MainColor, leftX, eyeY, 10, 10);
        // SplashKit.FillRectangle(MainColor, rightX, eyeY, 10, 10);
        // SplashKit.FillRectangle(MainColor, leftX, mouthY, 25, 10);
        // SplashKit.FillRectangle(MainColor, leftX + 2, mouthY + 2, 21, 6);
    }
Exemple #25
0
    public void Draw()
    {
        if (Type == BlockType.Filled)
        {
            SplashKit.FillRectangle(_Colour, X * _Size, Y * _Size, _Size, _Size);
            SplashKit.DrawRectangle(Color.Black, X * _Size, Y * _Size, _Size, _Size);
        }

        if (Type == BlockType.Ghost)
        {
            SplashKit.DrawRectangle(_Colour, X * _Size, Y * _Size, _Size, _Size);
        }

        if (Type == BlockType.Wall)
        {
            SplashKit.FillRectangle(Color.DarkSlateBlue, X * _Size, Y * _Size, _Size, _Size);
            SplashKit.DrawRectangle(Color.Black, X * _Size, Y * _Size, _Size, _Size);
        }
        if (Type == BlockType.Empty)
        {
            SplashKit.DrawRectangle(Color.Black, X * _Size, Y * _Size, _Size, _Size);
        }
    }
 // Displayd window and render everything including grid, startnode, endnode, path and walls.
 public override void DisplayGUI()
 {
     window.Clear(Color.White);
     _pathFinding.GetGrid().PrintGrid();
     // Draw StartNode.
     SplashKit.FillRectangle(Color.Green, StartX * CellSize, StartY * CellSize, CellSize, CellSize);
     // Draw EndNode.
     SplashKit.FillRectangle(Color.Red, EndX * CellSize, EndY * CellSize, CellSize, CellSize);
     // Draw Walls.
     for (int x = 0; x < _pathFinding.GetGrid().Column; x++)
     {
         for (int y = 0; y < _pathFinding.GetGrid().Row; y++)
         {
             PathNode wall = _pathFinding.GetGrid().GetValue(x, y);
             if (!wall.IsWalkAble)
             {
                 SplashKit.FillRectangle(Color.Black, wall.X * CellSize, wall.Y * CellSize, CellSize, CellSize);
             }
         }
     }
     window.Refresh();
     Thread.Sleep(10);
 }
 /// <summary>
 /// Draws the rectangle shape on the screen
 /// </summary>
 public virtual void Draw()
 {
     SplashKit.FillRectangle(_color, _x, _y, _width, _height);
 }
Exemple #28
0
 // method to draw the rectangle
 public void Draw()
 {
     SplashKit.FillRectangle(_requiredColor, _x, _y, _width, _height);
 }
Exemple #29
0
 public override void Draw()
 {
     SplashKit.FillRectangle(Color, X, Y, Width, Height);
 }
Exemple #30
0
 public void Draw()
 {
     SplashKit.FillRectangle(Color.DarkBlue, X, Y, Width, Height);
     SplashKit.DrawRectangle(Color.White, X, Y, Width, Height);
     SplashKit.DrawText(Caption, Color.White, _MainFont, 30, X + 5, Y + 5);
 }