public FPSCounter(BaseGame setGame, string fontName)
     : base(setGame)
 {
     font = setGame.Content.Load<SpriteFont>(fontName);
     int W = setGame.GraphicsDevice.Viewport.Width;
     int H = setGame.GraphicsDevice.Viewport.Height;
     fps = new StringToDraw(setGame, "FPS=", new Vector2((W - 100.0f) / (float)W, 5.0f / (float)H), font);
 }
Example #2
0
        public FPSCounter(BaseGame setGame, string fontName)
            : base(setGame)
        {
            font = setGame.Content.Load <SpriteFont>(fontName);
            int W = setGame.GraphicsDevice.Viewport.Width;
            int H = setGame.GraphicsDevice.Viewport.Height;

            fps = new StringToDraw(setGame, "FPS=", new Vector2((W - 100.0f) / (float)W, 5.0f / (float)H), font);
        }
Example #3
0
        private void Init(int nLives, int nBombs)
        {
            int W = Game.GraphicsDeviceManager.PreferredBackBufferWidth;
            int H = Game.GraphicsDeviceManager.PreferredBackBufferHeight;

            livesString = new StringToDraw(Game, "Lives: " + nLives,
                new Vector2((float)5.0f / W, (float)(H - 25.0f) / H), Game.Content.Load<SpriteFont>("GeomCloneFont"));
            scoreString = new StringToDraw(Game, "Score: 0",
                new Vector2((float)5.0f / W, (float)5.0f / H), Game.Content.Load<SpriteFont>("GeomCloneFont"));
            bombsString = new StringToDraw(Game, "Bombs: " + nBombs,
                new Vector2((float)5.0f / W, (float)(H - 50.0f) / H), Game.Content.Load<SpriteFont>("GeomCloneFont"));

            numberOfLives = nLives;
            numberOfBombs = nBombs;

            Color c = Color.White;
            //Color c = new Color(Color.White, 127);

            rotation = 45.0f;
            moveFactorPerSecond = 0.0f;
            shootDirection = new Vector2(1, 0);

            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2((float)7 / referenceWidth, (float)5 / referenceHeight), -40.0f, 0.4f, 0.5f, c));
            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2(-(float)7 / referenceWidth, (float)5 / referenceHeight), 40.0f, 0.4f, 0.5f, c));
            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2((float)5 / referenceWidth, -(float)4 / referenceHeight), -25.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2(-(float)5 / referenceWidth, -(float)4 / referenceHeight), 25.0f, 0.25f, 0.5f, c));
            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2((float)12 / referenceWidth, -(float)8 / referenceHeight), 65.0f, 0.325f, 0.5f, c));
            parts.Add(new ActorPart(Game, texture, position, rotation, new Vector2(-(float)12 / referenceWidth, -(float)8 / referenceHeight), -65.0f, 0.325f, 0.5f, c));

            ChangeState(new PlayerBorn(CurrentLevel, this));
        }