示例#1
0
        public void Draw(RenderTexture2D target)
        {
            Raylib.BeginDrawing();
            {
                Raylib.BeginTextureMode(target);

                Raylib.ClearBackground(new Color(36, 36, 36, 255));

                Raylib.DrawTextEx(
                    font, MoonVars.Name,
                    new Vector2(
                        Text.Center(MoonVars.RenderWidth, (int)textMeasure.X),
                        MoonVars.RenderHeight / 4
                        ),
                    fontSize, 1, new Color(196, 196, 196, 255)
                    );

                Raylib.DrawTextEx(
                    instructFont, "Press Enter to Start",
                    new Vector2(
                        Text.Center(MoonVars.RenderWidth, (int)instructMeasure.X),
                        MoonVars.RenderHeight / 4 * 3
                        ),
                    instructFontSize, 1, Color.DARKBLUE
                    );

                stars.Draw();

                Raylib.EndTextureMode();
            }
            Raylib.EndDrawing();
        }
    /// <summary>
    ///  Main Game Loop
    ///  Zeichnet alles was auf der Konsole angezeigt werden soll,
    ///  solange man nicht abgebrochen oder verloren hat
    /// </summary>
    private void Draw()
    {
        // Game Loop
        while (!gameOver && !abbruch)
        {
            gr.ClearBuffer();

            GetKeyInput();
            powerups.SpawnPowerup();

            stars.MoveStars(kryptonite.listPoints);
            kryptonite.MoveKryptonite(stars.listPoints);

            DrawBorder();
            DrawUI();
            DrawLegend();

            stars.Draw();
            kryptonite.Draw();
            powerups.Draw();
            superman.Draw();

            CheckIntersection();

            gr.DrawBufferToConsole();
            Thread.Sleep((int)(1000 / FPS));
        }

        // Nur Game Over Screen zeigen, wenn nicht abgebrochen wurde
        if (gameOver)
        {
            // Spiel vorbei (Egal ob verloren oder gewonnen, selber Screen)
            GameOverScreen();
        }
    }
示例#3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            sky.Draw(spriteBatch);
            stars.Draw(spriteBatch);
            moon.Draw(spriteBatch);
            sun.Draw(spriteBatch);

            clouds.Draw(spriteBatch);
        }
示例#4
0
 public static void Draw(RenderTarget window)
 {
     Stars.Draw(window);
     DrawEnemies(window);
     DrawEnemyProjectiles(window);
     DrawHeroProjectiles(window);
     hero.Draw(window);
     system.Draw(window, RenderStates.Default);
     Camera.Update(window, hero.Pos);
     //DrawText(window);
 }
示例#5
0
        public Form1()
        {
            InitializeComponent();

            g = this.CreateGraphics();

            blue   = new SolidBrush(Color.Blue);
            yellow = new SolidBrush(Color.Yellow);
            red    = new SolidBrush(Color.Red);
            white  = new SolidBrush(Color.White);
            green  = new SolidBrush(Color.Green);

            timer1.Enabled  = true;
            timer1.Interval = 10;
            timer2.Enabled  = true;
            timer2.Interval = 1;
            timer2.Enabled  = false;
            timer2.Interval = 1000;
            //draw.Space(0, 0, this.Width, this.Height);


            // ship = new SpaceShip(492, 325);
            star.Draw(x1 - 450, y1 - 190);
            star.Draw(x1 - 100, y1 - 240);
            star.Draw(x1 + 150, y1 - 200);
            star.Draw(x1 + 380, y1 - 25);
            star.Draw(x1 + 270, y1 + 100);
            star.Draw(x1 + 364, y1 + 270);
            star.Draw(x1 - 120, y1 + 200);
            star.Draw(x1 - 430, y1 + 210);


            bul = new Bullet();

            gun = new Gun(432, 325);

            asters.Draw(180, 200);
            asters.Draw(220, 450);
            asters.Draw(800, 170);
            asters.Draw(610, 510);


            label1.Text = "Level: 1 Score: 200  Live: ***";
        }
示例#6
0
        public void Draw(RenderTexture2D target)
        {
            Raylib.BeginDrawing();
            {
                Raylib.BeginTextureMode(target);

                Raylib.ClearBackground(bgColor);

                stars.Draw();

                Raylib.DrawTextEx(font, "nehpe",
                                  new Vector2(
                                      Text.Center(MoonVars.RenderWidth, (int)textMeasure.X),
                                      Text.Center(MoonVars.RenderHeight, (int)textMeasure.Y)
                                      ),
                                  fontSize, 1, fgColor);

                Raylib.EndTextureMode();
            }
            Raylib.EndDrawing();
        }