コード例 #1
0
ファイル: Team.cs プロジェクト: matttheawesome1/Battle-Reign
        public void DrawGUI(SpriteBatch sb)
        {
            int padding = 10, height = padding * 5, offset = 3;

            sb.Draw(Spritesheet, Camera.Position + new Vector2(padding - 7, padding - 3), new Rectangle(new Point((SpritesheetSize.X - 3) * Cell, 0), new Point(3 * Cell, 2 * Cell)), Color, 0, Vector2.Zero, 4, SpriteEffects.None, GUILayer);
            sb.Draw(Spritesheet, Camera.Position + new Vector2(padding - 7, padding - 3), new Rectangle(new Point((SpritesheetSize.X - 3) * Cell, 4 * Cell), new Point(3 * Cell, 2 * Cell)), Color.White, 0, Vector2.Zero, 4, SpriteEffects.None, GUILayer);

            //ExitButton.Position = new Vector2(Graphics.PreferredBackBufferWidth - padding - ExitButton.Background.Width, height + padding);
            ExitButton.Draw(sb);

            //STATS
            StatList.StatList.ForEach(x => x.Draw(sb));

            //TIMER
            sb.DrawString(FontSmall, ((int)(TurnTime - Time)).ToString(), Camera.Position + new Vector2(Graphics.PreferredBackBufferWidth - padding - FontSmall.MeasureString(((int)(TurnTime - Time)).ToString()).X - offset * 2, padding + offset), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, GUILayer);

            //ADD CARD BUTTON
            AddCardButton.Draw(sb);

            //CARDS
            Cards.ForEach(x => x.Draw(sb));

            if (HoveringCard != null)
            {
                HoveringCard.Draw(sb);
            }
        }
コード例 #2
0
 public void Draw(SpriteBatch sprite, SpriteFont font)
 {
     sprite.Draw(BackGround, new Rectangle(0, 0, 800, 480), Color.White);
     PlayButton.Draw(sprite, font);
     NewPartyButton.Draw(sprite, font);
     ShopButton.Draw(sprite, font);
     ChoosePartyButton.Draw(sprite, font);
     ExitButton.Draw(sprite, font);
 }
コード例 #3
0
ファイル: GameEngine.cs プロジェクト: Team-Utapau/OOP-Project
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            // sewers map needs blendstate to look correct with alphas
            if (mapIdx == 8)
            {
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
            }
            else
            {
                spriteBatch.Begin();
            }

            if (mapIdx == 10)
            {
                DrawLayersInOrder(maps[mapIdx], spriteBatch, mapView);
            }
            else
            {
                maps[mapIdx].Draw(spriteBatch, mapView);

                // draw object layers test
                for (int ol = 0; ol < maps[mapIdx].ObjectLayers.Count; ol++)
                {
                    maps[mapIdx].DrawObjectLayer(spriteBatch, ol, mapView, 0);
                }

                // draw image layers test
                for (int il = 0; il < maps[mapIdx].ImageLayers.Count; il++)
                {
                    maps[mapIdx].DrawImageLayer(spriteBatch, il, mapView, 0);
                }
            }


            spriteBatch.End();
            spriteBatch.Begin();
            creature.Draww(spriteBatch, mapView.X, mapView.Y);
            player.Draw(spriteBatch);
            creature.Draw(spriteBatch);
            spriteBatch.End();
            spriteBatch.Begin();
            exitButton.Draw(spriteBatch);
            spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #4
0
        public void Draw(SpriteBatch spriteBatch, Vector2 position)
        {
            Vector2 offsets     = offset + position;
            Vector2 offsetIcons = offsets + offsetIcon;

            background.Draw(spriteBatch, offsets, 0.8f);

            imgLine.Draw(spriteBatch, new Vector2(114, 6) + offsets, 0.81f);
            imgHCBackdrop.Draw(spriteBatch, new Vector2(61, 2) + offsets, 0.81f);

            DiamondIcon.Draw(spriteBatch, new Vector2(0, 0) + offsetIcons, 0.81f);
            CreditIcon.Draw(spriteBatch, new Vector2(0, 19) + offsetIcons, 0.81f);
            DucketIcon.Draw(spriteBatch, new Vector2(0, 38) + offsetIcons, 0.81f);
            HCIcon.Draw(spriteBatch, new Vector2(78, 13) + offsets, 0.81f);

            HelpButton.Draw(spriteBatch, new Vector2(120, 3) + offsets, 0.81f);
            ExitButton.Draw(spriteBatch, new Vector2(120, 24) + offsets, 0.81f);
            SettingsButton.Draw(spriteBatch, new Vector2(120, 45) + offsets, 0.81f);

            txtDiamond.Draw(spriteBatch, offsets + new Vector2(38 - txtDiamond.measureString().X, 6));
            txtCredit.Draw(spriteBatch, offsets + new Vector2(38 - txtCredit.measureString().X, 24));
            txtDucket.Draw(spriteBatch, offsets + new Vector2(38 - txtDucket.measureString().X, 44));
            //100 = HC Text
        }
コード例 #5
0
ファイル: Game.cs プロジェクト: GAM-4-5/SpaceRTS
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.AliceBlue);

            var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            _frameCounter.Update(deltaTime);

            var fps = string.Format("FPS: {0}", _frameCounter.AverageFramesPerSecond);


            if (GameSteate == GameSteates.MainMenu)
            {
                Shaders.MainMenu.Parameters["time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds);

                //_planetRenderTarget = new RenderTarget2D(GraphicsDevice, (int)(GraphicsDevice.Viewport.Width * 0.625f + 1), GraphicsDevice.Viewport.Height / 2, false, SurfaceFormat.Color, DepthFormat.None);
                spriteBatch.GraphicsDevice.SetRenderTarget(_planetRenderTarget);
                spriteBatch.GraphicsDevice.Clear(new Color(0, 0, 0, 0));

                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, Shaders.MainMenu);

                spriteBatch.Draw(_planetRenderTarget, new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White);
                //_mainMenuEffect.CurrentTechnique.Passes[0].Apply();

                spriteBatch.End();


                if (PlayButtonClicked)
                {
                    Shaders.BlackHoleTransition.Parameters["time"].SetValue((float)(TimePlayClicked - gameTime.TotalGameTime.TotalSeconds));
                    Shaders.BlackHoleTransition.Parameters["resolution"].SetValue(new Vector2(_planetRenderTarget.Width, _planetRenderTarget.Height));

                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, Shaders.BlackHoleTransition);
                    spriteBatch.Draw(_planetRenderTarget, new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White);
                    spriteBatch.End();
                }


                spriteBatch.GraphicsDevice.SetRenderTarget(null);
                spriteBatch.GraphicsDevice.Clear(Color.Black);

                spriteBatch.Begin();

                spriteBatch.Draw(_planetRenderTarget, new Vector2(0, 0), new Rectangle(0, 0, _planetRenderTarget.Width, _planetRenderTarget.Height), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);

                PlayButton.Draw(graphics, spriteBatch);
                SettingsButton.Draw(graphics, spriteBatch);
                ExitButton.Draw(graphics, spriteBatch);

                spriteBatch.DrawString(Space.spriteFont, fps, new Vector2(50, 50), Color.White);

                spriteBatch.End();


                /*spriteBatch.Begin(
                *   rasterizerState: RasterizerState.CullNone,
                *   effect: _mainMenuEffect
                *  );
                *
                *
                *
                *  PlayButton.Draw(graphics, spriteBatch);
                *
                *
                *
                *  PlayButton.Draw(graphics, spriteBatch);
                *
                *  spriteBatch.End();*/
                /*
                 *
                 * spriteBatch.Begin();
                 * PlayButton.Draw(graphics, spriteBatch);
                 * spriteBatch.Draw(testTexture, new Vector2(50, 50), Color.White);
                 * spriteBatch.End();*/
            }
            else if (GameSteate == GameSteates.Settings)
            {
            }
            else if (GameSteate == GameSteates.Lobby)
            {
            }
            else if (GameSteate == GameSteates.Game)
            {
                spriteBatch.Begin(transformMatrix: Global.Camera.ProjectionMatrix);
                //spriteBatch.Begin();
                Space.Draw(spriteBatch, graphics, Global.Camera);
                spriteBatch.End();

                DrawModel(Cube, Vector3.Zero);
            }

            base.Draw(gameTime);
        }