void MakeWidgets()
        {
            widgetIndex = 0;
            MakeAllRGBTriplets(false);
            MakeLabelAt("Background", inputFont, Anchor.Centre, Anchor.Centre, -60, -100);
            MakeLabelAt("Button border", inputFont, Anchor.Centre, Anchor.Centre, -65, -60);
            MakeLabelAt("Button highlight", inputFont, Anchor.Centre, Anchor.Centre, -75, -20);
            MakeLabelAt("Button foreground", inputFont, Anchor.Centre, Anchor.Centre, -85, 20);
            MakeLabelAt("Active button foreground", inputFont, Anchor.Centre, Anchor.Centre, -110, 60);
            MakeLabelAt("Red", titleFont, Anchor.Centre, Anchor.Centre, 30, -130);
            MakeLabelAt("Green", titleFont, Anchor.Centre, Anchor.Centre, 95, -130);
            MakeLabelAt("Blue", titleFont, Anchor.Centre, Anchor.Centre, 160, -130);

            MakeButtonAt("Default colours", 160, 35, titleFont, Anchor.Centre,
                         0, 120, (x, y) => ResetColours());
            MakeButtonAt("Back", 80, 35, titleFont, Anchor.Centre,
                         0, 170, (x, y) => game.SetScreen(new MainScreen(game)));
            for (int i = 0; i < widgets.Length; i++)
            {
                LauncherInputWidget input = widgets[i] as LauncherInputWidget;
                if (input != null)
                {
                    input.TextChanged = TextChanged;
                }
            }
        }
        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)
            {
                game.MakeBackground();
                Resize();
            }
        }
Esempio n. 3
0
        protected override void WidgetUnclicked(LauncherWidget widget)
        {
            LauncherInputWidget input = widget as LauncherInputWidget;

            if (input == null)
            {
                return;
            }
            using ( drawer ) {
                drawer.SetBitmap(game.Framebuffer);
                input.Active = false;
                input.Redraw(drawer);
            }
            lastInput = null;
            Dirty     = true;
        }
Esempio n. 4
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;
        }
Esempio n. 5
0
        protected void MakeInput(string text, int width, Anchor horAnchor, Anchor verAnchor,
                                 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       = InputClick;
                widget.Password      = password;
                widget.MaxTextLength = maxChars;
                widget.HintText      = hint;
                widgets[widgetIndex] = widget;
            }

            widget.SetDrawData(drawer, text, inputFont, inputHintFont, horAnchor, verAnchor, width, 30, x, y);
            widgetIndex++;
        }
        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 ) {
                game.MakeBackground();
                Resize();
            }
        }
 protected override void WidgetUnclicked( LauncherWidget widget )
 {
     LauncherInputWidget input = widget as LauncherInputWidget;
     if( input == null ) return;
     using( drawer ) {
         drawer.SetBitmap( game.Framebuffer );
         input.Active = false;
         input.Redraw( drawer );
     }
     lastInput = null;
     Dirty = true;
 }
        protected void MakeInput( string text, int width, Anchor horAnchor, Anchor verAnchor,
            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 = InputClick;
                widget.Password = password;
                widget.MaxTextLength = maxChars;
                widget.HintText = hint;
                widgets[widgetIndex] = widget;
            }

            widget.SetDrawData( drawer, text, inputFont, inputHintFont, horAnchor, verAnchor, width, 30, x, y );
            widgetIndex++;
        }
        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;
        }