Exemplo n.º 1
0
        public virtual void ContextChanged(GraphicsControl context)
        {
            Context = context;

            if (parent == null)
            {
                if (Context != null)
                {
                    Context.ParentSizeChangedEvent += ParentSizeChanged;
                }
            }
            else
            {
                parent.ParentSizeChangedEvent -= ParentSizeChanged;
                parent.ParentSizeChangedEvent += ParentSizeChanged;
            }

            if (LastParentSize.Width != -1)
            {
                ParentSizeChanged(LastParentSize, GetParentSize());
            }
            else
            {
                LastParentSize = GetParentSize();
            }
            //Reload textures
        }
Exemplo n.º 2
0
        public OptionsMenu()
        {
            SetSize = MinSize = (800, 450);
            IoCManager.InjectDependencies(this);

            Title = Loc.GetString("ui-options-title");

            GraphicsControl  graphicsControl;
            KeyRebindControl rebindControl;
            AudioControl     audioControl;

            var tabs = new TabContainer
            {
                Children =
                {
                    (graphicsControl = new GraphicsControl(_configManager)),
                    (rebindControl   = new KeyRebindControl()),
                    (audioControl    = new AudioControl(_configManager,     _clydeAudio)),
                }
            };

            TabContainer.SetTabTitle(graphicsControl, Loc.GetString("ui-options-tab-graphics"));
            TabContainer.SetTabTitle(rebindControl, Loc.GetString("ui-options-tab-controls"));
            TabContainer.SetTabTitle(audioControl, Loc.GetString("ui-options-tab-audio"));

            Contents.AddChild(tabs);
        }
Exemplo n.º 3
0
 public Slider(GraphicsControl context, Dialog parent, DialogData data) : base(context, parent, "slider", data)
 {
     Images[(int)Race.Terran]  = new SingleTextureProperty("Assets\\Textures\\ui_glue_sliderframe_terran.dds");
     Images[(int)Race.Protoss] = new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_sliderframe.dds");
     Images[(int)Race.Zerg]    = new SingleTextureProperty("Assets\\Textures\\ui_glue_sliderframe_zerg.dds");
     ImageType = ImageType.Border;
 }
Exemplo n.º 4
0
 public ContextRef GetContextForGraphicsControl(GraphicsControl gc)
 {
     return(new ContextRef
     {
         gc = gc
     });
 }
Exemplo n.º 5
0
        public Button(GraphicsControl context, Dialog parent, DialogData data)
            : base(context, parent, "button", data)
        {
            ImageType = ImageType.EndCap;
            //Text = Name;
            TextStyles[(int)Race.Terran]       =
                TextStyles[(int)Race.Protoss]  =
                    TextStyles[(int)Race.Zerg] = FontParser.Fonts["StandardButton"];
            Images[(int)Race.Terran]           =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_terran.dds");
            Images[(int)Race.Protoss] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_protoss.dds");
            Images[(int)Race.Zerg] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_zerg.dds");
            HoverImages[(int)Race.Terran] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_terran.dds");
            HoverImages[(int)Race.Protoss] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_protoss.dds");
            HoverImages[(int)Race.Zerg] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_zerg.dds");

            ImageType     = ImageType.Border;
            Text          = Name;
            IsHalfTexture = true;
        }
Exemplo n.º 6
0
 // We use the left mouse button to do exclusive capture of the mouse so we can drag and drag
 // to rotate the cube without ever leaving the control
 private void OnGraphicsControlHwndLButtonDown(object sender, MouseEventArgs e)
 {
     _output.AppendLine("Mouse left button down");
     _previousPosition = e.GetPosition(this);
     GraphicsControl.CaptureMouse();
     GraphicsControl.Focus();
 }
Exemplo n.º 7
0
        private void AddShape(MouseButtonState state, Point mousePos)
        {
            int vertices = shapeDeclaration.VerticesPosition.Count;

            if (vertices == 1)
            {
                shapeDeclaration.VerticesPosition.Add(shapeDeclaration.VerticesPosition[0] + Vector2.One);
            }
            if (vertices != 0)
            {
                Shapes.Add(
                    new FixedBoundsShape(
                        shapeDeclaration.VerticesPosition,
                        shapeDeclaration.ViewportOffset.X,
                        shapeDeclaration.ViewportOffset.Y,
                        (int)ActualWidth,
                        (int)ActualHeight,
                        Color.Black,
                        graphicsDevice));
                ShapeAdded?.Invoke(this, EventArgs.Empty);
            }
            trackShape = InitializeShape;
            processedShape.Reset();
            GraphicsControl.Invalidate();
        }
        public SingleTextureProperty(string path, GraphicsControl context)
        {
            this.context = context;

            Texture = TextureLoader.Load(path, context.GraphicsDevice);
            Path = Texture != null ? path : "";
        }
 public ChildDialog(GraphicsControl sender, Rectangle rect, Dialog parent, DialogData data)
     : base(sender, rect, data)
 {
     ParentDialog = parent;
     //Parent = parent;
     ParentAttachPoint = Anchor.TopRight;
 }
Exemplo n.º 10
0
 public ChildDialog(GraphicsControl sender, Rectangle rect, Dialog parent, DialogData data)
     : base(sender, rect, data)
 {
     ParentDialog = parent;
     //Parent = parent;
     ParentAttachPoint = Anchor.TopRight;
 }
Exemplo n.º 11
0
        public Button(GraphicsControl context, Dialog parent, DialogData data)
            : base(context, parent, "button", data)
        {
            ImageType = ImageType.EndCap;
            //Text = Name;
            TextStyles[(int)Race.Terran] =
                TextStyles[(int)Race.Protoss] =
                TextStyles[(int)Race.Zerg] = FontParser.Fonts["StandardButton"];
            Images[(int)Race.Terran] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_terran.dds");
            Images[(int)Race.Protoss] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_protoss.dds");
            Images[(int)Race.Zerg] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normalpressed_zerg.dds");
            HoverImages[(int)Race.Terran] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_terran.dds");
            HoverImages[(int)Race.Protoss] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_protoss.dds");
            HoverImages[(int)Race.Zerg] =
                new SingleTextureProperty("Assets\\Textures\\ui_button_generic_normaloverpressedover_zerg.dds");

            ImageType = ImageType.Border;
            Text = Name;
            IsHalfTexture = true;
        }
Exemplo n.º 12
0
        public OptionsMenu()
        {
            IoCManager.InjectDependencies(this);

            Title = Loc.GetString("Game Options");

            GraphicsControl  graphicsControl;
            KeyRebindControl rebindControl;
            AudioControl     audioControl;

            var tabs = new TabContainer
            {
                Children =
                {
                    (graphicsControl = new GraphicsControl(_configManager)),
                    (rebindControl   = new KeyRebindControl()),
                    (audioControl    = new AudioControl(_configManager)),
                }
            };

            TabContainer.SetTabTitle(graphicsControl, Loc.GetString("Graphics"));
            TabContainer.SetTabTitle(rebindControl, Loc.GetString("Controls"));
            TabContainer.SetTabTitle(audioControl, Loc.GetString("Audio"));

            Contents.AddChild(tabs);
        }
        public SingleTextureProperty(string path, GraphicsControl context)
        {
            this.context = context;

            Texture = TextureLoader.Load(path, context.GraphicsDevice);
            Path    = Texture != null ? path : "";
        }
Exemplo n.º 14
0
        private void OnGraphicsControlMouseMove(object sender, MouseEventArgs e)
        {
            var position = e.GetPosition(this);
            var delta    = new Vector2((float)(position.X - _previousPosition.X), (float)(position.Y - _previousPosition.Y));

            // If the left or right buttons are down, we adjust the yaw and pitch of the cube
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                _yaw   += delta.X * .01f;
                _pitch += delta.Y * .01f;
                GraphicsControl.Invalidate();
            }

            if (e.RightButton == MouseButtonState.Pressed)
            {
                _cameraYaw   += delta.X * CameraRotSpeed;
                _cameraPitch += delta.Y * CameraRotSpeed;
            }

            if (e.MiddleButton == MouseButtonState.Pressed)
            {
                _cameraPosition += _camera.Left * CameraPanSpeed * delta.X;
                _cameraPosition += _camera.Up * CameraPanSpeed * delta.Y;
            }

            if (_lockCursor)
            {
                var scrPos = GraphicsControl.PointToScreen(_previousPosition);
                SetCursorPos((int)scrPos.X, (int)scrPos.Y);
            }
            else
            {
                _previousPosition = position;
            }
        }
Exemplo n.º 15
0
 public Slider(GraphicsControl context, Dialog parent, DialogData data)
     : base(context, parent, "slider", data)
 {
     Images[(int)Race.Terran] = new SingleTextureProperty("Assets\\Textures\\ui_glue_sliderframe_terran.dds");
     Images[(int)Race.Protoss] = new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_sliderframe.dds");
     Images[(int)Race.Zerg] = new SingleTextureProperty("Assets\\Textures\\ui_glue_sliderframe_zerg.dds");
     ImageType = ImageType.Border;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Frame" /> class.
 /// </summary>
 /// <param name="graphicsControl">The graphics control.</param>
 /// <param name="descriptor">The descriptor.</param>
 /// <param name="localColorTable">The local color table.</param>
 /// <param name="indices">The indices.</param>
 /// <param name="data">The data.</param>
 public Frame(GraphicsControl graphicsControl, ImageDescriptor descriptor, ColorTable localColorTable, FrameIndices indices, byte[] data)
 {
     Data            = data;
     Indices         = indices;
     Descriptor      = descriptor;
     LocalColorTable = localColorTable;
     GraphicsControl = graphicsControl;
 }
Exemplo n.º 17
0
 // We use the left mouse button to do exclusive capture of the mouse so we can drag and drag
 // to rotate the cube without ever leaving the control
 private void OnGraphicsControlHwndLButtonDown(object sender, MouseEventArgs e)
 {
     _previousPosition = e.GetPosition(this);
     GraphicsControl.CaptureMouse();
     GraphicsControl.Focus();
     this.Cursor = Cursors.None;
     _lockCursor = true;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Writes to the specified writer.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <returns>
 /// True if it writes successfully, false otherwise
 /// </returns>
 public override bool Write(EndianBinaryWriter writer)
 {
     GraphicsControl.Write(writer);
     Descriptor.Write(writer);
     LocalColorTable.Write(writer);
     Indices.Write(writer);
     return(true);
 }
Exemplo n.º 19
0
        public Label(GraphicsControl context, Dialog parent, DialogData data)
            : base(context, parent, "label", data)
        {
            Text = Name;

            TextStyles[(int)Race.Terran] =
                TextStyles[(int)Race.Protoss] =
                TextStyles[(int)Race.Zerg] = FontParser.Fonts["StandardLabel"];
        }
 public void ContextChanged(GraphicsControl context)
 {
     this.context = context;
     if (Path != null)
     {
         Texture = TextureLoader.Load(Path, context.GraphicsDevice);
         Path    = Texture != null ? Path : "";
     }
 }
Exemplo n.º 21
0
 public void Dispose()
 {
     if (IsDisposed)
     {
         return;
     }
     IsDisposed = true;
     GraphicsControl.Dispose();
 }
Exemplo n.º 22
0
        public Label(GraphicsControl context, Dialog parent, DialogData data)
            : base(context, parent, "label", data)
        {
            Text = Name;

            TextStyles[(int)Race.Terran]       =
                TextStyles[(int)Race.Protoss]  =
                    TextStyles[(int)Race.Zerg] = FontParser.Fonts["StandardLabel"];
        }
Exemplo n.º 23
0
 public Dialog(GraphicsControl sender, Rectangle rect, DialogData data) : base(sender, null, "dialog", data)
 {
     //Default values
     base.ImageType      = ImageType.Border;
     base.Position       = new Point(rect.X, rect.Y);
     base.Size           = new Size(rect.Width, rect.Height);
     BackgroundVisible   = true;
     base.RenderPriority = 512;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Hide all pages and show the default page (player tab)
 /// </summary>
 public void ShowDefaultPages()
 {
     WaitControl.Invoke(new Action(() => WaitControl.Visible           = false));
     PlayerControl.Invoke(new Action(() => PlayerControl.Visible       = false));
     GraphicsControl.Invoke(new Action(() => GraphicsControl.Visible   = false));
     ViewmodelControl.Invoke(new Action(() => ViewmodelControl.Visible = false));
     VisionControl.Invoke(new Action(() => VisionControl.Visible       = false));
     b0.Invoke(new Action(() => b0_Click(null, null)));
 }
 public void ContextChanged(GraphicsControl context)
 {
     this.context = context;
     if (Path != null)
     {
         Texture = TextureLoader.Load(Path, context.GraphicsDevice);
         Path = Texture != null ? Path : "";
     }
 }
Exemplo n.º 26
0
 public Dialog(GraphicsControl sender, Rectangle rect, DialogData data)
     : base(sender, null, "dialog", data)
 {
     //Default values
     base.ImageType = ImageType.Border;
     base.Position = new Point(rect.X, rect.Y);
     base.Size = new Size(rect.Width, rect.Height);
     BackgroundVisible = true;
     base.RenderPriority = 512;
 }
Exemplo n.º 27
0
 public ListBox(GraphicsControl context, Dialog parent, DialogData data) : base(context, parent, "listBox", data)
 {
     Images[(int)Race.Terran]  = new SingleTextureProperty("Assets\\Textures\\ui_glue_listboxframe_terran.dds");
     Images[(int)Race.Protoss] = new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_listboxframe.dds");
     Images[(int)Race.Zerg]    = new SingleTextureProperty("Assets\\Textures\\ui_glue_listboxframe_zerg.dds");
     ImageType = ImageType.Border;
     TextStyles[(int)Race.Terran]       =
         TextStyles[(int)Race.Protoss]  =
             TextStyles[(int)Race.Zerg] = FontParser.Fonts["StandardListBox"];
 }
Exemplo n.º 28
0
 public DialogControl(GraphicsControl context, Dialog parent, string baseName, DialogData data)
     : base(context, parent, baseName, data)
 {
     RenderPriority = 512;
     Enabled        = true;
     FullDialog     = false;
     Visible        = true;
     Text           = "";
     TintColors[0]  = TintColors[1] = TintColors[2] = Color.White;
     BlendMode      = BlendMode.Alpha;
 }
Exemplo n.º 29
0
 private void InitializeShape(MouseButtonState state, Point mousePos)
 {
     if (state == MouseButtonState.Pressed)
     {
         shapeDeclaration = new ShapeDeclaration(new Vector2(mousePos.X, mousePos.Y));
         processedShape.AddVertex(shapeDeclaration.ViewportOffset);
         processedShape.AddVertex(shapeDeclaration.ViewportOffset);
         trackShape = CaptureMousePosition;
         GraphicsControl.Invalidate();
     }
 }
Exemplo n.º 30
0
 public Pulldown(GraphicsControl context, Dialog parent, DialogData data) : base(context, parent, "pulldown", data)
 {
     Images[(int)Race.Terran]       = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_terran.dds");
     Images[(int)Race.Protoss]      = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_protoss.dds");
     Images[(int)Race.Zerg]         = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_zerg.dds");
     HoverImages[(int)Race.Terran]  = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_terran.dds");
     HoverImages[(int)Race.Protoss] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_protoss.dds");
     HoverImages[(int)Race.Zerg]    = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_zerg.dds");
     ImageType     = ImageType.EndCap;
     IsHalfTexture = true;
 }
 public DialogControl(GraphicsControl context, Dialog parent, string baseName, DialogData data)
     : base(context, parent, baseName, data)
 {
     RenderPriority = 512;
     Enabled = true;
     FullDialog = false;
     Visible = true;
     Text = "";
     TintColors[0] = TintColors[1] = TintColors[2] = Color.White;
     BlendMode = BlendMode.Alpha;
 }
Exemplo n.º 32
0
 public ListBox(GraphicsControl context, Dialog parent, DialogData data)
     : base(context, parent, "listBox", data)
 {
     Images[(int)Race.Terran] = new SingleTextureProperty("Assets\\Textures\\ui_glue_listboxframe_terran.dds");
     Images[(int)Race.Protoss] = new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_listboxframe.dds");
     Images[(int)Race.Zerg] = new SingleTextureProperty("Assets\\Textures\\ui_glue_listboxframe_zerg.dds");
     ImageType = ImageType.Border;
     TextStyles[(int) Race.Terran] =
         TextStyles[(int) Race.Protoss] =
         TextStyles[(int) Race.Zerg] = FontParser.Fonts["StandardListBox"];
 }
Exemplo n.º 33
0
 public Pulldown(GraphicsControl context, Dialog parent, DialogData data)
     : base(context, parent, "pulldown", data)
 {
     Images[(int)Race.Terran] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_terran.dds");
     Images[(int)Race.Protoss] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_protoss.dds");
     Images[(int)Race.Zerg] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normalpressed_zerg.dds");
     HoverImages[(int)Race.Terran] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_terran.dds");
     HoverImages[(int)Race.Protoss] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_protoss.dds");
     HoverImages[(int)Race.Zerg] = new SingleTextureProperty(@"Assets\Textures\ui_glue_dropdownbutton_normaloverpressedover_zerg.dds");
     ImageType = ImageType.EndCap;
     IsHalfTexture = true;
 }
Exemplo n.º 34
0
 public override void ContextChanged(GraphicsControl context)
 {
     base.ContextChanged(context);
     InitTextures(context);
     if (Image != null)
     {
         Image.ContextChanged(context);
     }
     foreach (DialogControl control in ChildControls)
     {
         control.ContextChanged(context);
     }
 }
Exemplo n.º 35
0
 public ProgressBar(GraphicsControl context, Dialog parent, DialogData data) : base(context, parent, "progressBar", data)
 {
     Images[(int)Race.Terran]       =
         Images[(int)Race.Protoss]  =
             Images[(int)Race.Zerg] =
                 new SingleTextureProperty(@"Assets\Textures\progress-queue.dds");
     TintColors[(int)Race.Terran]  = new Color(40, 125, 75);
     TintColors[(int)Race.Protoss] = new Color(35, 125, 254);
     TintColors[(int)Race.Zerg]    = new Color(229, 95, 5);
     ImageType     = ImageType.Normal;
     MaxValue      = 1f;
     IsHalfTexture = true;
 }
Exemplo n.º 36
0
        public PresentationPanel(Form parent, IGL gl)
        {
            GL = gl;

            GraphicsControl           = new GraphicsControl(GL);
            GraphicsControl.Dock      = DockStyle.Fill;
            GraphicsControl.BackColor = Color.Black;

            //pass through these events to the form. we might need a more scalable solution for mousedown etc. for zapper and whatnot.
            //http://stackoverflow.com/questions/547172/pass-through-mouse-events-to-parent-control (HTTRANSPARENT)

            // TODO
            //GraphicsControl.MouseClick += (o, e) => GlobalWin.MainForm.MainForm_MouseClick(o, e);
        }
Exemplo n.º 37
0
 static void InitTextures(GraphicsControl sender)
 {
     if (sender == null)
     {
         return;
     }
     if (_defaultTexture[0] != null)
     {
         return;
     }
     _defaultTexture[(int)Race.Terran]  = TextureLoader.Load("Assets\\Textures\\ui_frame_default_terran.dds", sender.GraphicsDevice);
     _defaultTexture[(int)Race.Protoss] = TextureLoader.Load("Assets\\Textures\\ui_frame_default_protoss.dds", sender.GraphicsDevice);
     _defaultTexture[(int)Race.Zerg]    = TextureLoader.Load("Assets\\Textures\\ui_frame_default_zerg.dds", sender.GraphicsDevice);
 }
Exemplo n.º 38
0
        /// <summary>
        /// Reads from the specified stream.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="globalColorTable">The global color table.</param>
        /// <param name="graphicsControl">The graphics control.</param>
        /// <param name="screenDescriptor">The screen descriptor.</param>
        /// <param name="frames">The frames.</param>
        /// <returns>
        /// The resulting frame.
        /// </returns>
        public static Frame Read(Stream stream, ColorTable globalColorTable, GraphicsControl graphicsControl, LogicalScreenDescriptor screenDescriptor, List <Frame> frames)
        {
            var        TempDescriptor  = ImageDescriptor.Read(stream);
            ColorTable LocalColorTable = TempDescriptor.LocalColorTableExists ?
                                         ColorTable.Read(stream, TempDescriptor.LocalColorTableSize) :
                                         globalColorTable;
            var TempIndices = FrameIndices.Read(stream, TempDescriptor);

            var Data = ReadFrameColors(TempIndices, LocalColorTable, graphicsControl, TempDescriptor, screenDescriptor, frames);

            Skip(stream, 0);

            return(new Frame(graphicsControl, TempDescriptor, LocalColorTable, TempIndices, Data));
        }
Exemplo n.º 39
0
        protected AbstractControl(GraphicsControl context, Dialog parent, string baseName, DialogData data)
        {
            this.parent = parent;
            Data        = data;
            Context     = context;
            if (parent == null)
            {
                if (Context != null)
                {
                    Context.ParentSizeChangedEvent += ParentSizeChanged;
                }
            }
            else
            {
                parent.ParentSizeChangedEvent += ParentSizeChanged;
            }
            //Find unique name
            int nr = 1;

            Name = baseName + nr;

            if (Context == null)
            {
                return;
            }

            for (int i = 0; i < Context.Items.Count; i++)
            {
                if (context.Items[i].Name == Name)
                {
                    nr++;
                    Name = baseName + nr;
                    i    = -1;
                    continue;
                }
                else
                {
                    for (int j = 0; j < Context.Items[i].ChildControls.Count; j++)
                    {
                        if (Context.Items[i].ChildControls[j].Name == Name)
                        {
                            nr++;
                            Name = baseName + nr;
                            i    = -1;
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 40
0
 public ProgressBar(GraphicsControl context, Dialog parent, DialogData data)
     : base(context, parent, "progressBar", data)
 {
     Images[(int) Race.Terran] =
         Images[(int) Race.Protoss] =
         Images[(int) Race.Zerg] =
         new SingleTextureProperty(@"Assets\Textures\progress-queue.dds");
     TintColors[(int)Race.Terran] = new Color(40, 125, 75);
     TintColors[(int)Race.Protoss] = new Color(35, 125, 254);
     TintColors[(int)Race.Zerg] = new Color(229, 95, 5);
     ImageType = ImageType.Normal;
     MaxValue = 1f;
     IsHalfTexture = true;
 }
Exemplo n.º 41
0
        // Invoked when the mouse moves over the second viewport
        private void OnGraphicsControlMouseMove(object sender, MouseEventArgs e)
        {
            var position = e.GetPosition(this);

            // If the left or right buttons are down, we adjust the yaw and pitch of the cube
            if (e.LeftButton == MouseButtonState.Pressed ||
                e.RightButton == MouseButtonState.Pressed)
            {
                _yaw   += (float)(position.X - _previousPosition.X) * .01f;
                _pitch += (float)(position.Y - _previousPosition.Y) * .01f;
                GraphicsControl.Invalidate();
            }

            _previousPosition = position;
        }
Exemplo n.º 42
0
 public CheckBox(GraphicsControl context, Dialog parent, DialogData data)
     : base(context, parent, "checkBox", data)
 {
     Images[(int)Race.Terran] =
         new SingleTextureProperty("Assets\\Textures\\ui_glue_checkbox_normalpressed_terran.dds");
     Images[(int)Race.Protoss] =
         new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_checkbox_normalpressed.dds");
     Images[(int)Race.Zerg] =
         new SingleTextureProperty("Assets\\Textures\\ui_glue_checkbox_normalpressed_zerg.dds");
     HoverImages[(int)Race.Terran] =
         new SingleTextureProperty("Assets\\Textures\\ui_glue_checkbox_normaloverpressedover_terran.dds");
     HoverImages[(int)Race.Protoss] =
         new SingleTextureProperty("Assets\\Textures\\ui_battlenet_glue_checkbox_normaloverpressedover.dds");
     HoverImages[(int)Race.Zerg] =
         new SingleTextureProperty("Assets\\Textures\\ui_glue_checkbox_normaloverpressedover_zerg.dds");
     ImageType = ImageType.Normal;
     IsHalfTexture = true;
 }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(StyleBrowserDialog));
     this.LBList = new System.Windows.Forms.ListBox();
     this.TBSearch = new System.Windows.Forms.TextBox();
     this.TBTestText = new System.Windows.Forms.TextBox();
     this.label1 = new System.Windows.Forms.Label();
     this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     this.BTNCancel = new System.Windows.Forms.Button();
     this.BTNOK = new System.Windows.Forms.Button();
     this.label2 = new System.Windows.Forms.Label();
     this.graphicsControl1 = new Galaxy_Editor_2.Dialog_Creator.GraphicsControl();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     this.splitContainer1.Panel1.SuspendLayout();
     this.splitContainer1.Panel2.SuspendLayout();
     this.splitContainer1.SuspendLayout();
     this.SuspendLayout();
     //
     // LBList
     //
     this.LBList.Dock = System.Windows.Forms.DockStyle.Fill;
     this.LBList.FormattingEnabled = true;
     this.LBList.Location = new System.Drawing.Point(0, 20);
     this.LBList.Name = "LBList";
     this.LBList.Size = new System.Drawing.Size(197, 336);
     this.LBList.Sorted = true;
     this.LBList.TabIndex = 0;
     this.LBList.SelectedIndexChanged += new System.EventHandler(this.LBList_SelectedIndexChanged);
     //
     // TBSearch
     //
     this.TBSearch.Dock = System.Windows.Forms.DockStyle.Top;
     this.TBSearch.Location = new System.Drawing.Point(0, 0);
     this.TBSearch.Name = "TBSearch";
     this.TBSearch.Size = new System.Drawing.Size(197, 20);
     this.TBSearch.TabIndex = 1;
     this.TBSearch.Visible = false;
     //
     // TBTestText
     //
     this.TBTestText.Dock = System.Windows.Forms.DockStyle.Bottom;
     this.TBTestText.Location = new System.Drawing.Point(0, 369);
     this.TBTestText.Name = "TBTestText";
     this.TBTestText.Size = new System.Drawing.Size(197, 20);
     this.TBTestText.TabIndex = 3;
     this.TBTestText.Text = "Hello world!";
     this.TBTestText.TextChanged += new System.EventHandler(this.TBTestText_TextChanged);
     //
     // label1
     //
     this.label1.AutoSize = true;
     this.label1.Dock = System.Windows.Forms.DockStyle.Bottom;
     this.label1.Location = new System.Drawing.Point(0, 356);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(48, 13);
     this.label1.TabIndex = 4;
     this.label1.Text = "Test text";
     //
     // splitContainer1
     //
     this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     this.splitContainer1.Name = "splitContainer1";
     //
     // splitContainer1.Panel1
     //
     this.splitContainer1.Panel1.Controls.Add(this.LBList);
     this.splitContainer1.Panel1.Controls.Add(this.label1);
     this.splitContainer1.Panel1.Controls.Add(this.TBSearch);
     this.splitContainer1.Panel1.Controls.Add(this.TBTestText);
     //
     // splitContainer1.Panel2
     //
     this.splitContainer1.Panel2.Controls.Add(this.BTNCancel);
     this.splitContainer1.Panel2.Controls.Add(this.BTNOK);
     this.splitContainer1.Panel2.Controls.Add(this.label2);
     this.splitContainer1.Panel2.Controls.Add(this.graphicsControl1);
     this.splitContainer1.Size = new System.Drawing.Size(596, 389);
     this.splitContainer1.SplitterDistance = 197;
     this.splitContainer1.TabIndex = 5;
     //
     // BTNCancel
     //
     this.BTNCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.BTNCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.BTNCancel.Location = new System.Drawing.Point(308, 363);
     this.BTNCancel.Name = "BTNCancel";
     this.BTNCancel.Size = new System.Drawing.Size(75, 23);
     this.BTNCancel.TabIndex = 3;
     this.BTNCancel.Text = "Cancel";
     this.BTNCancel.UseVisualStyleBackColor = true;
     //
     // BTNOK
     //
     this.BTNOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.BTNOK.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.BTNOK.Location = new System.Drawing.Point(227, 363);
     this.BTNOK.Name = "BTNOK";
     this.BTNOK.Size = new System.Drawing.Size(75, 23);
     this.BTNOK.TabIndex = 4;
     this.BTNOK.Text = "OK";
     this.BTNOK.UseVisualStyleBackColor = true;
     //
     // label2
     //
     this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     this.label2.AutoSize = true;
     this.label2.BackColor = System.Drawing.Color.Transparent;
     this.label2.Location = new System.Drawing.Point(3, 372);
     this.label2.Name = "label2";
     this.label2.Size = new System.Drawing.Size(209, 13);
     this.label2.TabIndex = 5;
     this.label2.Text = "Text is not rendered exactly as it is ingame.";
     //
     // graphicsControl1
     //
     this.graphicsControl1.DisableMouseControl = false;
     this.graphicsControl1.DisplayRace = Galaxy_Editor_2.Dialog_Creator.Enums.Race.Terran;
     this.graphicsControl1.Dock = System.Windows.Forms.DockStyle.Fill;
     this.graphicsControl1.EditDisplayRaceOnly = false;
     this.graphicsControl1.Location = new System.Drawing.Point(0, 0);
     this.graphicsControl1.Name = "graphicsControl1";
     this.graphicsControl1.Size = new System.Drawing.Size(395, 389);
     this.graphicsControl1.TabIndex = 2;
     this.graphicsControl1.Text = "graphicsControl1";
     this.graphicsControl1.SizeChanged += new System.EventHandler(this.graphicsControl1_SizeChanged);
     //
     // StyleBrowserDialog
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize = new System.Drawing.Size(596, 389);
     this.Controls.Add(this.splitContainer1);
     this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name = "StyleBrowserDialog";
     this.Text = "Style Browser";
     this.Load += new System.EventHandler(this.StyleBrowserDialog_Load);
     this.splitContainer1.Panel1.ResumeLayout(false);
     this.splitContainer1.Panel1.PerformLayout();
     this.splitContainer1.Panel2.ResumeLayout(false);
     this.splitContainer1.Panel2.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     this.splitContainer1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
Exemplo n.º 44
0
 public override void ContextChanged(GraphicsControl context)
 {
     base.ContextChanged(context);
     InitTextures(context);
     if (Image != null)
         Image.ContextChanged(context);
     foreach (DialogControl control in ChildControls)
     {
         control.ContextChanged(context);
     }
 }
Exemplo n.º 45
0
 static void InitTextures(GraphicsControl sender)
 {
     if (sender == null)
         return;
     if (_defaultTexture[0] != null)
         return;
     _defaultTexture[(int)Race.Terran] = TextureLoader.Load("Assets\\Textures\\ui_frame_default_terran.dds", sender.GraphicsDevice);
     _defaultTexture[(int)Race.Protoss] = TextureLoader.Load("Assets\\Textures\\ui_frame_default_protoss.dds", sender.GraphicsDevice);
     _defaultTexture[(int)Race.Zerg] = TextureLoader.Load("Assets\\Textures\\ui_frame_default_zerg.dds", sender.GraphicsDevice);
 }
 public override void ContextChanged(GraphicsControl context)
 {
     if (context == null)
         return;
     foreach (SingleTextureProperty image in Images)
     {
         if (image != null)
             image.ContextChanged(context);
     }
     foreach (SingleTextureProperty image in HoverImages)
     {
         if (image != null)
             image.ContextChanged(context);
     }
     base.ContextChanged(context);
 }
 public SingleTextureProperty(GraphicsControl context)
 {
     this.context = context;
 }
 public SingleTextureProperty(string path, Texture2D texture, GraphicsControl context)
 {
     this.context = context;
     Path = path;
     Texture = texture;
 }