private void TempInitImages() { playerImages = new Dictionary<Direction, TextureImage>(); playerImages.Add(Direction.DOWN, Helper.GetTexture(A.gfx_wlks0001)); playerImages.Add(Direction.UP, Helper.GetTexture(A.gfx_wlkn0001)); playerImages.Add(Direction.LEFT, Helper.GetTexture(A.gfx_wlkw0001)); playerImages.Add(Direction.RIGHT, Helper.GetTexture(A.gfx_wlke0001)); playerGrabImages = new Dictionary<Direction, TextureImage>(); playerGrabImages.Add(Direction.DOWN, Helper.GetTexture(A.gfx_bmf0010)); playerGrabImages.Add(Direction.UP, Helper.GetTexture(A.gfx_bmf0010)); playerGrabImages.Add(Direction.LEFT, Helper.GetTexture(A.gfx_pul0010)); playerGrabImages.Add(Direction.RIGHT, Helper.GetTexture(A.gfx_pur0010)); solidImage = Helper.GetTexture(A.gfx_f0solid); breakableImage = Helper.GetTexture(A.gfx_f0brick); bombImage = Helper.GetTexture(A.gfx_bmb1001); bombJellyImage = Helper.GetTexture(A.gfx_bmbc1); bombTriggerImage = Helper.GetTexture(A.gfx_digib001); powerupImages = new TextureImage[] { Helper.GetTexture(A.gfx_powerups_bomb), Helper.GetTexture(A.gfx_powerups_flame), Helper.GetTexture(A.gfx_powerups_disea), Helper.GetTexture(A.gfx_powerups_kick), Helper.GetTexture(A.gfx_powerups_skate), Helper.GetTexture(A.gfx_powerups_punch), Helper.GetTexture(A.gfx_powerups_grab), Helper.GetTexture(A.gfx_powerups_spooge), Helper.GetTexture(A.gfx_powerups_gold), Helper.GetTexture(A.gfx_powerups_trig), Helper.GetTexture(A.gfx_powerups_jelly), Helper.GetTexture(A.gfx_powerups_ebola), Helper.GetTexture(A.gfx_powerups_random), }; dirLookup = new Dictionary<Direction, TextureImage>(); dirLookup[Direction.UP] = Helper.GetTexture(A.gfx_dir_up); dirLookup[Direction.DOWN] = Helper.GetTexture(A.gfx_dir_down); dirLookup[Direction.LEFT] = Helper.GetTexture(A.gfx_dir_left); dirLookup[Direction.RIGHT] = Helper.GetTexture(A.gfx_dir_right); }
public ImageView(TextureImage texture) : base(texture.GetWidth(), texture.GetHeight()) { this.texture = texture; }
public void DrawScaledImage(TextureImage tex, float x, float y, float scale) { Vector2 origin = new Vector2(0.5f * tex.GetWidth(), 0.5f * tex.GetHeight()); GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), null, drawColor, 0.0f, origin, scale, SpriteEffects.None, 0.0f); }
private void DrawCellImage(Context context, FieldCell cell, TextureImage image) { float drawX = cell.GetPx() - 0.5f * image.GetWidth(); float drawY = cell.GetPy() - 0.5f * image.GetHeight(); context.DrawImage(image, drawX, drawY); }
public void DrawImageRotated(TextureImage tex, float x, float y, Vector2 origin, float rotation) { GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), null, drawColor, rotation, origin, 1.0f, SpriteEffects.None, 0.0f); }
public void DrawImageTiled(TextureImage tex, ref Rectangle src, ref Rectangle dest) { // TODO: implement with texture repeat int destWidth = dest.Width; int destHeight = dest.Height; int srcWidth = src.Width; int srcHeight = src.Height; int numTilesX = destWidth / srcWidth + (destWidth % srcWidth != 0 ? 1 : 0); int numTilesY = destHeight / srcHeight + (destHeight % srcHeight != 0 ? 1 : 0); int x = dest.X; int y = dest.Y; for (int tileY = 0; tileY < numTilesY; ++tileY) { for (int tileX = 0; tileX < numTilesX; ++tileX) { DrawImagePart(tex, src, x, y); x += srcWidth; } y += srcHeight; } }
public void DrawImagePart(TextureImage tex, Rectangle src, float x, float y, Color dc) { GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), src, dc); }
public void DrawImage(TextureImage tex, ref Rectangle src, ref Vector2 position, ref Color color, float rotation, ref Vector2 origin, ref Vector2 scale, ref Vector2 flip) { SpriteEffects flipEffects = flip.X == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; if (flip.Y == 1) flipEffects |= SpriteEffects.FlipVertically; GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), position, src, color, rotation, origin, scale, flipEffects, 0.0f); }
public void DrawImage(TextureImage tex, float x, float y, SpriteEffects flip) { GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), null, drawColor, 0.0f, Vector2.Zero, 1.0f, flip, 0.0f); }
public void DrawImage(TextureImage tex, float x, float y, Color color) { GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), color); }
public void DrawImage(TextureImage tex, float x, float y, float opacity) { GetSpriteBatch(BatchMode.Sprite).Draw(tex.GetTexture(), new Vector2(x, y), new Color(1.0f, 1.0f, 1.0f, opacity)); }