Exemplo n.º 1
0
 public void draw(GraphicsWrapper g, Panel minigamePanel, Timer minigameTimer, uint minigameTime)
 {
     for (int i = 0; i < enemies.Count; i++)
     {
         g.DrawRectangle(new RectangleF(enemies[i].toPointF(), new SizeF(10, 10)), Color.Red);
     }
     g.DrawRectangle(new RectangleF(player.toPointF(), new SizeF(10, 10)), Color.Green);
     g.DrawSizedString(lives.ToString(), 7, player.toPointF(), Brushes.White, true, true);
 }
Exemplo n.º 2
0
 public void draw(GraphicsWrapper g, Panel minigamePanel, Timer minigameTimer, uint minigameTime)
 {
     for (int i = 0; i < enemies.Count; i++)
     {
         g.DrawRectangle(new RectangleF(enemies[i].toPointF(), new SizeF(10, 10)), Color.Red);
     }
     for (int i = 0; i < bullets.Count; i++)
     {
         g.DrawRectangle(new RectangleF(bullets[i].toPointF(), new SizeF(5, 5)), Color.White);
     }
     g.DrawRectangle(new RectangleF(player.toPointF(), new SizeF(10, 10)), Color.Green);
 }
Exemplo n.º 3
0
 public void draw(GraphicsWrapper g, Panel minigamePanel, Timer minigameTimer, uint minigameTime)
 {
     g.DrawRectangle(new Rect(player, new Vector2(10, 10), true), Color.Green);
     if (lazorTime >= 0 && lazorTime <= 80)
     {
         float   m  = (float)Misc.map(0, 80, 0, minigamePanel.Height, lazorTime);
         Vector2 mp = new Vector2(lazor, m);
         g.DrawLine(mp, new Vector2(lazor, 0), Color.DarkGray, 2);
         g.DrawLine(new Vector2(lazor, minigamePanel.Height), mp, Color.Red, 2);
     }
     for (int i = 0; i < platforms.Count; i++)
     {
         g.DrawRectangle(new Rect(platforms[i], new Vector2(100, 10), true), Color.White);
     }
 }
Exemplo n.º 4
0
        public void Render(GraphicsWrapper g)
        {
            if (m_drag.Active && m_selectMode)
            {
                g.FillRectangle(tbrush, m_selectionRectangle);
                g.DrawRectangle(Pens.LightBlue, m_selectionRectangle);
            }

            var eventsRenderer = m_eventsRenderer;

            foreach (EventData o in m_selectedObjects)
            {
                Rectangle rec = eventsRenderer.GetEventRectangle(o, (int)o.TrackId * EventsRenderer.VirtualTrackheight);
                g.FillRectangle(tbrush, rec);
                g.DrawRectangle(selection_border, rec);
            }
        }
Exemplo n.º 5
0
        public override void RenderNote(GraphicsWrapper g, EventData eventData, Rectangle eventRectangle, int centerX, int centerY)
        {
            int rectangleX      = centerX - (RECTANGLE_WIDTH / 2);
            int rectangleY      = centerY - (RECTANGLE_HEIGHT / 2);
            int rectangleWidth  = RECTANGLE_WIDTH + (eventData.Duration > 6 ? eventData.VirtualDuration : 0);
            int rectangleHeight = RECTANGLE_HEIGHT;

            g.FillRectangle(CustomBrushes.NoteBackground, rectangleX, rectangleY, rectangleWidth, rectangleHeight);
            g.DrawRectangle(Pens.Black, rectangleX, rectangleY, rectangleWidth, rectangleHeight);

            string text = String.Empty;

            switch (EventDisplayMode)
            {
            case EventDisplayMode.Attribute:
                byte attribute = eventData.Attribute;
                text = String.Format("Attr {0,3:000}", attribute);
                break;

            case EventDisplayMode.Instrument:
                var instrument = eventData.Instrument;
                int insNo      = instrument != null ? instrument.InsNum : 0;
                text = String.Format("Ins {0,3:000}", insNo);
                break;

            case EventDisplayMode.Duration:
                ushort duration = eventData.Duration;
                text = String.Format("Dur {0,3:000}", duration);
                break;

            case EventDisplayMode.Pan:
                byte pan = eventData.Pan;
                text = String.Format("Pan {0,3:000}", pan);
                break;

            case EventDisplayMode.Velocity:
                byte vel = eventData.Vel;
                text = String.Format("Vel {0,3:000}", vel);
                break;
            }


            g.DrawString(text, this.m_textFont, Brushes.Black, centerX + SHADOW_DISTANCE, centerY + SHADOW_DISTANCE, _stringFormat);
            g.DrawString(text, this.m_textFont, Brushes.White, centerX, centerY, _stringFormat);
        }
Exemplo n.º 6
0
 public void draw(GraphicsWrapper g, Panel minigamePanel, Timer minigameTimer, uint minigameTime)
 {
     for (int y = 0; y < 23; ++y)
     {
         for (int x = 0; x < 10; x++)
         {
             if (grid[y, x] == 1 | droppedtetrominoeLocationGrid[y, x] == 1)
             {
                 g.DrawRectangle(new RectangleF(x * 10, y * 10, 10, 10), Color.White, false, false);
             }
         }
         g.DrawLine(new Point(0, (y + 1) * 10), new Point(10 * 10, (y + 1) * 10), Color.DarkGray, 1, false);
     }
     for (int x = 0; x < 10; x++)
     {
         g.DrawLine(new Point((x + 1) * 10, 0), new Point((x + 1) * 10, 23 * 10), Color.DarkGray, 1, false);
     }
     g.DrawSizedString("Level " + level, 10, new PointF(150, 10), Brushes.White, false);
     g.DrawSizedString("Score " + score, 10, new PointF(150, 30), Brushes.White, false);
     g.DrawSizedString("LinesCleared " + linesCleared, 10, new PointF(150, 50), Brushes.White, false);
 }
Exemplo n.º 7
0
 protected void DrawRectangle(GraphicsWrapper g, Pen pen, int x, int y, int width, int height)
 {
     g.DrawRectangle(pen, x, y, width, height);
 }
Exemplo n.º 8
0
 public void gameTick(GraphicsWrapper g, Panel minigamePanel, Timer minigameTimer, uint minigameTime)
 {
     try
     {
         Random random = new Random();
         speed      = Math.Min(minigameTime / 200d, 2) + 0.5;
         lazorTime -= Math.Min(minigameTime / 800, 2.5) + 0.5;
         if (lazorTime <= 0)
         {
             g.DrawRectangle(new RectangleF((float)lazor, minigamePanel.Height / 2, 10, minigamePanel.Height), Color.Red);
             if (lazorTime <= -2)
             {
                 lazorTime = 100;
                 lazor     = player.X;
             }
             else
             {
                 if (player.X > lazor - 10 && player.X < lazor + 10)
                 {
                     throw new Exception("The VM was shut down to prevent damage to your Machine.", new Exception("0717750f-3508-4bc2-841e-f3b077c676fe"));
                 }
             }
         }
         player.Y -= speed;
         for (int i = 0; i < platforms.Count; i++)
         {
             platforms[i].Y -= speed;
             if (platforms[i].Y < 0)
             {
                 platforms[i].Y = minigamePanel.Height;
                 platforms[i].X = rnd.Next(minigamePanel.Width);
             }
         }
         double movementFactor;
         if (wasOnPlatform)
         {
             movementFactor = 2;
             playerV.X     *= 0.7;
             playerV.Y      = Math.Max(playerV.Y, 0);
         }
         else
         {
             movementFactor = 5;
             playerV.X     *= 0.9;
             playerV.Y     -= 1;
         }
         if (Input.Up)
         {
             if (wasOnPlatform || jmpj > 0)
             {
                 playerV.Y += jmpj / 6d + 1.5;
                 jmpj--;
             }
         }
         else
         {
             if (wasOnPlatform)
             {
                 jmpj = 10;
             }
             else
             {
                 jmpj = 0;
             }
         }
         jmpj = Math.Max(0, jmpj);
         if (Input.Left)
         {
             playerV.X -= movementFactor;
         }
         if (Input.Right)
         {
             playerV.X += movementFactor;
         }
         player.X += playerV.X;
         if (playerV.Y > 0)
         {
             player.Y += playerV.Y;
         }
         else
         {
             for (int i = 0; i < (-playerV.Y) / 2; i++)
             {
                 if (onPlatform)
                 {
                     break;
                 }
                 player.Y -= 2;
             }
         }
         if (player.Y < 0)
         {
             throw new Exception("The VM was shut down to prevent damage to your Machine.", new Exception("0717750f-3508-4bc2-841e-f3b077c676fe"));
         }
         wasOnPlatform = onPlatform;
     }
     catch (Exception ex) { if (ex.InnerException?.Message == "0717750f-3508-4bc2-841e-f3b077c676fe")
                            {
                                Misc.closeGameWindow.Invoke();
                            }
                            else
                            {
                                Console.WriteLine(ex.ToString());
                            } }
 }