public UserInterfaceUpdateCommand(Hud hud, IRenderCommand uiRCommand)
     : base(CommandType.Update)
 {
     this.hud = hud;
     uiUpdateThread = new Thread(Activate) {Name = "UI Update Thread", Priority = ThreadPriority.Lowest};
     EventHandle = new ManualResetEventSlim(false);
     this.uiRCommand = uiRCommand;
     taskQueue = new Queue<UpdateTask>();
 }
 public UserInterfaceRenderCommand(Renderer renderer, Hud hud, RenderableNode rNode)
     : base(renderer, new UIMaterial(),
         new RenderableCollection(UIMaterial.ItemsDescription, new [] {rNode}))
 {
     CommandType = CommandType.UserInterfaceRenderCommand;
     CommandAttributes |= Graphics.CommandAttributes.MonoRendering;
     this.hud = hud;
     textMaterial = new TextMaterial();
     this.rNode = rNode;
     this.rNode.RenderableObject.Material = Material;
     tNode = (TransformNode)rNode.Parent;
     UpdateSprites(hud.SpriteControls);
     textTechnique = textMaterial.EffectDescription.Technique;
     textPass = textTechnique.GetPassByIndex(textMaterial.EffectDescription.Pass);
     textLayout = new InputLayout(Game.Context.Device, textPass.Description.Signature,
         TextItems.Description.InputElements);
 }
示例#3
0
        public GradientEditor()
        {
            InitializeComponent();
            shaderDictionary = new SortedDictionary<string, LinearShader>();
            cbControls.Items.Add("Button");
            cbControls.SelectedIndex = 0;
            tbSize.Text = "96; 32";
            mainHud = OdysseyUI.CurrentHud;

            cbGType.SelectedIndex = 2;

            widgetTextureRenderer = new WidgetTextureRenderer(320, 320, Game.Context);

            gradientBuilder.SelectedMarkerOffsetChanged += GradientBuilderSelectedMarkerOffsetChanged;
            gradientBuilder.SelectedMarkerColorChanged += GradientBuilderSelectedMarkerColorChanged;
            gradientBuilder.MarkersChanged += GradientBuilderMarkersChanged;
            shouldSave = true;
        }
示例#4
0
        public static string Export(Hud hud)
        {
            if (hud.Controls.IsEmpty)
                throw Error.ArgumentInvalid("controls", typeof (CSExporter), "Export");

            StringBuilder sb = new StringBuilder();

            XmlHud xmlHud = new XmlHud(hud);
            xmlHud.WriteCSharpCode(sb);

            sb.AppendLine("\nHud.BeginDesign();");

            foreach (XmlBaseControl xmlControl in from baseControl in hud.Controls.Where(ctl => ctl.IsVisible)
                                                  let xmlControlType = UIParser.GetWrapperTypeForControl(baseControl.GetType())
                                                  select (XmlBaseControl) Activator.CreateInstance(xmlControlType, baseControl))
            {
                xmlControl.WriteCSharpCode(sb);
            }

            xmlHud.WriteContainerCSCode(sb);

            return sb.ToString();
        }
示例#5
0
 public XmlHud(Hud hud)
     : base(hud)
 {
 }
示例#6
0
        public static Hud FromDescription(Device device, HudDescription description)
        {
            Hud hud = new Hud
                          {
                              AbsolutePosition = Vector2.Zero,
                              Size = new Size(description.Width, description.Height),
                              HudDescription = description,
                              Depth = new Depth
                                          {
                                              WindowLayer = (int) description.ZFar,
                                              ComponentLayer = (int) description.ZFar,
                                              ZOrder = description.ZFar
                                          },
                          };
            Device = device;

            if (description.CameraEnabled)
            {
                ICamera camera = Game.CurrentRenderer.Camera;
                hud.SetBinding(new KeyBinding(KeyAction.StrafeLeft, Keys.A, delegate() { camera.Strafe(-QuaternionCam.DefaultSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.StrafeRight, Keys.D, delegate() { camera.Strafe(QuaternionCam.DefaultSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.MoveForward, Keys.W, delegate() { camera.Move(QuaternionCam.DefaultSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.MoveBackward, Keys.S, delegate() { camera.Move(-QuaternionCam.DefaultSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.RotateLeft, Keys.Z, delegate() { camera.RotateY(QuaternionCam.DefaultRotationSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.RotateRight, Keys.C, delegate() { camera.RotateY(-QuaternionCam.DefaultRotationSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.HoverUp, Keys.Q, delegate() { camera.Hover(QuaternionCam.DefaultSpeed); }));
                hud.SetBinding(new KeyBinding(KeyAction.HoverDown, Keys.E, delegate() { camera.Hover(-QuaternionCam.DefaultSpeed); }));

                if (Game.Context.Settings.IsStereo)
                {
                    StereoCamera stereoCamera = (StereoCamera)camera;
                    hud.SetBinding(new KeyBinding(KeyAction.IncreaseSeparation, Keys.Add,
                        delegate() { stereoCamera.ModifySeparation(StereoCamera.DefaultIncrement); }));
                    hud.SetBinding(new KeyBinding(KeyAction.DecreaseSeparation, Keys.Subtract,
                        delegate() { stereoCamera.ModifySeparation(-StereoCamera.DefaultIncrement); }));
                    hud.SetBinding(new KeyBinding(KeyAction.DecreaseConvergence, Keys.Divide,
                        delegate() { stereoCamera.ModifyConvergence(-StereoCamera.DefaultIncrement); }));
                    hud.SetBinding(new KeyBinding(KeyAction.IncreaseConvergence, Keys.Multiply,
                        delegate() { stereoCamera.ModifyConvergence(StereoCamera.DefaultIncrement); }));
                    hud.SetBinding( new KeyBinding(KeyAction.None, Keys.F,
                    delegate() { Game.Context.ResizeDevice(new Size(1920,1080), true); }));

                }
            }

            return hud;
        }
示例#7
0
 public void AddLoggerPanelToHud(Hud hud)
 {
     hud.Controls.Add(loggerPanel);
 }