コード例 #1
0
ファイル: InstructionScreen.cs プロジェクト: thomeval/wgibeat
 public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     _background.Draw(gameTime);
     _baseSprite.Draw();
     _instructionPages[PageNumber - 1].Draw();
     DrawBeatline(gameTime);
     FontManager.DrawString("Press start to continue.", "LargeFont", Core.Metrics["LoadMessage", 0], Color.White, FontAlign.Left);
     FontManager.DrawString(String.Format("Page {0} of {1}", PageNumber, TOTAL_PAGES), "DefaultFont", Core.Metrics["LoadErrorCount", 0], Color.White, FontAlign.Left);
 }
コード例 #2
0
    public void Run()
    {
        const int      NUM_ENEMIES = 4;
        ConsoleKeyInfo userkey;

        Spaceship        ship = new Spaceship();
        MovingBackground back = new MovingBackground();
        Scoreboard       sb   = new Scoreboard();

        Enemy[] enemies = new Enemy[NUM_ENEMIES];
        enemies[0] = new EnemyLevel1();
        enemies[1] = new EnemyLevel2();
        enemies[2] = new EnemyLevel3();
        enemies[3] = new EnemyLevel4();
        Mothership ms    = new Mothership();
        PlayerShot shot1 = new PlayerShot(20, 10);
        EnemyShot  shot2 = new EnemyShot(15, 1);

        while (true)
        {
            // Update elements position and appearance
            back.Update();
            ms.Update();
            ship.Update();
            foreach (Enemy e in enemies)
            {
                e.Update();
            }
            shot1.Update();
            shot2.Update();

            // Screen update
            Console.Clear();
            back.Draw();
            sb.Draw();
            ms.Draw();
            ship.Draw();
            foreach (Enemy e in enemies)
            {
                e.Draw();
            }
            shot1.Draw();
            shot2.Draw();

            // Get user input
            userkey = Console.ReadKey(true);
            switch (userkey.Key)
            {
            case ConsoleKey.A: ship.MoveLeft(); break;

            case ConsoleKey.D: ship.MoveRight(); break;

            case ConsoleKey.Escape: return;
            }
        }
    }
コード例 #3
0
ファイル: MainMenu.cs プロジェクト: jkapi/Kakoi
 public override void Draw()
 {
     View.Scale = new Vector2(Graphics.PreferredBackBufferHeight / 1080f);
     MovingBackground.Draw(this);
     View.DrawTexture(MenuMulti, new Vector2(mainmenubuttonpos.X + offsetMulti, mainmenubuttonpos.Y) + offsetMain);
     View.DrawTexture(MenuSolo, new Vector2(mainmenubuttonpos.X + offsetSolo, mainmenubuttonpos.Y + mainmenubuttonspacing) + offsetMain);
     View.DrawTexture(MenuSettings, new Vector2(mainmenubuttonpos.X + offsetSettings, mainmenubuttonpos.Y + 2 * mainmenubuttonspacing) + offsetMain);
     View.DrawTexture(MenuQuit, new Vector2(mainmenubuttonpos.X + offsetQuit, mainmenubuttonpos.Y + 3 * mainmenubuttonspacing) + offsetMain);
     //View.DrawTexture(StrangerCadeLogo, new Vector2(1920 - StrangerCadeLogo.Width, 1080 - StrangerCadeLogo.Height) + offsetMain);
     View.DrawTexture(KakoiLogo, new Vector2(800, 540) + offsetMain, null, 0, KakoiLogo.Bounds.Center.ToVector2());
     View.DrawRectangle(offsetMenuSettings, new Vector2(440, 1080), false, new Color(Color.Black, 0.3f));
     View.DrawText(OpenSans, "There are no settings yet.", new Vector2(220 - OpenSans.MeasureString("There are no settings yet.").X / 2, 20) + offsetMenuSettings, Color.White);
 }
コード例 #4
0
ファイル: Room1.cs プロジェクト: jkapi/Kakoi
        public override void Draw()
        {
            var players = SocketHandler.GetPlayers();

            MovingBackground.Draw(this);
            View.DrawRectangle(new Rectangle(600, 32, 640, 640), false, new Color(240, 240, 240));

            View.DrawSprite(Chips, 0, new Vector2(32, 32) + _vector64, null, Rotations[0], _vector64);
            View.DrawSprite(Chips, 1, new Vector2(32, 192) + _vector64, null, Rotations[1], _vector64);
            View.DrawSprite(Chips, 2, new Vector2(32, 352) + _vector64, null, Rotations[2], _vector64);
            View.DrawSprite(Chips, 3, new Vector2(32, 512) + _vector64, null, Rotations[3], _vector64);

            View.DrawSpriteStretched(Heads, 3, new Vector2(76, 76), new Vector2(40));
            View.DrawSpriteStretched(Heads, 0, new Vector2(76, 76 + 160), new Vector2(40));
            View.DrawSpriteStretched(Heads, 1, new Vector2(76, 76 + 320), new Vector2(40));
            View.DrawSpriteStretched(Heads, 2, new Vector2(76, 76 + 480), new Vector2(40));

            try
            {
                DrawTextOutlined(Arial24, players[0].Name, new Vector2(180, 96), Color.White, Color.Black);
                if (players.Count > 1)
                {
                    DrawTextOutlined(Arial24, players[1].Name, new Vector2(180, 256), Color.White, Color.Black);
                }
                if (players.Count > 2)
                {
                    DrawTextOutlined(Arial24, players[2].Name, new Vector2(180, 416), Color.White, Color.Black);
                }
                if (players.Count > 3)
                {
                    DrawTextOutlined(Arial24, players[3].Name, new Vector2(180, 576), Color.White, Color.Black);
                }
            }
            catch
            {
                // This isn't really something to worry about, can be caused because of a breakpoint in the tick function of the server
            }
            Vector2 MouseMovement = Mouse.AverageMovement();

            if (Math.Abs(Mouse.LastMovement.X + Mouse.LastMovement.Y) > 0.1)
            {
                if (Math.Abs(MouseMovement.X + MouseMovement.Y) > 0)
                {
                    MouseAngle = (float)Math.Atan2(MouseMovement.Y, MouseMovement.X);
                }
            }
            View.RotationMode = View.RotationType.Radians;
            View.DrawRectangle(Mouse.Position, new Vector2(20), rotation: MouseAngle + (float)Math.PI);
            View.RotationMode = View.RotationType.Degrees;
        }
コード例 #5
0
ファイル: LoginMenu.cs プロジェクト: jkapi/Kakoi
        public override void Draw()
        {
            MovingBackground.Draw(this);
            View.DrawTexture(Logo, new Vector2(960 - Logo.Width / 2, 75));

            if (registerpage)
            {
                View.DrawRectangle(new Rectangle(770, 570, 380, 220), false, new Color(255, 225, 177));
            }
            else
            {
                View.DrawRectangle(new Rectangle(770, 570, 380, 220), false, new Color(177, 245, 249));
            }

            View.DrawRectangle(new Rectangle(770, 570, 190, 60), false, new Color(177, 245, 249));
            View.DrawRectangle(new Rectangle(960, 570, 190, 60), false, new Color(255, 225, 177));
            View.DrawText(Arial24, "Login", new Vector2(860, 600), Color.Black, 0, Arial24.MeasureString("Login") / 2);
            View.DrawText(Arial24, "Register", new Vector2(1060, 600), Color.Black, 0, Arial24.MeasureString("Register") / 2);
            View.DrawTexture(StrangerCadeLogo, new Vector2(1900 - StrangerCadeLogo.Width, 1070 - StrangerCadeLogo.Height));
        }
コード例 #6
0
ファイル: RoomMenu.cs プロジェクト: jkapi/Kakoi
        public override void Draw()
        {
            View.SwitchToRenderTarget(roomListRenderTarget, true, Color.Transparent);
            if (SocketHandler.Connected)
            {
                lock (ListLock)
                {
                    int i = 0;
                    foreach (Room room in Rooms)
                    {
                        string owner = room.Players.Count > 0 ? room.Players[0] : "Server";
                        DrawRoom(new Vector2(255, ListYOffset + 60 + i * 112), room.Name, room.Players.Count, owner, room.Locked, room.ID);
                        i++;
                    }
                }
            }
            else
            {
                View.DrawText(Arial24, "You are not connected to the server.", new Vector2(960 - Arial24.MeasureString("You are not connected to the server.").X / 2, 200), Color.LightGray);
            }
            View.SwitchToRenderTarget(r3d);
            MovingBackground.Draw(this);

            View.DrawRectangle(new Rectangle(0, 140, 1920, 1080), false, new Color(Color.Black, 0.1f));

            View.DrawTexture(Logo, new Vector2(20, 20), new Vector2(0.33f, 0.33f));

            DrawPlaceholderRadioBox(new Vector2(600, 90), "Show Friends");
            DrawPlaceholderRadioBox(new Vector2(800, 90), "Show Private");
            DrawPlaceholderRadioBox(new Vector2(1000, 90), "Show Full");
            View.DrawRenderTarget(roomListRenderTarget, new Vector2(0, 140));
            View.SwitchToRenderTarget(null);
            d3d.Begin();
            d3d.DrawTexture((Texture2D)r3d, Matrix.CreateFromYawPitchRoll(-0.4f, 0, 0));
            d3d.End();
        }
コード例 #7
0
ファイル: MultiRandomGame.cs プロジェクト: jkapi/Kakoi
 public override void Draw()
 {
     MovingBackground.Draw(this);
 }