static UITextBox() { StandardBackground = new SlicedTextureRef( UIElement.GetTexture((ulong)TSOClient.FileIDs.UIFileIDs.dialog_textboxbackground), new Microsoft.Xna.Framework.Rectangle(13, 13, 13, 13) ); }
public TextureValueMap(ITextureRef texture, Func <Color, T> converter) { Values = new T[512, 512]; var image = texture.GetImage(); var bytes = image.Data; var pixelSize = image.PixelSize; // copy the bytes from bitmap to array var index = 0; for (var y = 0; y < 512; y++) { for (var x = 0; x < 512; x++) { var a = pixelSize == 3 ? 255 : bytes[index + 3]; var r = bytes[index + 2]; var g = bytes[index + 1]; var b = bytes[index]; index += pixelSize; //The game actually uses the pixel coordinates as the lot coordinates var color = new Color(r, g, b, a); var value = converter(color); Values[y, x] = value; } } //image.UnlockBits(data); }
static UITextBox() { var tex = UIElement.GetTexture((ulong)FileIDs.UIFileIDs.dialog_textboxbackground); if (tex.Width == 1) { return; } StandardBackground = new SlicedTextureRef( UIElement.GetTexture((ulong)FileIDs.UIFileIDs.dialog_textboxbackground), new Microsoft.Xna.Framework.Rectangle(13, 13, 13, 13) ); }
static UIProgressBar() { StandardBackground = new SlicedTextureRef( UIElement.GetTexture((ulong)TSOClient.FileIDs.UIFileIDs.dialog_progressbarback), new Microsoft.Xna.Framework.Rectangle(13, 13, 13, 13) ); var barTexture = UIElement.GetTexture((ulong)TSOClient.FileIDs.UIFileIDs.dialog_progressbarfront); TextureUtils.ManualTextureMask(ref barTexture, new uint[1] { new Color(0x39, 0x51, 0x6B).PackedValue }); StandardBar = new SlicedTextureRef(barTexture, new Rectangle(18, 7, 18, 7)); StandardCaptionStyle = TextStyle.DefaultLabel.Clone(); StandardCaptionStyle.Color = new Color(0, 0, 0); }
public CityMap(string directory) { _Directory = directory; string ext = "bmp"; if (!File.Exists(Path.Combine(directory, "elevation.bmp"))) { ext = "png"; //fso maps use png } Elevation = new FileTextureRef(Path.Combine(directory, "elevation." + ext)); ForestDensity = new FileTextureRef(Path.Combine(directory, "forestdensity." + ext)); ForestType = new FileTextureRef(Path.Combine(directory, "foresttype." + ext)); RoadMap = new FileTextureRef(Path.Combine(directory, "roadmap." + ext)); TerrainTypeTex = new FileTextureRef(Path.Combine(directory, "terraintype." + ext)); VertexColour = new FileTextureRef(Path.Combine(directory, "vertexcolor." + ext)); Thumbnail = new FileTextureRef(Path.Combine(directory, "thumbnail." + ext)); _TerrainType = new TextureValueMap <Model.TerrainType>(TerrainTypeTex, x => { if (x == TERRAIN_GRASS) { return(Model.TerrainType.GRASS); } else if (x == TERRAIN_WATER) { return(Model.TerrainType.WATER); } else if (x == TERRAIN_SNOW) { return(Model.TerrainType.SNOW); } else if (x == TERRAIN_ROCK) { return(Model.TerrainType.ROCK); } else if (x == TERRAIN_SAND) { return(Model.TerrainType.SAND); } return(default(TerrainType)); }); _ElevationMap = new TextureValueMap <byte>(Elevation, x => x.R); _RoadMap = new TextureValueMap <byte>(RoadMap, x => x.R); }
public void SetBackgroundTexture(Texture2D texture, int marginLeft, int marginRight, int marginTop, int marginBottom) { BackgroundTextureReference = null; m_BackgroundTex = texture; if (texture != null) { NineSliceMargins = new NineSliceMargins { Left = marginLeft, Right = marginRight, Top = marginTop, Bottom = marginBottom }; NineSliceMargins.CalculateOrigins(texture); } else { NineSliceMargins = null; } }
public UIImage(ITextureRef Texture) { this.m_TextureRef = Texture; }
public UIProgressBar(ITextureRef background, ITextureRef bar) { this.Background = background; this.Bar = bar; }
static UITextBox() { StandardBackground = new SlicedTextureRef( UIElement.GetTexture((ulong)FileIDs.UIFileIDs.dialog_textboxbackground), new Microsoft.Xna.Framework.Rectangle(13, 13, 13, 13) ); }
public void Preview(object value) { ITextureRef texture = (ITextureRef)value; //this.pictureBox1.Image = texture.GetImage(); }