Example #1
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // there is no such thing as a selected item on Windows Phone, so we always
            // force isSelected to be false
#if WINDOWS_PHONE
            isSelected = false;
#endif

            // Draw the selected entry in yellow, otherwise white.
            Color color = isSelected ? Color.Yellow : Color.White;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Modify the alpha to fade text out during transitions.
            color *= screen.TransitionAlpha;

            // Draw text, centered on the middle of each line.
            ScreenManager.ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont  font        = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
Example #2
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public virtual void Draw(MenuScreen screen, GameTime gameTime)
        {
            // Draw the selected entry in yellow, otherwise white.
            Color color = Color.White;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * _selectionFade;

            // Modify the alpha to fade text out during transitions.
            color *= screen.TransitionAlpha;

            // Draw text, centered on the middle of each line.
            ScreenManager.ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont  font        = screenManager.SpriteFonts.MenuSpriteFont;

            var origin = new Vector2(0, font.LineSpacing / 2f);

            spriteBatch.DrawString(font, _text, _position, color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
Example #3
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager.ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);

            // If this is going to be a slow load operation, create a background
            // thread that will update the network session and draw the load screen
            // animation while the load is taking place.
            if (loadingIsSlow)
            {
                backgroundThread     = new Thread(BackgroundWorkerThread);
                backgroundThreadExit = new ManualResetEvent(false);

                graphicsDevice = screenManager.GraphicsDevice;

                // Look up some services that will be used by the background thread.
                IServiceProvider services = screenManager.Game.Services;

                messageDisplay = (IMessageDisplay)services.GetService(
                    typeof(IMessageDisplay));
            }
        }
Example #4
0
        /// <summary>
        /// Draws the menu entry. This can be overridden to customize the appearance.
        /// </summary>
        public virtual void Draw(MenuScreen screen, Vector2 position,
                                 bool isSelected, GameTime gameTime)
        {
            // Draw the selected entry in Gold, otherwise White.
            Color color = isSelected ? Color.Gold : Color.White;

            // Pulsate the size of the selected menu entry.
            double time = gameTime.TotalGameTime.TotalSeconds;

            float pulsate = (float)Math.Sin(time * 6) + 1;

            float scale = 1 + pulsate * 0.05f * selectionFade;

            // Modify the alpha to fade text out during transitions.
            color = new Color(color.R, color.G, color.B, screen.TransitionAlpha);

            // Draw text, centered on the middle of each line.
            ScreenManager.ScreenManager screenManager = screen.ScreenManager;
            SpriteBatch spriteBatch = screenManager.SpriteBatch;
            SpriteFont  font        = screenManager.Font;

            Vector2 origin = new Vector2(0, font.LineSpacing / 2);

            spriteBatch.DrawString(font, text, position, color, 0,
                                   origin, scale, SpriteEffects.None, 0);
        }
Example #5
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager.ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Example #6
0
 /// <summary>
 /// </summary>
 /// <param name = "screenManager"></param>
 public FrameRateCounter(ScreenManager.ScreenManager screenManager) : base(screenManager.Game)
 {
     _screenManager = screenManager;
     _format        = new NumberFormatInfo {
         NumberDecimalSeparator = "."
     };
     _position = new Vector2(30, 25);
 }
 public Goblin(ScreenManager.ScreenManager screenManager)
     : this(null, 1, "goblin-1")
 {
     this.screenManagerController = screenManager;
     izq = false;
     this.Velocidad = 2;
     attackDelayTutorial = 0f;
     attackDelayMaxTutorial = 500f;
 }
Example #8
0
        public GravitySensorManager(World world,
            DebugViewXNA debugViewXNA,
            ContentManager content,
            GraphicsDeviceManager graphics,
            ScreenManager.ScreenManager screenManager)
        {
            this.mWorld = world;
            this.mDebugViewXNA = debugViewXNA;
            this.mContentManager = content;
            this.mGraphicsManager = graphics;
            this.mScreenManager = screenManager;

            this.mEffectCollection.Add("one", this.mContentManager.Load<ParticleEffect>(@"Effects\portalOne"));
            this.mEffectCollection.Add("two", this.mContentManager.Load<ParticleEffect>(@"Effects\portalPurple"));
        }
        public BlackJackGame()
        {
            graphics              = new GraphicsDeviceManager(this);
            screenManager         = new ScreenManager.ScreenManager(this);
            Content.RootDirectory = "Content";

            screenManager.AddScreen(new Screens.BackGround(), null);
            screenManager.AddScreen(new Screens.MainMenuScreen(), null); //falta

            Components.Add(screenManager);
#if WINDOWS || MACOS || LINUX
            IsMouseVisible = true;
#endif
            _21BlackJack.Misc.AudioManager.Initialize(this);
        }
Example #10
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager.ScreenManager screenManager, bool loadingIsSlow,
                                PlayerIndex?controllingPlayer,
                                params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
            {
                screen.ExitScreen();
            }

            // Create and activate the loading screen.
            var loadingScreen = new LoadingScreen(loadingIsSlow,
                                                  screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
Example #11
0
 public Player(World world,
     DebugViewXNA debugViewXNA,
     ContentManager content,
     GraphicsDeviceManager graphics,
     ScreenManager.ScreenManager screenManager,
     PlayerIndex playerIndex,
     Vector2 position)
 {
     this.mWorld = world;
     this.mDebugViewXNA = debugViewXNA;
     this.mContent = content;
     this.mGraphics = graphics;
     this.mScreenManager = screenManager;
     this.mPlayerIndex = playerIndex;
     this.mPaddlePosition = position;
 }
Example #12
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager.ScreenManager screenManager,
                                EventHandler <EventArgs> loadNextScreen,
                                bool loadingIsSlow)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
            {
                screen.ExitScreen();
            }

            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen();

            loadingScreen.loadingIsSlow  = loadingIsSlow;
            loadingScreen.loadNextScreen = loadNextScreen;

            screenManager.AddScreen(loadingScreen);
        }
Example #13
0
        public PongGame()
        {
            mGraphics = new GraphicsDeviceManager(this);

            Content.RootDirectory = "Content";

            mGraphics.PreferredBackBufferWidth = 1280; //1280×720
            mGraphics.PreferredBackBufferHeight = 720;

            Services.AddService(typeof(GraphicsDeviceManager), mGraphics);

            Services.AddService(typeof(ContentManager), Content);

            // Create the screen manager component.
            mScreenManager = new ScreenManager.ScreenManager(this);
            Components.Add(mScreenManager);

            // Activate the first screens.
            mScreenManager.AddScreen(new BackgroundScreen(), null);
            mScreenManager.AddScreen(new MainMenuScreen(), null);
        }
 public Pinchos(ScreenManager.ScreenManager screenManager)
     : this(null, "pinchos-1")
 {
     this.screenManagerController = screenManager;
 }
 public Sonido(ScreenManager.ScreenManager ScreenManager)
 {
     ScreenManagerController = ScreenManager;
     Creado = true;
 }