public LoadingScreen(string picturePath, Vector2 pictureSize) { Background = new ImageGraphic { Texture = new TextureFromFile("Interface/LoadingScreen/background.png"), TextureAdressMode = SlimDX.Direct3D9.TextureAddress.Wrap, }; Common.Tuple<string, Vector2> picture; if (picturePath != null) picture = new Common.Tuple<string, Vector2>(picturePath, pictureSize); else picture = defaultPictures[new Random().Next(defaultPictures.Length)]; var picMetaTexture = new TextureFromFile(picture.First) { DontScale = true }; var pic = new Control { Background = new ImageGraphic { Texture = picMetaTexture, SizeMode = SizeMode.AutoAdjust }, Anchor = Orientation.Center, Size = picture.Second }; Dock = System.Windows.Forms.DockStyle.Fill; pic.AddChild(progress); AddChild(pic); }
protected override void OnConstruct() { Text = (SelectedItem ?? "").ToString(); if (Disabled) { NormalTexture = new TextureFromFile("Interface/Common/DropdownInactive1.png") { DontScale = true } } ; else { NormalTexture = new TextureFromFile("Interface/Common/Dropdown1.png") { DontScale = true } }; base.OnConstruct(); ClearChildren(); if (droppedDown) { Grid selectionBar = new Grid { Size = new SlimDX.Vector2(Size.X, items.Count * 20), NWidth = 1, NHeight = items.Count, Position = new SlimDX.Vector2(0, Size.Y), Background = DropDownBackground }; foreach (var v in items) { object item = v; var b = CreateDropDownItem(item); //b.Click += new EventHandler((o, e) => //{ // SelectedItem = item; // DropedDown = false; //}); b.MouseUp += new System.Windows.Forms.MouseEventHandler((o, e) => { SelectedItem = item; DropedDown = false; }); selectionBar.AddChild(b); } AddChild(selectionBar); } }
public RatingControl() { Anchor = Orientation.Left; normalTexture = new TextureFromFile("Interface/Common/StarGray.png") { DontScale = true }; selectedTexture = new TextureFromFile("Interface/Common/Star.png") { DontScale = true }; chosenTexture = new TextureFromFile("Interface/Common/StarSelected.png") { DontScale = true }; for (int j = 0; j < 5; j++) { Button b = new Button { Position = new Vector2(25 * j + (j + 1) * 2, 0), Size = new Vector2(25, 25), Anchor = Orientation.Left, Background = new ImageGraphic { SizeMode = SizeMode.AutoAdjust, Texture = normalTexture }, Tag = j, NormalTexture = null, HoverTexture = null, ClickTexture = null }; buttons[j] = b; b.MouseEnter += new EventHandler((oo, ee) => { hoverScore = (int)b.Tag + 1; InvalidateScore(); }); b.MouseLeave += new EventHandler((oo, ee) => { hoverScore = 0; InvalidateScore(); }); b.Click += new EventHandler((oo, ee) => { RatedScore = (int)b.Tag + 1; InvalidateScore(); }); AddChild(b); } }
public StoneDropDownBar() { Size = new Vector2(243, 28); Padding = new System.Windows.Forms.Padding(1, 1, 25, 1); Background = new ImageGraphic { SizeMode = SizeMode.AutoAdjust }; if (Disabled) { NormalTexture = new TextureFromFile("Interface/Common/DropdownInactive1.png") { DontScale = true } } ; else { NormalTexture = new TextureFromFile("Interface/Common/Dropdown1.png") { DontScale = true } }; HoverTexture = new TextureFromFile("Interface/Common/DropdownMouseOver1.png") { DontScale = true }; ClickTexture = new TextureFromFile("Interface/Common/DropdownMouseOver1.png") { DontScale = true }; Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White }; DropDownBackground = //InterfaceScene.DefaultSlimBorder; new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new global::Graphics.Software.Textures.SingleColorTexture( System.Drawing.Color.FromArgb(220, 0, 0, 0)) } }; }
public Button() { NormalTexture = new TextureFromFile("Graphics.Resources.ButtonBorder.png"); HoverTexture = new TextureFromFile("Graphics.Resources.ButtonHoverBorder.png"); ClickTexture = new TextureFromFile("Graphics.Resources.ButtonClickBorder.png"); Background = new BorderGraphic { Layout = new Graphics.Content.BorderLayout(new Rectangle(0, 0, 4, 4), new Rectangle(3, 0, 1, 4), new Rectangle(0, 3, 4, 1), new Rectangle(3, 3, 1, 1)) { BackgroundStyle = BorderBackgroundStyle.Inner, Border = new Vector2(4, 4) }, Texture = new TextureFromFile("Graphics.Resources.ButtonBorder.png"), TextureSize = new Vector2(4, 4) }; }
public LoadingScreen(string picturePath, Vector2 pictureSize) { Background = new ImageGraphic { Texture = new TextureFromFile("Interface/LoadingScreen/background.png"), TextureAdressMode = SlimDX.Direct3D9.TextureAddress.Wrap, }; Common.Tuple <string, Vector2> picture; if (picturePath != null) { picture = new Common.Tuple <string, Vector2>(picturePath, pictureSize); } else { picture = defaultPictures[new Random().Next(defaultPictures.Length)]; } var picMetaTexture = new TextureFromFile(picture.First) { DontScale = true }; var pic = new Control { Background = new ImageGraphic { Texture = picMetaTexture, SizeMode = SizeMode.AutoAdjust }, Anchor = Orientation.Center, Size = picture.Second }; Dock = System.Windows.Forms.DockStyle.Fill; pic.AddChild(progress); AddChild(pic); }
public StoneDropDownBar() { Size = new Vector2(243, 28); Padding = new System.Windows.Forms.Padding(1, 1, 25, 1); Background = new ImageGraphic { SizeMode = SizeMode.AutoAdjust }; if (Disabled) NormalTexture = new TextureFromFile("Interface/Common/DropdownInactive1.png") { DontScale = true }; else NormalTexture = new TextureFromFile("Interface/Common/Dropdown1.png") { DontScale = true }; HoverTexture = new TextureFromFile("Interface/Common/DropdownMouseOver1.png") { DontScale = true }; ClickTexture = new TextureFromFile("Interface/Common/DropdownMouseOver1.png") { DontScale = true }; Font = new Font { SystemFont = Fonts.MediumSystemFont, Color = System.Drawing.Color.White }; DropDownBackground = //InterfaceScene.DefaultSlimBorder; new StretchingImageGraphic { Texture = new TextureConcretizer { TextureDescription = new global::Graphics.Software.Textures.SingleColorTexture( System.Drawing.Color.FromArgb(220, 0, 0, 0)) } }; }
protected override void OnConstruct() { Text = (SelectedItem ?? "").ToString(); if (Disabled) NormalTexture = new TextureFromFile("Interface/Common/DropdownInactive1.png") { DontScale = true }; else NormalTexture = new TextureFromFile("Interface/Common/Dropdown1.png") { DontScale = true }; base.OnConstruct(); ClearChildren(); if (droppedDown) { Grid selectionBar = new Grid { Size = new SlimDX.Vector2(Size.X, items.Count * 20), NWidth = 1, NHeight = items.Count, Position = new SlimDX.Vector2(0, Size.Y), Background = DropDownBackground }; foreach (var v in items) { object item = v; var b = CreateDropDownItem(item); //b.Click += new EventHandler((o, e) => //{ // SelectedItem = item; // DropedDown = false; //}); b.MouseUp += new System.Windows.Forms.MouseEventHandler((o, e) => { SelectedItem = item; DropedDown = false; }); selectionBar.AddChild(b); } AddChild(selectionBar); } }
protected override void OnConstruct() { UVMin = new Vector2( Translation.X / Ground.Size.Width, Translation.Y / Ground.Size.Height); UVMax = new Vector2( (Translation.X + Size.X) / Ground.Size.Width, (Translation.Y + Size.Y) / Ground.Size.Height); base.OnConstruct(); var ground = Ground; if (ground != null) { if (((MetaModel)MainGraphic).SplatTexutre == null) { ((MetaModel)MainGraphic).SplatTexutre = new MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>[] { ground.SplatMap1, ground.SplatMap2 } } ; if (!IsInGame) { ((MetaModel)MainGraphic).MaterialTexture = new MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>[] { new TextureFromFile("Models/GroundTextures/Rock1.png"), //mud1 new TextureFromFile("Models/GroundTextures/Pebbles1.png"), //mayatile1 new TextureFromFile("Models/GroundTextures/Sand1.png"), //sand1 new TextureFromFile("Models/GroundTextures/Grass1.png"), //grass1 new TextureFromFile("Models/GroundTextures/Moss1.png"), //grass1 new TextureFromFile("Models/GroundTextures/Mayatile1.png"), //mayatile1 new TextureFromFile("Models/GroundTextures/Field1.png"), //mud1 new TextureFromFile("Models/GroundTextures/Sand1.png") //N/A }; } else if (((MetaModel)MainGraphic).MaterialTexture[0] == null && ((MetaModel)MainGraphic).MaterialTexture[1] == null) { MetaResource <SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>[] materialTexture = ((MetaModel)MainGraphic).MaterialTexture; int numberOfValues1 = ground.SplatMap1Values.GetLength(0); int numberOfValues2 = ground.SplatMap1Values.GetLength(1); int numberOfValues3 = ground.SplatMap2Values.GetLength(0); int numberOfValues4 = ground.SplatMap2Values.GetLength(1); if (numberOfValues1 != numberOfValues2 || numberOfValues2 != numberOfValues3 || numberOfValues3 != numberOfValues4) { throw new NotImplementedException("width and hight must be equal"); } for (int i = (int)(UVMin.X * numberOfValues1); i < UVMax.X * numberOfValues1 && UVMax.X <= 1; i++) { for (int j = (int)(UVMin.Y * numberOfValues1); j < UVMax.Y * numberOfValues1 && UVMax.Y <= 1; j++) { Graphics.Software.Texel.A8R8G8B8 g1 = ground.SplatMap1Values[j, i]; Graphics.Software.Texel.A8R8G8B8 g2 = ground.SplatMap2Values[j, i]; if (Program.Settings.RendererSettings.TerrainQuality == global::Graphics.Renderer.Settings.TerrainQualities.Low) { if (((MetaModel)MainGraphic).BaseTexture != null) { ((MetaModel)MainGraphic).BaseTexture = null; } if (materialTexture[0] == null) { materialTexture[0] = new TextureFromFile("Models/GroundTextures/Mud1.png"); } if (g1.G > 0 && materialTexture[1] == null) { materialTexture[1] = new TextureFromFile("Models/GroundTextures/Mayatile1.png"); } if (g1.B > 0 && materialTexture[2] == null) { materialTexture[2] = new TextureFromFile("Models/GroundTextures/Sand1.png"); } if (g1.A > 0 && materialTexture[3] == null) { materialTexture[3] = new TextureFromFile("Models/GroundTextures/Grass1.png"); } ground.SplatMap1Values[j, i].A += g2.R; ground.SplatMap1Values[j, i].G += g2.G; ground.SplatMap1Values[j, i].R = 1; } else { if (g1.R > 0 && materialTexture[0] == null) { materialTexture[0] = new TextureFromFile("Models/GroundTextures/Rock1.png"); } if (g1.G > 0 && materialTexture[1] == null) { materialTexture[1] = new TextureFromFile("Models/GroundTextures/Pebbles1.png"); } if (g1.B > 0 && materialTexture[2] == null) { materialTexture[2] = new TextureFromFile("Models/GroundTextures/Sand1.png"); } if (g1.A > 0 && materialTexture[3] == null) { materialTexture[3] = new TextureFromFile("Models/GroundTextures/Grass1.png"); } if (g2.R > 0 && materialTexture[4] == null) { materialTexture[4] = new TextureFromFile("Models/GroundTextures/Moss1.png"); } if (g2.G > 0 && materialTexture[5] == null) { materialTexture[5] = new TextureFromFile("Models/GroundTextures/Mayatile1.png"); } if (g2.B > 0 && materialTexture[6] == null) { materialTexture[6] = new TextureFromFile("Models/GroundTextures/Field1.png"); } if (g2.A > 0 && materialTexture[7] == null) { materialTexture[7] = new TextureFromFile("Models/GroundTextures/Sand2.png"); } } } } } PickingLocalBounding = null; GroundIntersectLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic); // This forces the ground physics mesh to be another one than the visual mesh // so that the physics doesn't need to intersect with the same mesh the renderer uses, in turn // meaning we don't need the device MultiThread mode. MetaModel m = (MetaModel)((MetaModel)MainGraphic).Clone(); ((Graphics.Software.Meshes.MeshFromHeightmap2)((MeshConcretize)m.XMesh).MeshDescription).Height += 0.0001f; //((MeshConcretize)m.XMesh).XMeshFlags = SlimDX.Direct3D9.MeshFlags.Software; PhysicsLocalBounding = new Common.Bounding.GroundPiece { Bounding = CreatePhysicsMeshBounding(m) }; } }
protected override void OnConstruct() { UVMin = new Vector2( Translation.X / Ground.Size.Width, Translation.Y / Ground.Size.Height); UVMax = new Vector2( (Translation.X + Size.X) / Ground.Size.Width, (Translation.Y + Size.Y) / Ground.Size.Height); base.OnConstruct(); var ground = Ground; if (ground != null) { if(((MetaModel)MainGraphic).SplatTexutre == null) ((MetaModel)MainGraphic).SplatTexutre = new MetaResource<SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>[] { ground.SplatMap1, ground.SplatMap2 }; if (!IsInGame) { ((MetaModel)MainGraphic).MaterialTexture = new MetaResource<SlimDX.Direct3D9.Texture,SlimDX.Direct3D10.Texture2D>[] { new TextureFromFile("Models/GroundTextures/Rock1.png"), //mud1 new TextureFromFile("Models/GroundTextures/Pebbles1.png"), //mayatile1 new TextureFromFile("Models/GroundTextures/Sand1.png"), //sand1 new TextureFromFile("Models/GroundTextures/Grass1.png"), //grass1 new TextureFromFile("Models/GroundTextures/Moss1.png"), //grass1 new TextureFromFile("Models/GroundTextures/Mayatile1.png"), //mayatile1 new TextureFromFile("Models/GroundTextures/Field1.png"), //mud1 new TextureFromFile("Models/GroundTextures/Sand1.png") //N/A }; } else if(((MetaModel)MainGraphic).MaterialTexture[0] == null && ((MetaModel)MainGraphic).MaterialTexture[1] == null) { MetaResource<SlimDX.Direct3D9.Texture, SlimDX.Direct3D10.Texture2D>[] materialTexture = ((MetaModel)MainGraphic).MaterialTexture; int numberOfValues1 = ground.SplatMap1Values.GetLength(0); int numberOfValues2 = ground.SplatMap1Values.GetLength(1); int numberOfValues3 = ground.SplatMap2Values.GetLength(0); int numberOfValues4 = ground.SplatMap2Values.GetLength(1); if (numberOfValues1 != numberOfValues2 || numberOfValues2 != numberOfValues3 || numberOfValues3 != numberOfValues4) throw new NotImplementedException("width and hight must be equal"); for (int i = (int)(UVMin.X * numberOfValues1); i < UVMax.X * numberOfValues1 && UVMax.X <= 1; i++) { for (int j = (int)(UVMin.Y * numberOfValues1); j < UVMax.Y * numberOfValues1 && UVMax.Y <= 1; j++) { Graphics.Software.Texel.A8R8G8B8 g1 = ground.SplatMap1Values[j, i]; Graphics.Software.Texel.A8R8G8B8 g2 = ground.SplatMap2Values[j, i]; if (Program.Settings.RendererSettings.TerrainQuality == global::Graphics.Renderer.Settings.TerrainQualities.Low) { if (((MetaModel)MainGraphic).BaseTexture != null) ((MetaModel)MainGraphic).BaseTexture = null; if (materialTexture[0] == null) materialTexture[0] = new TextureFromFile("Models/GroundTextures/Mud1.png"); if (g1.G > 0 && materialTexture[1] == null) materialTexture[1] = new TextureFromFile("Models/GroundTextures/Mayatile1.png"); if (g1.B > 0 && materialTexture[2] == null) materialTexture[2] = new TextureFromFile("Models/GroundTextures/Sand1.png"); if (g1.A > 0 && materialTexture[3] == null) materialTexture[3] = new TextureFromFile("Models/GroundTextures/Grass1.png"); ground.SplatMap1Values[j, i].A += g2.R; ground.SplatMap1Values[j, i].G += g2.G; ground.SplatMap1Values[j, i].R = 1; } else { if (g1.R > 0 && materialTexture[0] == null) materialTexture[0] = new TextureFromFile("Models/GroundTextures/Rock1.png"); if (g1.G > 0 && materialTexture[1] == null) materialTexture[1] = new TextureFromFile("Models/GroundTextures/Pebbles1.png"); if (g1.B > 0 && materialTexture[2] == null) materialTexture[2] = new TextureFromFile("Models/GroundTextures/Sand1.png"); if (g1.A > 0 && materialTexture[3] == null) materialTexture[3] = new TextureFromFile("Models/GroundTextures/Grass1.png"); if (g2.R > 0 && materialTexture[4] == null) materialTexture[4] = new TextureFromFile("Models/GroundTextures/Moss1.png"); if (g2.G > 0 && materialTexture[5] == null) materialTexture[5] = new TextureFromFile("Models/GroundTextures/Mayatile1.png"); if (g2.B > 0 && materialTexture[6] == null) materialTexture[6] = new TextureFromFile("Models/GroundTextures/Field1.png"); if (g2.A > 0 && materialTexture[7] == null) materialTexture[7] = new TextureFromFile("Models/GroundTextures/Sand2.png"); } } } } PickingLocalBounding = null; GroundIntersectLocalBounding = CreateBoundingMeshFromModel((MetaModel)MainGraphic); // This forces the ground physics mesh to be another one than the visual mesh // so that the physics doesn't need to intersect with the same mesh the renderer uses, in turn // meaning we don't need the device MultiThread mode. MetaModel m = (MetaModel)((MetaModel)MainGraphic).Clone(); ((Graphics.Software.Meshes.MeshFromHeightmap2)((MeshConcretize)m.XMesh).MeshDescription).Height += 0.0001f; //((MeshConcretize)m.XMesh).XMeshFlags = SlimDX.Direct3D9.MeshFlags.Software; PhysicsLocalBounding = new Common.Bounding.GroundPiece { Bounding = CreatePhysicsMeshBounding(m) }; } }
public SwordStrikeEffect(Units.MainCharacter mainCharacter, float ttl, float delay, TextureFromFile texture, float weaponLength) { this.mainCharacter = mainCharacter; this.delay = delay; SwordOffset = Vector3.UnitZ * weaponLength; entity = new Entity { VisibilityLocalBounding = new Common.Bounding.NonfittableBounding(Vector3.Zero, false, true) }; AddChild(entity); this.ttl = ttl; fadeTotal = fadeSurvive; this.texture = texture; }
public CinematicButton() { Size = new Vector2(83, 52); Clickable = true; Background = new ImageGraphic { SizeMode = SizeMode.AutoAdjust, }; NormalTexture = new TextureFromFile("Interface/Menu/CinematicIcon1.png") { DontScale = true }; HoverTexture = ClickTexture = new TextureFromFile("Interface/Menu/CinematicIconMouseover1.png") { DontScale = true }; }