public GPaperdollItem(int X, int Y, int GumpID, int Serial, IHue Hue, int Layer, Mobile owner, bool canDrag) : base(X, Y) { this.m_fAlpha = 1f; this.m_GumpID = GumpID; this.m_Serial = Serial; this.m_Hue = Hue; this.m_Layer = Layer; this.m_Item = World.FindItem(this.m_Serial); if ((this.m_Item != null) && Engine.Features.AOS) { base.Tooltip = new ItemTooltip(this.m_Item); } this.m_Image = this.m_Hue.GetGump(this.m_GumpID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; this.m_Draw = this.m_Item != null; } else { this.m_Width = 0; this.m_Height = 0; this.m_Draw = false; } base.m_ITranslucent = true; this.m_ValidDrag = (((canDrag && (this.m_Layer >= 1)) && ((this.m_Layer <= 0x18) && (this.m_Layer != 11))) && (this.m_Layer != 0x10)) && (this.m_Layer != 0x15); base.m_CanDrag = true; base.m_QuickDrag = (((this.m_Layer < 1) || (this.m_Layer > 0x18)) || (this.m_Layer == 11)) || (this.m_Layer == 0x10); }
public GItemListEntry(int x, AnswerEntry entry, GItemList owner) : base(x, 0x2d) { this.m_Entry = entry; this.m_Owner = owner; int hue = entry.Hue; if (hue > 0) { hue++; } this.m_Hue = Hues.GetItemHue(entry.ItemID, hue); this.m_Image = this.m_Hue.GetItem(entry.ItemID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Height = 0x2f; int num2 = (this.m_Image.xMax - this.m_Image.xMin) + 1; this.m_Width = 0x2f; if (num2 > this.m_Width) { this.m_Width = num2; } this.m_ImageOffsetX = ((this.m_Width - ((this.m_Image.xMax - this.m_Image.xMin) + 1)) / 2) - this.m_Image.xMin; this.m_ImageOffsetY = ((this.m_Height - ((this.m_Image.yMax - this.m_Image.yMin) + 1)) / 2) - this.m_Image.yMin; } }
public MapMesh(MapCompiled map) { texture = new Texture("Images/wall.png"); material = new ObjMaterial("Models/wall.mtl").Lookup("wall"); colorGroups = new List<WallColorGroup>(); var colorMap = new Dictionary<Color, MeshBuilder<VertexTNP3>>(); foreach (var wall in map.Walls) { MeshBuilder<VertexTNP3> builder; if (!colorMap.TryGetValue(wall.Color, out builder)) { builder = new MeshBuilder<VertexTNP3>(); colorMap.Add(wall.Color, builder); } for (int i = 0; i < wall.Verts1.Length-1; i++) makeQuads(wall, builder, i, i+1); if (wall.Shape == ShapeData.Closed) makeQuads(wall, builder, wall.Verts1.Length-1, 0); } foreach (var pair in colorMap) { WallColorGroup g; g.Color = pair.Key; g.Mesh = pair.Value.ToMesh().Compile(); colorGroups.Add(g); } }
public unsafe void DrawGame(Texture t, int x, int y) { if (((this.m_xPool != x) || (this.m_yPool != y)) || ((this.m_tPool != t) || (this.m_fPool != t.Flip))) { fixed (CustomVertex.TransformedColoredTextured* texturedRef = this.m_vPool) { texturedRef->Tu = 0f; texturedRef->Tv = 0f; texturedRef[1].Tu = 0f; texturedRef[1].Tv = 0f; texturedRef[2].Tu = 0f; texturedRef[2].Tv = 0f; texturedRef[3].Tu = 0f; texturedRef[3].Tv = 0f; this.m_tPool = t; this.m_xPool = x; this.m_yPool = y; this.m_fPool = t.Flip; this.m_bPool = t.DrawGame(x, y, texturedRef); } } else if (this.m_bPool) { fixed (CustomVertex.TransformedColoredTextured* texturedRef2 = this.m_vPool) { int quadColor = Renderer.GetQuadColor(0xffffff); texturedRef2->Color = quadColor; texturedRef2[1].Color = quadColor; texturedRef2[2].Color = quadColor; texturedRef2[3].Color = quadColor; Renderer.SetTexture(t); Renderer.DrawQuadPrecalc(texturedRef2); } } }
public GThreeToggle(Texture state0, Texture state1, Texture state2, int initialState, int x, int y) : base(x, y) { this.m_Images = new Texture[] { state0, state1, state2 }; this.m_Draw = new bool[] { (this.m_Images[0] != null) && !this.m_Images[0].IsEmpty(), (this.m_Images[1] != null) && !this.m_Images[1].IsEmpty(), (this.m_Images[2] != null) && !this.m_Images[2].IsEmpty() }; this.m_Sizes = new Size[] { this.m_Draw[0] ? new Size(this.m_Images[0].Width, this.m_Images[0].Height) : Size.Empty, this.m_Draw[1] ? new Size(this.m_Images[1].Width, this.m_Images[1].Height) : Size.Empty, this.m_Draw[2] ? new Size(this.m_Images[2].Width, this.m_Images[2].Height) : Size.Empty }; this.m_State = initialState; }
public GVolumeControl() : base(0, 0) { this.m_Background = new Texture(new Bitmap("Data/Images/volume.png")); this.m_Slider = new Texture(new Bitmap("Data/Images/volume_slider.png")); base.m_Children.Add(new GVolumeSlider(true, this.m_Slider, 13, 0x30)); base.m_Children.Add(new GVolumeSlider(false, this.m_Slider, 13, 0x5e)); base.GUID = "Volume"; }
public Rain(Random rnd) { switch ((m_Index % 8)) { case 0: this.m_xStart = rnd.Next(Engine.ScreenWidth) - Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight) - Engine.ScreenHeight; break; case 1: this.m_xStart = rnd.Next(Engine.ScreenWidth); this.m_yStart = rnd.Next(Engine.ScreenHeight) - Engine.ScreenHeight; break; case 2: this.m_xStart = rnd.Next(Engine.ScreenWidth) - Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight); break; case 3: this.m_xStart = rnd.Next(Engine.ScreenWidth) + Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight) - Engine.ScreenHeight; break; case 4: this.m_xStart = rnd.Next(Engine.ScreenWidth) + Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight); break; case 5: this.m_xStart = rnd.Next(Engine.ScreenWidth) + Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight) + Engine.ScreenHeight; break; case 6: this.m_xStart = rnd.Next(Engine.ScreenWidth); this.m_yStart = rnd.Next(Engine.ScreenHeight) + Engine.ScreenHeight; break; case 7: this.m_xStart = rnd.Next(Engine.ScreenWidth) - Engine.ScreenWidth; this.m_yStart = rnd.Next(Engine.ScreenHeight) + Engine.ScreenHeight; break; } m_Index++; double d = 3.1415926535897931 * (0.45 + (rnd.NextDouble() * 0.1)); this.m_Angle = d; this.m_xEnd = this.m_xStart + ((Engine.ScreenWidth * 1.25) * Math.Cos(d)); this.m_yEnd = this.m_yStart + ((Engine.ScreenHeight * 1.25) * Math.Sin(d)); this.m_OnScreen = this.CheckOnScreen(); this.m_Random = rnd; this.m_Image = Engine.m_Rain; float num2 = 0.5f + ((float) (rnd.NextDouble() * 0.5)); this.m_Sync = new TimeSync((double) num2); this.m_SliceCheck = (int) (20f * num2); }
public Image(string path, float left, float right, float bottom, float top) { texture = new Texture(path); GL.GenVertexArrays(1, out vao); GL.BindVertexArray(vao); GL.GenBuffers(1, out vbo); SetSize(left, right, bottom, top); new VertexTP2().SetupAttributes(); GL.BindVertexArray(0); }
public Label(Texture texture, string text) { this.texture = texture; GL.GenVertexArrays(1, out vao); GL.BindVertexArray(vao); GL.GenBuffers(1, out vbo); this.Text = text; new VertexTP2().SetupAttributes(); GL.BindVertexArray(0); }
public CursorEntry(int graphic, int type, int xOffset, int yOffset, Texture image) { this.m_Graphic = graphic; this.m_Type = type; this.m_xOffset = xOffset; this.m_yOffset = yOffset; this.m_Image = image; this.m_Draw = (this.m_Image != null) && !this.m_Image.IsEmpty(); this.m_vCache = new VertexCache(); }
public GumpImage(int GumpID) { this.m_GumpID = GumpID; this.m_Image = Hues.Default.GetGump(GumpID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; this.m_Draw = true; this.m_Tile = false; } }
public GDraggedItem(Client.Item item) : base(0, 0) { this.m_vCache = new VertexCache(); this.m_Item = item; int index = this.m_Item.ID & 0x3fff; int amount = (ushort) this.m_Item.Amount; this.m_Double = Map.m_ItemFlags[index][TileFlag.Generic] && (amount > 1); if ((index >= 0xeea) && (index <= 0xef2)) { int num3 = (index - 0xeea) / 3; num3 *= 3; num3 += 0xeea; this.m_Double = false; if (amount <= 1) { index = num3; } else if ((amount >= 2) && (amount <= 5)) { index = num3 + 1; } else { index = num3 + 2; } } this.m_Hue = Hues.GetItemHue(index, this.m_Item.Hue); this.m_Image = this.m_Hue.GetItem(index); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; int num4 = this.m_Double ? 6 : 1; this.m_xOffset = base.m_OffsetX = this.m_Image.xMin + (((this.m_Image.xMax - this.m_Image.xMin) + num4) / 2); this.m_yOffset = this.m_Image.yMin; base.m_OffsetY = this.m_yOffset + (((this.m_Image.yMax - this.m_Image.yMin) + num4) / 2); if (this.m_Double) { this.m_Width += 5; this.m_Height += 5; } } base.m_DragCursor = false; base.m_CanDrag = true; base.m_QuickDrag = true; base.m_IsDragging = true; Gumps.Drag = this; Gumps.LastOver = this; base.m_X = Engine.m_xMouse - base.m_OffsetX; base.m_Y = Engine.m_yMouse - base.m_OffsetY; }
public GumpImage(int GumpID, int X, int Y, int Width, int Height) { this.m_GumpID = GumpID; this.m_X = X; this.m_Y = Y; this.m_Width = Width; this.m_Height = Height; this.m_Image = Hues.Default.GetGump(GumpID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Draw = true; this.m_Tile = true; } }
private TransparentDraw(Texture tex, int x, int y, bool hasAlpha, float theAlpha, bool xDouble) { this.m_Texture = tex; this.m_X = x; this.m_Y = y; if (!hasAlpha) { theAlpha = 1f; } theAlpha *= 0.5f; this.m_bAlpha = true; this.m_fAlpha = theAlpha; this.m_Double = xDouble; }
public GItemArt(int x, int y, int itemID, IHue hue) : base(x, y) { this.m_vCache = new VertexCache(); this.m_Hue = hue; this.m_ItemID = itemID; this.m_Image = hue.GetItem(itemID); if ((this.m_Image != null) && !this.m_Image.IsEmpty()) { this.m_Width = this.m_Image.Width; this.m_Height = this.m_Image.Height; this.m_Draw = true; } }
public unsafe void DrawGame(Texture t, int x, int y) { fixed (CustomVertex.TransformedColoredTextured* texturedRef = m_vPool) { texturedRef->Tu = 0f; texturedRef->Tv = 0f; texturedRef[1].Tu = 0f; texturedRef[1].Tv = 0f; texturedRef[2].Tu = 0f; texturedRef[2].Tv = 0f; texturedRef[3].Tu = 0f; texturedRef[3].Tv = 0f; t.DrawGame(x, y, texturedRef); } }
public GVolumeSlider(bool sound, Texture texture, int x, int y) : base(x, y) { this.m_State = State.Inactive; this.m_Sound = sound; this.m_Texture = texture; base.LargeOffset = 5; base.WheelOffset = 5; base.SmallOffset = 1; base.Minimum = 0; base.Maximum = 100; base.Value = sound ? VolumeControl.Sound : VolumeControl.Music; this.Width = 100; this.Height = 15; }
public GSlider(int SliderID, IHue Hue, int X, int Y, int Width, int Height, double Value, double Start, double End, double Increase) : base(X, Y) { this.m_vCache = new VertexCache(); this.m_Width = Width; this.m_Height = Height; this.m_Start = Start; this.m_End = End; this.m_Increase = Increase; this.m_Gump = Hue.GetGump(SliderID); if ((this.m_Gump != null) && !this.m_Gump.IsEmpty()) { this.m_HalfWidth = this.m_Gump.Width / 2; this.m_yOffset = (this.m_Height - this.m_Gump.Height) / 2; this.m_Draw = true; } this.SetValue(Value, false); }
public GDragable(int GumpID, IHue Hue, int X, int Y) : base(X, Y) { this.m_CanClose = true; this.m_fAlpha = 1f; this.m_vCache = new VertexCache(); this.m_GumpID = GumpID; this.m_Hue = Hue; base.m_CanDrag = true; base.m_QuickDrag = true; this.m_Dockers = new ArrayList(); this.m_Linked = new ArrayList(); this.m_Gump = Hue.GetGump(GumpID); if ((this.m_Gump != null) && !this.m_Gump.IsEmpty()) { this.m_Width = this.m_Gump.Width; this.m_Height = this.m_Gump.Height; this.m_Draw = true; } }
public GImageClip(int GumpID, IHue Hue, int X, int Y, int Val, int Max) : base(X, Y) { this.m_fAlpha = 1f; this.m_GumpID = GumpID; this.m_Hue = Hue; this.m_Val = Val; this.m_Max = Max; this.m_Gump = this.m_Hue.GetGump(GumpID); if ((this.m_Gump != null) && !this.m_Gump.IsEmpty()) { this.m_Width = (int) (this.m_Gump.Width * this.Normal); this.m_Height = this.m_Gump.Height; this.m_Draw = true; } else { this.m_Width = this.m_Height = 0; this.m_Draw = false; } base.m_ITranslucent = true; }
public unsafe void Draw(Texture t, int x, int y, int color) { if (((this.m_xPool != x) || (this.m_yPool != y)) || (this.m_RenderVersion != Renderer.m_Version)) { this.m_RenderVersion = Renderer.m_Version; this.m_xPool = x; this.m_yPool = y; this.m_bPool = t.Draw(x, y, color, this.m_vPool); } else if (this.m_bPool) { fixed (CustomVertex.TransformedColoredTextured* texturedRef = this.m_vPool) { color = Renderer.GetQuadColor(color); texturedRef->Color = color; texturedRef[1].Color = color; texturedRef[2].Color = color; texturedRef[3].Color = color; Renderer.SetTexture(t); Renderer.DrawQuadPrecalc(texturedRef); } } }
public static unsafe int GetBrightness(Texture tex, int xStart, int yStart, int xStep, int yStep, int count) { LockData data = tex.Lock(LockFlags.ReadOnly); short* pvSrc = (short*) data.pvSrc; int num = data.Pitch >> 1; pvSrc += yStart * num; pvSrc += xStart; num *= yStep; num += xStep; int num2 = 0; for (int i = 0; i < count; i++) { short num4 = pvSrc[0]; num2 += (num4 & 0x1f) * 0x72; num2 += ((num4 >> 5) & 0x1f) * 0x24b; num2 += ((num4 >> 10) & 0x1f) * 0x12b; pvSrc += num; } tex.Unlock(); num2 = num2 << 3; num2 /= count; return (num2 / 0x3e8); }
public static TransparentDraw PoolInstance(Texture tex, int x, int y, bool hasAlpha, float theAlpha, bool xDouble) { if (m_Pool == null) { m_Pool = new Queue(); } if (m_Pool.Count > 0) { TransparentDraw draw = (TransparentDraw) m_Pool.Dequeue(); draw.m_Texture = tex; draw.m_X = x; draw.m_Y = y; if (!hasAlpha) { theAlpha = 1f; } theAlpha *= 0.5f; draw.m_bAlpha = true; draw.m_fAlpha = theAlpha; draw.m_Double = xDouble; return draw; } return new TransparentDraw(tex, x, y, hasAlpha, theAlpha, xDouble); }
public TextMessage(string Message, float Delay, IFont Font, IHue Hue) { this.m_Timestamp = Engine.Ticks; this.m_Image = Font.GetString(Message, Hue); this.m_Delay = new TimeDelay(Delay); }
public void DrawGame(Texture t, int x, int y) { if (this.m_vCache == null) { this.m_vCache = new AnimationVertexCache(); } this.m_vCache.DrawGame(t, x, y); }
protected internal unsafe override void Draw(int X, int Y) { if (this.m_ScrollTexture == null) { this.m_ScrollTexture = new Texture(0x10, 0x10, true); LockData data = this.m_ScrollTexture.Lock(LockFlags.WriteOnly); ushort num = Engine.C32216(GumpColors.ControlLightLight); ushort num2 = Engine.C32216(GumpColors.ScrollBar); for (int i = 0; i < 0x10; i++) { ushort* numPtr = (ushort*) (data.pvSrc + (i * data.Pitch)); for (int j = 0; j < 0x10; j++) { if ((((i & 1) + j) & 1) == 0) { numPtr++; numPtr[0] = num; } else { numPtr++; numPtr[0] = num2; } } } this.m_ScrollTexture.Unlock(); } this.m_ScrollTexture.Draw(X, Y, this.Width, this.Height); int barHeight = this.GetBarHeight(); int num6 = Y + 0x10; int num7 = this.Height - 0x20; int position = base.GetPosition(num7 - barHeight); Renderer.SetTexture(null); if (this.m_State == State.LargeScrollUp) { if (position > 0) { Renderer.SetAlphaEnable(true); Renderer.SetAlpha(0.9f); Renderer.SolidRect(GumpColors.ControlDarkDark, X, Y + this.Width, this.Width, position); Renderer.SetAlphaEnable(false); int num9 = base.PointToClient(new Point(Engine.m_xMouse, Engine.m_yMouse)).Y - 0x10; if (position > num9) { base.Value -= base.LargeOffset; } else { this.m_State = State.Inactive; } } } else if ((this.m_State == State.LargeScrollDown) && (((num7 - position) - barHeight) > 0)) { Renderer.SetAlphaEnable(true); Renderer.SetAlpha(0.9f); Renderer.SolidRect(GumpColors.ControlDarkDark, X, (num6 + position) + barHeight, this.Width, (num7 - position) - barHeight); Renderer.SetAlphaEnable(false); int num10 = base.PointToClient(new Point(Engine.m_xMouse, Engine.m_yMouse)).Y - 0x10; if ((position + barHeight) < num10) { base.Value += base.LargeOffset; } else { this.m_State = State.Inactive; } } GumpPaint.DrawRaised3D(X, num6 + position, 0x10, barHeight); if (this.m_State == State.SmallScrollUp) { GumpPaint.DrawFlat(X, Y, this.Width, this.Width); Renderer.SetAlphaEnable(true); Renderer.SetAlpha(1f); Engine.m_WinScrolls[0].Draw(X + 5, Y + 7, GumpColors.ControlText); Renderer.SetAlphaEnable(false); base.Value -= base.SmallOffset; } else { GumpPaint.DrawRaised3D(X, Y, this.Width, this.Width); Renderer.SetAlphaEnable(true); Renderer.SetAlpha(1f); Engine.m_WinScrolls[0].Draw(X + 4, Y + 6, GumpColors.ControlText); Renderer.SetAlphaEnable(false); } Renderer.SetTexture(null); if (this.m_State == State.SmallScrollDown) { GumpPaint.DrawFlat(X, (Y + this.Height) - this.Width, this.Width, this.Width); Renderer.SetAlphaEnable(true); Renderer.SetAlpha(1f); Engine.m_WinScrolls[1].Draw(X + 5, ((Y + this.Height) - this.Width) + 7, GumpColors.ControlText); Renderer.SetAlphaEnable(false); base.Value += base.SmallOffset; } else { GumpPaint.DrawRaised3D(X, (Y + this.Height) - this.Width, this.Width, this.Width); Renderer.SetAlphaEnable(true); Renderer.SetAlpha(1f); Engine.m_WinScrolls[1].Draw(X + 4, ((Y + this.Height) - this.Width) + 6, GumpColors.ControlText); Renderer.SetAlphaEnable(false); } }
protected internal override void OnDispose() { if (this.m_ScrollTexture != null) { this.m_ScrollTexture.Dispose(); } this.m_ScrollTexture = null; base.OnDispose(); }
public override bool Slice() { if ((Renderer.m_Frames - this.m_Start) >= 10) { return false; } int xWorld = Renderer.m_xWorld; int yWorld = Renderer.m_yWorld; int zWorld = Renderer.m_zWorld; int x = 0; int y = 0; int z = 0; int xOffset = 0; int yOffset = 0; int fOffset = 0; base.GetSource(out x, out y, out z); x -= xWorld; y -= yWorld; z -= zWorld; int num10 = ((Engine.GameWidth >> 1) - 0x16) + ((x - y) * 0x16); int num11 = (((Engine.GameHeight >> 1) + 11) + ((x + y) * 0x16)) - (z * 4); num10 += Engine.GameX; num11 += Engine.GameY; num10 -= Renderer.m_xScroll; num11 -= Renderer.m_yScroll; if ((base.m_Source != null) && (base.m_Source.GetType() == typeof(Mobile))) { Mobile source = (Mobile) base.m_Source; if (source.Walking.Count > 0) { WalkAnimation animation = (WalkAnimation) source.Walking.Peek(); if (animation.Snapshot(ref xOffset, ref yOffset, ref fOffset)) { num10 += xOffset; num11 += yOffset; } } } Texture gump = (Renderer.m_Dead ? Hues.Grayscale : this.m_Hue).GetGump(0x4e20 + (Renderer.m_Frames - this.m_Start)); if (this.m_tCache != gump) { this.m_tCache = gump; this.m_vCache.Invalidate(); } this.m_vCache.DrawGame(gump, num10 - (gump.Width / 2), num11 - gump.Height); return true; }
protected unsafe Texture Construct(bool isReconstruct) { int num; int num2; if (!this.CoreLookup()) { return Texture.Empty; } this.CoreGetDimensions(out num, out num2); Texture tex = new Texture(num, num2, true, 0x19, 1, isReconstruct); if (tex.IsEmpty()) { return Texture.Empty; } LockData data = tex.Lock(LockFlags.WriteOnly); this.CoreProcessImage(data.Width, data.Height, data.Pitch, (ushort*) data.pvSrc, (ushort*) (data.pvSrc + (data.Width * 2)), (ushort*) (data.pvSrc + (data.Height * data.Pitch)), (data.Pitch >> 1) - data.Width, data.Pitch >> 1); tex.Unlock(); this.CoreAssignArgs(tex); this.m_Textures.Add(tex); return tex; }
public void Remove(Texture tex) { this.m_Textures.Remove(tex); }