Exemplo n.º 1
0
        public override void Initialize()
        {
            int offset = 350;

            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 5, offset, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 30, offset, "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 55, offset, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 80, offset, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 105, offset, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 130, offset, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 155, offset, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 180, offset, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            hcDragScene = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 205, offset, "Drag Scene", Settings.k_DragScene);
            controls.Add(hcDragScene);
            hcGhostRotateCW = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 230, offset, "Rotate component clockwise", Settings.k_ComponentRotateCW);
            controls.Add(hcGhostRotateCW);
            hcGhostRotateCCW = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 255, offset, "Rotate component counterclockwise", Settings.k_ComponentRotateCCW);
            controls.Add(hcGhostRotateCCW);
            #endregion

            base.Initialize();
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            int offset = 350;
            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 5, offset, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 30, offset, "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 55, offset, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 80, offset, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 105, offset, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 130, offset, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 155, offset, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 180, offset, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            hcDragScene = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 205, offset, "Drag Scene", Settings.k_DragScene);
            controls.Add(hcDragScene);
            hcGhostRotateCW = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 230, offset, "Rotate component clockwise", Settings.k_ComponentRotateCW);
            controls.Add(hcGhostRotateCW);
            hcGhostRotateCCW = new Elements.HotkeyControl((int)Position.X + 5, (int)Position.Y + 255, offset, "Rotate component counterclockwise", Settings.k_ComponentRotateCCW);
            controls.Add(hcGhostRotateCCW);
            #endregion

            base.Initialize();
        }
Exemplo n.º 3
0
        public new void Initialize()
        {
            #region Basic
            Layer = 100000;
            ShouldBeScaled = false;

            var a = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.GetEnumerator();
            a.MoveNext();
            maxw = a.Current.Width;
            maxh = a.Current.Height;
            a.MoveNext();
            while (true)//DO NOT TOUCH THIS CYCLE OR ELSE MONO GETS SCARED!!!
            {
                try
                {
                    if (a.Current == null)
                        break;
                }
                catch { System.Threading.Thread.Sleep(1); }
                try
                {
                    if (a.Current == null)
                        break;
                }
                catch { break; }
                try
                {
                    if (a.Current.Width > maxw) maxw = a.Current.Width;
                    if (a.Current.Height > maxh) maxh = a.Current.Height;
                }
                catch { }
                a.MoveNext();
            }
            #endregion

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(410, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sb.onClicked +=new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            sac = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Save");
            (sac as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sac.foreground = Color.White;
            //sac.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sac.onClicked += new Elements.Button.ClickedEventHandler(sacClick);
            controls.Add(sac);

            ap = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Apply");
            (ap as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            ap.foreground = Color.White;
            //ap.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            ap.onClicked += new Elements.Button.ClickedEventHandler(apClick);
            controls.Add(ap);
            #endregion

            #region MasterVolume
            Elements.Label l1 = new Elements.Label(10, 20, "Master Volume");
            l1.foreground = Color.White;
            controls.Add(l1);

            mv = new Elements.ScrollBar(170, 24, 200, 20);
            mv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mv_onValueChanged);
            mv.MinValue = 0;
            mv.MaxValue = 100;
            mv.Value = (int)(Settings.MasterVolume * 100);
            controls.Add(mv);
            #endregion

            #region EffectVolume
            Elements.Label l11 = new Elements.Label(10, 50, "Effects Volume");
            l11.foreground = Color.White;
            controls.Add(l11);

            ev = new Elements.ScrollBar(170, 54, 200, 20);
            ev.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(ev_onValueChanged);
            ev.MinValue = 0;
            ev.MaxValue = 100;
            ev.Value = (int)(Settings.EffectsVolume * 100);
            controls.Add(ev);
            #endregion

            #region MusicVolume
            Elements.Label l111 = new Elements.Label(10, 80, "Music Volume");
            l111.foreground = Color.White;
            controls.Add(l111);

            mzv = new Elements.ScrollBar(170, 84, 200, 20);
            mzv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mzv_onValueChanged);
            mzv.MinValue = 0;
            mzv.MaxValue = 100;
            mzv.Value = (int)(Settings.MusicVolume * 100);
            controls.Add(mzv);
            #endregion

            #region Resoulutions
            lar = new Elements.Label(400, 20, "Aspect ratio:");
            lar.foreground = Color.White;
            controls.Add(lar);

            ar = new Elements.ComboBox(550, 22, 120, 24);
            ar.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(ar_onElementSelected);
            controls.Add(ar);
            ar.ItemsAdd("4*3");
            ar.ItemsAdd("5*3");
            if (maxw >= 1280 && maxh >= 720) ar.ItemsAdd("16*9");
            if (maxw >= 1280 && maxh >= 800) ar.ItemsAdd("16*10");

            lres = new Elements.Label(400, 50, "Resolution:");
            lres.foreground = Color.White;
            controls.Add(lres);

            res = new Elements.ComboBox(550, 52, 120, 24);
            res.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(res_onElementSelected);
            controls.Add(res);

            fs = new Elements.CheckBox(400, 90, 170, 20, "FullScreen", false);
            fs.foreground = Color.White;
            controls.Add(fs);
            #endregion

            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl(5, 125, 250, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl(5, 150, 250,  "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl(5, 175, 250, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl(5,    200, 250, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl(5, 250, 250, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl(5, 275, 250, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl(5, 300, 250, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl(5, 325, 250, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            #endregion

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }
Exemplo n.º 4
0
        public new void Initialize()
        {
            #region Basic
            Layer          = 100000;
            ShouldBeScaled = false;

            var a = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.GetEnumerator();
            a.MoveNext();
            maxw = a.Current.Width;
            maxh = a.Current.Height;
            a.MoveNext();
            while (true)//DO NOT TOUCH THIS CYCLE OR ELSE MONO GETS SCARED!!!
            {
                try
                {
                    if (a.Current == null)
                    {
                        break;
                    }
                }
                catch { System.Threading.Thread.Sleep(1); }
                try
                {
                    if (a.Current == null)
                    {
                        break;
                    }
                }
                catch { break; }
                try
                {
                    if (a.Current.Width > maxw)
                    {
                        maxw = a.Current.Width;
                    }
                    if (a.Current.Height > maxh)
                    {
                        maxh = a.Current.Height;
                    }
                }
                catch { }
                a.MoveNext();
            }
            #endregion

            #region ControlButtons
            sb = new Elements.EncyclopediaBrowserButton(410, 440, 120, 30, "Back");
            (sb as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sb.foreground = Color.White;
            //sb.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sb.onClicked += new Elements.Button.ClickedEventHandler(sbClick);
            controls.Add(sb);

            sac = new Elements.EncyclopediaBrowserButton(540, 440, 120, 30, "Save");
            (sac as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            sac.foreground = Color.White;
            //sac.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            sac.onClicked += new Elements.Button.ClickedEventHandler(sacClick);
            controls.Add(sac);

            ap = new Elements.EncyclopediaBrowserButton(670, 440, 120, 30, "Apply");
            (ap as Elements.EncyclopediaBrowserButton).OverrideTexture("GUI/Menus/ButtonBackground2");
            ap.foreground = Color.White;
            //ap.font = ResourceManager.Load<SpriteFont>("Fonts/MenuFont");
            ap.onClicked += new Elements.Button.ClickedEventHandler(apClick);
            controls.Add(ap);
            #endregion

            #region MasterVolume
            Elements.Label l1 = new Elements.Label(10, 20, "Master Volume");
            l1.foreground = Color.White;
            controls.Add(l1);

            mv = new Elements.ScrollBar(170, 24, 200, 20);
            mv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mv_onValueChanged);
            mv.MinValue        = 0;
            mv.MaxValue        = 100;
            mv.Value           = (int)(Settings.MasterVolume * 100);
            controls.Add(mv);
            #endregion

            #region EffectVolume
            Elements.Label l11 = new Elements.Label(10, 50, "Effects Volume");
            l11.foreground = Color.White;
            controls.Add(l11);

            ev = new Elements.ScrollBar(170, 54, 200, 20);
            ev.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(ev_onValueChanged);
            ev.MinValue        = 0;
            ev.MaxValue        = 100;
            ev.Value           = (int)(Settings.EffectsVolume * 100);
            controls.Add(ev);
            #endregion

            #region MusicVolume
            Elements.Label l111 = new Elements.Label(10, 80, "Music Volume");
            l111.foreground = Color.White;
            controls.Add(l111);

            mzv = new Elements.ScrollBar(170, 84, 200, 20);
            mzv.onValueChanged += new Elements.ScrollBar.ValueChangedEventHandler(mzv_onValueChanged);
            mzv.MinValue        = 0;
            mzv.MaxValue        = 100;
            mzv.Value           = (int)(Settings.MusicVolume * 100);
            controls.Add(mzv);
            #endregion

            #region Resoulutions
            lar            = new Elements.Label(400, 20, "Aspect ratio:");
            lar.foreground = Color.White;
            controls.Add(lar);

            ar = new Elements.ComboBox(550, 22, 120, 24);
            ar.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(ar_onElementSelected);
            controls.Add(ar);
            ar.ItemsAdd("4*3");
            ar.ItemsAdd("5*3");
            if (maxw >= 1280 && maxh >= 720)
            {
                ar.ItemsAdd("16*9");
            }
            if (maxw >= 1280 && maxh >= 800)
            {
                ar.ItemsAdd("16*10");
            }

            lres            = new Elements.Label(400, 50, "Resolution:");
            lres.foreground = Color.White;
            controls.Add(lres);

            res = new Elements.ComboBox(550, 52, 120, 24);
            res.onElementSelected += new Elements.ComboBox.ElementSelectedHandler(res_onElementSelected);
            controls.Add(res);

            fs            = new Elements.CheckBox(400, 90, 170, 20, "FullScreen", false);
            fs.foreground = Color.White;
            controls.Add(fs);
            #endregion

            #region Hotkeys
            hcSimStart = new Elements.HotkeyControl(5, 125, 250, "Simulation start", Settings.k_SimulationStart);
            controls.Add(hcSimStart);
            hcSimStop = new Elements.HotkeyControl(5, 150, 250, "Simulation stop", Settings.k_SimulationStop);
            controls.Add(hcSimStop);
            hcSimPause = new Elements.HotkeyControl(5, 175, 250, "Simulation pause", Settings.k_SimulationPause);
            controls.Add(hcSimPause);
            hcUndo = new Elements.HotkeyControl(5, 200, 250, "Undo", Settings.k_Undo);
            controls.Add(hcUndo);
            hcCompRem = new Elements.HotkeyControl(5, 250, 250, "Remove single component", Settings.k_ComponentRemove);
            controls.Add(hcCompRem);
            hcEraser = new Elements.HotkeyControl(5, 275, 250, "Eraser", Settings.k_Eraser);
            controls.Add(hcEraser);
            hcZoomIn = new Elements.HotkeyControl(5, 300, 250, "Zoom In", Settings.k_ZoomIn);
            controls.Add(hcZoomIn);
            hcZoomOut = new Elements.HotkeyControl(5, 325, 250, "Zoom Out", Settings.k_ZoomOut);
            controls.Add(hcZoomOut);
            #endregion

            base.Initialize();
            background = GUIEngine.s_mainMenu.background;
        }