protected override void Init() { base.Init(); Memory.MainThreadOnlyActions.Enqueue(ThreadUnsafeOperations); // TODO: make a font render that can draw right to left from a point. For Right aligning the names. var atbBarPos = new Rectangle(SIZE[0].X + 230, SIZE[0].Y + 12, ATBWidth, 15); ITEM[0, (byte)DepthID.Name] = new Text(); ITEM[0, (byte)DepthID.HP] = new Integer { Spaces = 4, NumType = Icons.NumType.Num8X16A }; ITEM[0, (byte)DepthID.GFHPBox] = new Box { Options = Box_Options.Right | Box_Options.Middle }; ITEM[0, (byte)DepthID.GFHPBox].Hide(); ITEM[0, (byte)DepthID.GFNameBox] = new Box { Options = Box_Options.Center | Box_Options.Middle }; ITEM[0, (byte)DepthID.GFNameBox].Hide(); ITEM[0, (byte)DepthID.ATBBorder] = new Icon { Data = Icons.ID.Size_08x64_Bar, Palette = 0 }; ITEM[0, (byte)DepthID.ATBCharged] = new Texture { Color = Color.LightYellow * ATBAlpha, Faded_Color = new Color(125, 125, 0, 255) * ATBAlpha }; ITEM[0, (byte)DepthID.ATBCharged].Hide(); ITEM[0, (int)DepthID.ATBCharging] = ATB.Create(atbBarPos); ITEM[0, (int)DepthID.GFCharging] = GF.Create(atbBarPos); ((ATB)ITEM[0, (byte)DepthID.ATBCharging]).Color = Color.Orange * ATBAlpha; ((ATB)ITEM[0, (byte)DepthID.ATBCharging]).Faded_Color = Color.Orange * ATBAlpha; ((ATB)ITEM[0, (byte)DepthID.ATBCharging]).Refresh(Damageable); }
public void ThreadUnsafeOperations() { if (_dot == null) { if (Memory.IsMainThread) { var texture2D = new Texture2D(Memory.Graphics.GraphicsDevice, 4, 4); var tmp = new Color[texture2D.Height * texture2D.Width]; for (var i = 0; i < tmp.Length; i++) { tmp[i] = Color.White; } texture2D.SetData(tmp); _dot = texture2D; ATB.ThreadUnsafeOperations(ATBWidth); } else { throw new Exception("Must be in main thread!"); } } if (_dot != null) { ((Texture)(ITEM[0, (byte)DepthID.ATBCharged])). Data = _dot; } }