Beispiel #1
0
        /// <summary>
        /// Constructs a CheckBox object based on the params
        /// </summary>
        /// <param name="parms">CheckBoxParams object</param>
        public CheckBox(CheckBoxParams parms) : base(parms)
        {
            this.Checked = parms.Checked;

            StaticDrawable2DParams imgParms = new StaticDrawable2DParams {
                Position           = parms.Position,
                LightColour        = parms.LightColour,
                Scale              = parms.Scale,
                RenderingRectangle = Constants.CHK_BOX_UNCHECKED,
                Texture            = LoadingUtils.load <Texture2D>(parms.Content, Constants.GUI_FILE_NAME),
                Origin             = new Vector2(Constants.CHK_BOX_UNCHECKED.Width / 2, Constants.CHK_BOX_UNCHECKED.Height / 2)
            };

            this.uncheckedBoxImag = new StaticDrawable2D(imgParms);
            Vector3 min = new Vector3(parms.Position.X - Constants.CHK_BOX_CHECKED.Width / 2,
                                      parms.Position.Y - Constants.CHK_BOX_CHECKED.Height / 2, 0f);
            Vector3 max = new Vector3(parms.Position.X + Constants.CHK_BOX_CHECKED.Width / 2,
                                      parms.Position.Y + Constants.CHK_BOX_CHECKED.Height / 2, 0f);

            this.bbox = new BoundingBox(min, max);

            imgParms.RenderingRectangle = Constants.CHK_BOX_CHECKED;
            this.checkedBoxImag         = new StaticDrawable2D(imgParms);

            Text2DParams textParms = new Text2DParams {
                Position    = new Vector2(parms.Position.X + 40f, parms.Position.Y),
                LightColour = parms.LightColour,
                WrittenText = parms.Text,
                Scale       = parms.Scale,
                Font        = parms.Font,
                Origin      = new Vector2(Constants.CHK_BOX_UNCHECKED.Width / 2, Constants.CHK_BOX_UNCHECKED.Height / 2)
            };

            this.text = new Text2D(textParms);
        }
Beispiel #2
0
        /// <summary>
        /// Constructs a SoundEngineSlider object based on the parms
        /// </summary>
        /// <param name="parms">SoundEngineSliderParams object</param>
        public SoundEngineSlider(SoundEngineSliderParams parms) : base(parms)
        {
            this.soundEngine = parms.SoundEngine;
            CheckBoxParams checkBoxParams = new CheckBoxParams {
                Checked     = parms.Checked,
                Content     = parms.Content,
                Font        = parms.Font,
                LightColour = parms.LightColour,
                Position    = parms.CheckBoxPosition,
                Text        = parms.CheckBoxText
            };

            this.checkBox = new CheckBox(checkBoxParams);
        }