public override void Render() { DrawableTexture texture = GetBool("twoDash", false) ? TwoDashSprite.Value : OneDashSprite.Value; texture.DrawOutlineCentered(Position, Color.Black); texture.DrawCentered(Position); }
public StaticTexture(DrawableTexture tex, Vector2 position, Vector2 scale) { Texture = tex; Destination = default; Position = position; Scale = scale; Visible = true; }
public StaticTexture(DrawableTexture tex) { Texture = tex; Destination = default; Position = Vector2.Zero; Scale = Vector2.One; Visible = true; }
public StaticTexture(DrawableTexture tex, Rectangle destination, Vector2 scale) { Texture = tex; Destination = destination; Position = Vector2.Zero; Scale = scale; Visible = true; }
public Block(BaseGame game) { this.texture = new DrawableTexture() { Texture = game.Texutes["btn_small"], Color = Color.White, Target = new Rectangle(0, 0, 10, 10) }; }
public GameObject(Drawable drawable, string name = "") { Name = name; Drawable = drawable; if (Drawable.GetType() == typeof(DrawableTexture)) { DrawableTexture tex = Drawable as DrawableTexture; Size = new Vector2(tex.width, tex.height); } }
/// <summary> /// Creates a list of StaticTextures based on a list of Decals. /// </summary> /// <param name="decals">The Decal list to us.</param> private List <StaticTexture> CreateDecalTextureList(List <Decal> decals) { List <StaticTexture> list = new List <StaticTexture>(); foreach (Decal decal in decals) { DrawableTexture tex = GFX.Gameplay["decals/" + decal.Name.Replace('\\', '/').Substring(0, decal.Name.Length - 4)]; list.Add(new StaticTexture(tex, new Vector2(decal.X, decal.Y), decal.Scale)); } return(list); }
/// <summary> Splits a 24x24 texture into a 3x3 grid of 8x8 textures </summary> private static DrawableTexture[,] GetEdges(DrawableTexture baseTexture) { DrawableTexture[,] edges = new DrawableTexture[3, 3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { edges[i, j] = new DrawableTexture(baseTexture, i * 8, j * 8, 8, 8); } } return(edges); }
public Tileset(DrawableTexture texture, int tileWidth, int tileHeight) { Texture = texture; TileWidth = tileWidth; TileHeight = tileHeight; Tiles = new DrawableTexture[Width = texture.Width / tileWidth, Height = texture.Height / tileHeight]; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { Tiles[x, y] = new DrawableTexture(Texture, x * TileWidth, y * TileHeight, TileWidth, TileHeight); } } }
/// <summary> /// Unpacks any texture atlases that needs to be loaded. /// </summary> public static void UnpackAtlases() { GFX.Gameplay = Atlas.FromAtlas(Path.Combine(Settings.CelesteDirectory, "Content", "Graphics", "Atlases", "Gameplay"), AtlasFormat.Packer); GFX.Empty = new DrawableTexture(GFX.Gameplay.Sources[0], 4094, 4094, 1, 1); GFX.Pixel = new DrawableTexture(GFX.Gameplay.Sources[0], 13, 13, 1, 1); GFX.Scenery = new Tileset(GFX.Gameplay["tilesets/scenery"], 8, 8); // PICO-8 font loading DrawableTexture font = GFX.Gameplay["pico8/font"]; GFX.Font = new DrawableTexture[font.Width / 4 * (font.Height / 6)]; for (int i = 0; i < font.Height / 6; i++) { for (int j = 0; j < font.Width / 4; j++) { GFX.Font[j + i * (font.Width / 4)] = new DrawableTexture(font, j * 4, i * 6, 4, 6); } } Finished = true; }
protected override void Load() { Add(new Player(new DrawableTexture("test.png"), "Player1")).Position = new Vector2(50, 50); Add(new Player2(new DrawableTexture("test.png"), "Player2")); Background = new DrawableTexture(new Texture("Track1A.png", Width, Height), Width, Height); }