Пример #1
0
        public static void MakeInput(LauncherWindow game, LauncherWidget[] widgets, ref int widgetIndex,
                                     string text, int width, Anchor horAnchor, Anchor verAnchor,
                                     Font inputFont, Font inputHintFont, Action <int, int> onClick,
                                     bool password, int x, int y, int maxChars, string hint)
        {
            LauncherInputWidget widget;

            if (widgets[widgetIndex] != null)
            {
                widget = (LauncherInputWidget)widgets[widgetIndex];
            }
            else
            {
                widget               = new LauncherInputWidget(game);
                widget.OnClick       = onClick;
                widget.Password      = password;
                widget.MaxTextLength = maxChars;
                widget.HintText      = hint;
                widgets[widgetIndex] = widget;
            }

            widget.SetDrawData(game.Drawer, text, inputFont, inputHintFont,
                               horAnchor, verAnchor, width, 30, x, y);
            widgetIndex++;
        }
Пример #2
0
        public static void MakeInput( LauncherWindow game, LauncherWidget[] widgets, ref int widgetIndex,
            string text, int width, Anchor horAnchor, Anchor verAnchor,
            Font inputFont, Font inputHintFont, Action<int, int> onClick,
            bool password, int x, int y, int maxChars, string hint)
        {
            LauncherInputWidget widget;
            if( widgets[widgetIndex] != null ) {
                widget = (LauncherInputWidget)widgets[widgetIndex];
            } else {
                widget = new LauncherInputWidget( game );
                widget.OnClick = onClick;
                widget.Password = password;
                widget.MaxTextLength = maxChars;
                widget.HintText = hint;
                widgets[widgetIndex] = widget;
            }

            widget.SetDrawData( game.Drawer, text, inputFont, inputHintFont,
                               horAnchor, verAnchor, width, 30, x, y );
            widgetIndex++;
        }
Пример #3
0
        void TextChanged( LauncherInputWidget widget )
        {
            bool changed = false;
            int index = Array.IndexOf<LauncherWidget>( widgets, widget );
            if( index < 3 ) changed |= Parse( 0, ref LauncherSkin.BackgroundCol );
            else if( index < 6 ) changed |= Parse( 3, ref LauncherSkin.ButtonBorderCol );
            else if( index < 9 ) changed |= Parse( 6, ref LauncherSkin.ButtonHighlightCol );
            else if( index < 12 ) changed |= Parse( 9, ref LauncherSkin.ButtonForeCol );
            else if( index < 15 ) changed |= Parse( 12, ref LauncherSkin.ButtonForeActiveCol );

            if( !changed ) return;
            game.MakeBackground();
            Resize();
        }
Пример #4
0
 protected override void WidgetUnclicked( LauncherWidget widget )
 {
     LauncherInputWidget input = widget as LauncherInputWidget;
     if( input == null ) return;
     input.Active = false;
     RedrawWidget( input );
     lastInput = null;
     Dirty = true;
 }
Пример #5
0
        protected virtual void InputClick( int mouseX, int mouseY )
        {
            LauncherInputWidget input = (LauncherInputWidget)selectedWidget;
            using( drawer ) {
                drawer.SetBitmap( game.Framebuffer );
                if( lastInput != null ) {
                    lastInput.Active = false;
                    lastInput.Redraw( drawer );
                }

                input.Active = true;
                widgetOpenTime = DateTime.UtcNow;
                lastCaretFlash = false;
                input.SetCaretToCursor( mouseX, mouseY, drawer, inputFont );
                input.Redraw( drawer );
            }
            lastInput = input;
            Dirty = true;
        }