コード例 #1
0
ファイル: TileSelector.cs プロジェクト: jpx/blazera
        public TileSelector(Int32 width = DEFAULT_SIZE, Int32 height = DEFAULT_SIZE)
            : base()
        {
            Width = width;
            Height = height;

            VMainBox = new VAutoSizeBox(false);
            HMidleBox = new HAutoSizeBox();

            MultiBox = new MultiBox(Alignment.Vertical, Height, Width);
            MultiBox.SetSize(Width);
            MultiBox.OnVPointerChange += new PointerChangeEventHandler(MultiBox_OnVPointerChange);
            MultiBox.OnHPointerChange += new PointerChangeEventHandler(MultiBox_OnHPointerChange);

            VScrollBar = new VScrollBar();
            VScrollBar.Scrolled += new ScrollEventHandler(VScrollBar_Scrolled);
            HScrollBar = new HScrollBar();
            HScrollBar.Scrolled += new ScrollEventHandler(HScrollBar_Scrolled);

            AddWidget(VMainBox);

            VMainBox.AddItem(HMidleBox, 0, HAlignment.Right);
            HMidleBox.AddItem(MultiBox);
            HMidleBox.AddItem(VScrollBar);

            VMainBox.AddItem(HScrollBar);
        }
コード例 #2
0
ファイル: MessageBox.cs プロジェクト: jpx/blazera
        public MessageBox()
            : base()
        {
            Padding = DEFAULT_PADDING;

            MainBox = new HAutoSizeBox();
            MainBox.Position = GetGlobalFromLocal(new Vector2f());
            AddWidget(MainBox);

            Messages = new List<string>();
            MessageBuilder = new MessageBuilder(new MessageBuilder.CInfo(
                new Vector2f(MAX_WIDTH, MAX_HEIGHT),
                GameData.DEFAULT_FONT,
                Label.GetSizeFromESize(DEFAULT_TEXT_SIZE),
                DEFAULT_TEXT_STYLES));

            InteractiveMode = true;

            CurrentMessageLabel = new Label(null, DEFAULT_TEXT_COLOR, DEFAULT_TEXT_SIZE);
            CurrentMessageLabel.Style = DEFAULT_TEXT_STYLES;
            MainBox.AddItem(CurrentMessageLabel, 0, VAlignment.Top);
            LetterTimer = new Timer();

            IsPlaying = false;
            IsLooping = false;
            MessageIsCompleted = false;

            CurrentMessage = 0;
            CurrentLetter = 0;
        }
コード例 #3
0
ファイル: DialogBox.cs プロジェクト: eickegao/Blazera
        private ConfirmationDialogBox()
            : base("Confirmation")
        {
            ButtonBox = new HAutoSizeBox();
            AddItem(ButtonBox, 0, HAlignment.Center);

            YesButton = new Button("Yes", Button.EMode.BackgroundLabel, true);
            YesButton.Clicked += new ClickEventHandler(YesButton_Clicked);
            ButtonBox.AddItem(YesButton);

            NoButton = new Button("No", Button.EMode.BackgroundLabel, true);
            NoButton.Clicked += new ClickEventHandler(NoButton_Clicked);
            ButtonBox.AddItem(NoButton);
        }
コード例 #4
0
ファイル: UpDownBox.cs プロジェクト: eickegao/Blazera
        public UpDownBox(
            Int32 minValue = DEFAULT_MIN_VALUE,
            Int32 maxValue = DEFAULT_MAX_VALUE,
            Int32 scaleValue = DEFAULT_SCALE_VALUE,
            Int32 defaultValue = DEFAULT_DEFAULT_VALUE,
            String label = null,
            LabeledWidget.EMode mode = DEFAULT_MODE,
            Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base(label, mode, shortCutMode)
        {
            MinValue = minValue;
            MaxValue = maxValue;
            ScaleValue = scaleValue;
            DefaultValue = defaultValue;

            MainBox = new HAutoSizeBox(true, null, 0);

            ButtonBox = new VAutoSizeBox(true, null, 0);

            DownBtn = new Button(Create.Texture("Gui_DownButtonN"), Create.Texture("Gui_DownButtonO"));
            DownBtn.Dimension *= BUTTON_RESIZE_FACTOR;
            DownBtn.Clicked += new ClickEventHandler(DownBtn_Clicked);
            AddWidget(DownBtn);

            UpBtn = new Button(Create.Texture("Gui_UpButtonN"), Create.Texture("Gui_UpButtonO"));
            UpBtn.Dimension *= BUTTON_RESIZE_FACTOR;
            UpBtn.Clicked += new ClickEventHandler(UpBtn_Clicked);

            ButtonBox.AddItem(UpBtn);
            ButtonBox.AddItem(DownBtn);

            TextBox = new TextBox(BlazeraLib.TextBox.EInputType.Numeric);

            SetCurrentValue(GetDefaultValue());
            TextBox.Dimension = new SFML.Window.Vector2f(40F, UpBtn.Dimension.Y + DownBtn.Dimension.Y);

            TextBox.TextAdded += new TextAddedEventHandler(TextBox_TextAdded);
            AddWidget(TextBox);

            ValueIsModified = false;

            MainBox.AddItem(TextBox);
            MainBox.AddItem(ButtonBox);

            AddLabeledWidget(MainBox);

            GetLabelWidget().Clicked += new ClickEventHandler(UpDownBox_Clicked);
        }
コード例 #5
0
ファイル: RadioButton.cs プロジェクト: jpx/blazera
        public RadioButton(Alignment alignment = DEFAULT_ALIGNMENT)
            : base()
        {
            RadioButtons = new Dictionary<Item, CheckEventHandler>();

            Alignment = alignment;

            if (Alignment == Alignment.Horizontal)
            {
                HBox = new HAutoSizeBox();
                AddWidget(HBox);
            }
            else
            {
                VBox = new VAutoSizeBox();
                AddWidget(VBox);
            }
        }
コード例 #6
0
ファイル: LabeledWidget.cs プロジェクト: eickegao/Blazera
        public LabeledWidget(Texture picture = null, EMode mode = DEFAULT_MODE)
            : base()
        {
            if (picture != null)
            {
                Mode = mode;
                Type = EType.Picture;

                Picture = new Button(picture, null);
                Picture.Dimension = new SFML.Window.Vector2f(DEFAULT_PICTURE_SIZE, DEFAULT_PICTURE_SIZE);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(VBox); break;
                }
            }
        }
コード例 #7
0
ファイル: ExtendedBox.cs プロジェクト: eickegao/Blazera
        protected ExtendedBox(EType type = DEFAULT_TYPE, Boolean noBorderMode = true, Int32 size = DEFAULT_SIZE)
            : base()
        {
            Size = size;
            CurrentPointer = 0;

            ExtendedItems = new List<Widget>();

            Type = type;

            if (Type == EType.Vertical)
            {
                VMainBox = new VAutoSizeBox(noBorderMode);
                AddWidget(VMainBox);
            }
            else
            {
                HMainBox = new HAutoSizeBox(noBorderMode);
                AddWidget(HMainBox);
            }
        }
コード例 #8
0
ファイル: LabeledWidget.cs プロジェクト: eickegao/Blazera
        public LabeledWidget(String label = null, EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            if (label != null)
            {
                Mode = mode;
                Type = EType.Label;

                Label = new Button(label, Button.EMode.Label);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null); AddWidget(VBox); break;
                }

                ShortCutMode = shortCutMode;

                if (Label.Text.Length > 0)
                    ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
            }
        }
コード例 #9
0
ファイル: Menu.cs プロジェクト: eickegao/Blazera
 protected virtual void InitBox()
 {
     if (Alignment == BlazeraLib.Alignment.Vertical)
     {
         VMainBox = new VAutoSizeBox(true, null, ItemOffset);
         VMainBox.Position = GetGlobalFromLocal(new Vector2f());
         AddWidget(VMainBox);
     }
     else
     {
         HMainBox = new HAutoSizeBox(true, null, ItemOffset);
         HMainBox.Position = GetGlobalFromLocal(new Vector2f());
         AddWidget(HMainBox);
     }
 }
コード例 #10
0
ファイル: ExtendedBox.cs プロジェクト: eickegao/Blazera
        private void RefreshBox()
        {
            if (Alignment == BlazeraLib.Alignment.Vertical)
                GetVMainBox().Clear();
            else
                GetHMainBox().Clear();

            for (Int32 vCount = CurrentVPointer; vCount < CurrentVPointer + GetCurrentVSize(); vCount++)
            {
                List<Widget> newList = GetItems(vCount, CurrentHPointer, GetCurrentHSize(vCount));

                if (Alignment == BlazeraLib.Alignment.Vertical)
                {
                    HAutoSizeBox HB = new HAutoSizeBox(true, null, 0F);
                    HB.AddItem(newList, 0, VAlignment.Top);
                    GetVMainBox().AddItem(HB, 0, HAlignment.Left);
                }
                else
                {
                    VAutoSizeBox VB = new VAutoSizeBox(true, null, 0F);
                    VB.AddItem(newList, 0, HAlignment.Center);
                    GetHMainBox().AddItem(VB, 0, VAlignment.Center);
                }
            }
        }