2using System.Collections.Generic;
4using System.Reflection;
7using Microsoft.Xna.Framework;
8using Microsoft.Xna.Framework.Input;
9using Microsoft.Xna.Framework.Graphics;
21 public static void AddToggleButton()
27 AddOnMouseDown = (e) => ToggleEquip(),
31 public static void ToggleEquip()
33 if (GlassFrame !=
null)
35 GlassFrame.RemoveSelf();
55 public override void CleanUp()
65 public override void Draw(SpriteBatch spriteBatch)
67 if (Timing.TotalTime - lastDrawn > 0.05)
69 lastDrawn = Timing.TotalTime;
71 GameMain.Instance.GraphicsDevice.GetBackBufferData<Color>(backBuffer);
72 texture.SetData(backBuffer);
74 texture.GetData<Color>(
75 0,
new Rectangle((
int)
Real.Left, (
int)
Real.Top, 40, 40), Data, 0, Data.Length
80 base.Draw(spriteBatch);
85 Size =
new Point(40, 40);
89 int w = GameMain.Instance.GraphicsDevice.PresentationParameters.BackBufferWidth;
90 int h = GameMain.Instance.GraphicsDevice.PresentationParameters.BackBufferHeight;
92 backBuffer =
new Color[w * h];
94 texture =
new Texture2D(GameMain.Instance.GraphicsDevice, w, h,
false, GameMain.Instance.GraphicsDevice.PresentationParameters.BackBufferFormat);
CUIAnchor is just a Vector2 This is a static class containing some helper methods.
Allows you to manipulate pixel data of its texture.
void SetData()
Call this method to transfer values from Data array into texture.
virtual Point Size
Size of the internal texture Will automatically resize the texture and data array of set.
SamplerState SamplerState
don't
CUINullRect Relative
Relative to parent size and position, [0..1].
Color BackgroundColor
Color of BackgroundSprite, default is black If you're using custom sprite and don't see it make sur...
Vector2 Anchor
this point of this component
CUIRect Real
Calculated prop, position on real screen in pixels Should be fully calculated after CUIMainComponent....
int? ZIndex
Components are drawn in order of their ZIndex Normally it's derived from component position in the ...
Color OutlineColor
Outline is like a border, but on the outside of the component.
CUINullRect Absolute
Absolute size and position in pixels.
Draggable and resizable container for other components.
In fact a static class managing static things.
static CUIMainComponent TopMain
Orchestrates Drawing and updates, there could be only one CUI.TopMain is located above vanilla GUI.
It's a debug tool, you can use it with cuimg command, it's very fps comsuming.
override void Draw(SpriteBatch spriteBatch)
Here component should be drawn.