コード例 #1
0
 public GameMenu(GamePrototype gameParent) : base(gameParent)
 {
     TextRectangle                    = new Rectangle(168, 12, 218, 69);
     RectangleOfContentDrawing        = new Rectangle(100, 155, 350, 475);
     RectangleOfContentAfterResizeing = false;
     BkgColor = Color.White;
 }
コード例 #2
0
 private static Effect GetGlowingEffect(GamePrototype game)
 {
     if (_glowingEffect is null)
     {
         _glowingEffect = game.Content.Load <Effect>("Effects/UI.GlowingEffect");
     }
     return(_glowingEffect);
 }
コード例 #3
0
ファイル: Panel.cs プロジェクト: osherz/OZ.MonoGame
 public Panel(GamePrototype gameParent) : base(gameParent)
 {
     LookingChanged += (sender, e) =>
     {
         if (_toMiddleXAfterLayoutResume)
         {
             InnerToMiddleX();
             _toMiddleXAfterLayoutResume = false;
         }
     };
 }
コード例 #4
0
        public DrawScoreBars(GamePrototype gameParent) : base(gameParent)
        {
            BkgTransparent     = true;
            _scoreBarApearance = new ControlApearance();

            Player1ScoreBar = new ScoreBar(gameParent)
            {
                IsLeft           = true,
                ControlApearance = _scoreBarApearance
            };
            Player2ScoreBar = new ScoreBar(gameParent)
            {
                IsLeft           = false,
                SpriteEffect     = SpriteEffects.FlipHorizontally,
                ControlApearance = _scoreBarApearance
            };


            Controls.AddRange(Player1ScoreBar, Player2ScoreBar);
        }
コード例 #5
0
        /// <summary>
        /// Using GamePrototype.SpriteBatch and GamePrototype.GraphicsDevice.
        /// Do not use between SpriteBatch.Begin and SpriteBatch.End.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="texture"></param>
        /// <param name=""></param>
        /// <param name="effect"></param>
        /// <returns></returns>
        public static Texture2D ActiveEffectOnTexture(this Texture2D texture, GamePrototype game, Effect effect)
        {
            var graphicsDevice = game.GraphicsDevice;

            int width  = texture.Width;
            int height = texture.Height;

            RenderTarget2D effectedTexture = new RenderTarget2D(
                graphicsDevice,
                graphicsDevice.PresentationParameters.BackBufferWidth,
                graphicsDevice.PresentationParameters.BackBufferHeight,
                false,
                graphicsDevice.PresentationParameters.BackBufferFormat,
                DepthFormat.Depth24);

            graphicsDevice.SetRenderTarget(effectedTexture);
            graphicsDevice.DepthStencilState = new DepthStencilState()
            {
                DepthBufferEnable = true
            };

            // Draw the scene
            var spriteBatch = game.SpriteBatch;

            graphicsDevice.Clear(Color.Transparent);
            spriteBatch.Begin(SpriteSortMode.Deferred,
                              null,
                              null,
                              null,
                              null,
                              effect,
                              null);
            spriteBatch.Draw(texture, Vector2.Zero, Color.White);
            spriteBatch.End();
            Texture2D newTexture = effectedTexture;

            // Drop the render target
            graphicsDevice.SetRenderTarget(null);

            return(newTexture);
        }
コード例 #6
0
        public LevelsMenu(GamePrototype gameParent, int levels) : base(gameParent)
        {
            Text = "Choose Level";

            _buttons = new MenuButton[levels];
        }
コード例 #7
0
 public MainMenu(GamePrototype gameParent) : base(gameParent)
 {
     Text = "Main Menu";
 }
コード例 #8
0
 public GameTextBox(GamePrototype gameParent) : base(gameParent)
 {
     Size = new Vector2(200, 50) * 1.6f;
 }
コード例 #9
0
ファイル: TextBox.cs プロジェクト: osherz/OZ.MonoGame
 public TextBox(GamePrototype gameParent) : base(gameParent)
 {
     BkgTransparent = false;
 }
コード例 #10
0
 public MathCardDraw(GamePrototype gameParent, MathCard mathCard) : base(gameParent)
 {
     Card = mathCard;
 }
コード例 #11
0
 public ScoreLabel(GamePrototype gameParent) : base(gameParent)
 {
 }
コード例 #12
0
 public ChangeApearanceRelativeMouseControl(GamePrototype gameParent) : base(gameParent)
 {
 }
コード例 #13
0
        public static Texture2D GlowingTexture(this Texture2D texture, GamePrototype game)
        {
            Effect glowingEffect = GetGlowingEffect(game);

            return(ActiveEffectOnTexture(texture, game, glowingEffect));
        }
コード例 #14
0
        public static Texture2D DarkingTexture(this Texture2D texture, GamePrototype game)
        {
            Effect darkingEffect = GetDarkingEffect(game);

            return(ActiveEffectOnTexture(texture, game, darkingEffect));
        }
コード例 #15
0
ファイル: UIObject.cs プロジェクト: osherz/OZ.MonoGame
 public UIObject(GamePrototype gameParent)
 {
     GameParent = gameParent;
 }
コード例 #16
0
 public ControlsCollection(GamePrototype gameParent)
 {
     GameParent = gameParent;
     _controls  = new List <Control>();
 }
コード例 #17
0
 public Button(GamePrototype gameParent) : base(gameParent)
 {
     BkgTransparent = false;
     TextAnchor     = Anchor.Center | Anchor.Middle;
 }
コード例 #18
0
 public NumCardDraw(GamePrototype gameParent, float result) : base(gameParent)
 {
     Card = new NumCard(result);
 }
コード例 #19
0
 public MenuButton(GamePrototype gameParent) : base(gameParent)
 {
     Size           = new Vector2(200, 50) * 1.6f;
     BkgTransparent = false;
 }