Exemplo n.º 1
0
        public Input2DComponent(string ghostText, SpriteFont font, Color ghostTextColor, Color inputTextColor, Color caretColor, float minFontSize = 0, float maxFontSize = 1, Alignment textAlignment = Alignment.MiddleLeft)
        {
            // Text input handler
            Game.gameWindow.Window.TextInput += TextInput;

            InputTextComponent = new Text2DComponent(" ", font, inputTextColor, minFontSize, maxFontSize, textAlignment, false, 10);
            GhostTextComponent = new Text2DComponent(ghostText + " ", font, ghostTextColor, minFontSize, maxFontSize, textAlignment, false, 11);
            InputButton        = new Button2DComponent(new Action(OnClick), new Action(OnClickOutside));
            Caret = new Image2DComponent(DefaultValues.PixelTexture, caretColor, 12);

            Font           = font;
            GhostTextColor = ghostTextColor;
            InputTextColor = inputTextColor;
        }
Exemplo n.º 2
0
        public Slider2DComponent(float min, float max, Orientation orientation, bool allowDecimals = false)
        {
            // Prevents update slider methodfrom runnins before the parent is allocated
            IsUpdating = true;

            MinValue      = min;
            MaxValue      = max;
            Orientation   = orientation;
            AllowDecimals = allowDecimals;

            Bar          = new Image2DComponent(DefaultValues.PixelTexture, Color.DarkGray, Alignment.TopLeft, 0);
            Fill         = new Image2DComponent(DefaultValues.PixelTexture, Color.Gray, Alignment.TopLeft, 1);
            Handle       = new Image2DComponent(DefaultValues.PixelTexture, Color.White, Alignment.TopCenter, 2);
            HandleButton = new Button2DComponent(onPress: () => MoveHandle());
            IsUpdating   = false;
        }
Exemplo n.º 3
0
 public override void Start()
 {
     Button = new Button2DComponent(OnClick, OnClickOutside, new Action(OnCheckClick), OnPress, OnHover, OnEnter, OnExit);
     Image  = new Image2DComponent(IsDown ? DownTexture : UpTexture, IsDown ? DownColor : UpColor);
     ChkObj = new Object2D("Check_" + LinkedObject.ObjectName, LinkedObject.Position, LinkedObject.Size, LinkedObject.Rotation, new Component2D[] { Image, Button }, LinkedObject.Align, LinkedObject.Layer, LinkedObject);
 }