public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message) { base.Setup(_game, _keyboard, _message); Sprite title = new Sprite(new Bitmap("pictures/title.png")); title.Position = new Vector2f(); title.Size = new Vector2f(Game.Width, Game.Height); m_house.AddDrawable(title); Text text = new Text("[Click] or Press [Space] to Start"); text.CentreOn(new Vector2f(Game.Width/2, Game.Height/5)); m_house.AddDrawable(text); fx_buffer = new Effect( new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.Width, Game.Height)) { CaptureLayer = Layer.Normal, Layer = Layer.FX, Priority = Priority.Front }; fx_buffer.SetHUD(_game.Camera); fx_buffer.SetFading(0.5f, new Colour(0,0,0,1), new Colour(0,0,0,0)); m_house.AddDrawable(fx_buffer); m_house.AddUpdateable(fx_buffer); }
public GangsterTrail(Gangster _gangster, Sprite _sprite) { m_gangster = _gangster; s_sprite = _sprite; // for (int i = 0 ; i < _sprite.Bitmap.Width ; i++) { // for (int j = 0 ; j < _sprite.Bitmap.Height; j++) { // m_sprite.Bitmap.SetPixel(i, j, Color.Green); // } // } //m_sprite.ReloadBitmap(); s_sprite.Size.Y = s_sprite.Bitmap.Size.Height / Tile.Size; s_sprite.Size.X = s_sprite.Bitmap.Size.Width / Tile.Size; }
public static void Init() { s_sprite = new Sprite(s_tmpBmp); s_totalSize = new Vector2f(s_sprite.Bitmap.Size.Width, s_sprite.Bitmap.Size.Height)/Tile.Size; Vector2f worldPosition = new Vector2f(0,0); Vector2f pixelPosition = new Vector2f(0,0); Vector2f previousPixelPosition = new Vector2f(0,0); Vector2f pixelSize = new Vector2f(0,0); Vector2f worldSize = new Vector2f(0,0); foreach (char character in characters) { previousPixelPosition = pixelPosition.Clone(); pixelPosition = RenderCharacter (character, pixelPosition, out pixelSize); if (pixelPosition.X >= s_sprite.Bitmap.Size.Width) { pixelPosition.Y += pixelSize.Y; pixelPosition.X = 0; previousPixelPosition = pixelPosition.Clone(); pixelPosition = RenderCharacter(character, pixelPosition, out pixelSize); } worldSize = pixelSize / Tile.Size; worldPosition = previousPixelPosition / Tile.Size; s_characters[character] = new Character() { Size = worldSize.Clone(), Position = worldPosition.Clone(), Char = character }; } s_sprite.ReloadBitmap(); }