//TODO: Events should be used.
        public vxSandboxItemButton(
            vxEngine vxEngine,
            Texture2D buttonImage,
            string Text,
            string ElementKey,
            Vector2 position,
            int Width,
            int Height)
        {
            Position = position;

            this.Text = Text;

            this.Key = ElementKey;

            ButtonImage       = buttonImage;
            BoundingRectangle = new Rectangle((int)Position.X, (int)Position.Y, Width, Height);
            this.vxEngine     = vxEngine;

            Color_Normal    = Color.White;
            Color_Highlight = Color.LightYellow;

            this.Width  = Width;
            this.Height = Height;
        }
        /// <summary>
        /// Tells the GUI Manager too update each of the Gui Items
        /// </summary>
        /// <param name="vxEngine"></param>
        public void Update(vxEngine vxEngine)
        {
            // The GUI Manager Draws and Updates it's items from the back forwards. It
            // only allows one item to have focus, which is the most forward item with the mouse
            // over it.


            DoesGuiHaveFocus = false;

            if (this.FocusedItem == null)
            {
                foreach (vxGUIBaseItem guiItem in List_GUIItems)
                {
                    guiItem.Alpha = this.Alpha;
                    guiItem.Update(vxEngine);

                    if (guiItem.HasFocus == true)
                    {
                        DoesGuiHaveFocus = true;
                    }
                }
            }
            else
            {
                this.FocusedItem.Update(vxEngine);
            }
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.Controls.vxToolbarButton"/> class.
        /// </summary>
        /// <param name="vxEngine">The current Vertices vxEngine Instance</param>
        /// <param name="Content">Content Manager too load the Textures with.</param>
        /// <param name="TexturesPath">Path to the textures, note a 'hover texture' must be present with a '_hover' suffix</param>
        public vxToolbarButton(vxEngine vxEngine, ContentManager Content, string TexturesPath)
        {
            //Get the current Game vxEngine
            this.vxEngine = vxEngine;

            //Position is Set by Toolbar
            Position = Vector2.Zero;

            //Set Button Images
            ButtonImage      = Content.Load <Texture2D>(TexturesPath);
            HoverButtonImage = Content.Load <Texture2D>(TexturesPath + "_hover");

            //Set Initial Bounding Rectangle
            Width             = ButtonImage.Width;
            Height            = ButtonImage.Height;
            BoundingRectangle = new Rectangle(0, 0, Width, Height);

            //Set Default Colours
            Color_Normal    = Color.White;
            Color_Highlight = Color.DarkOrange;

            //Setup initial Events to handle mouse sounds
            this.OnInitialHover += this_OnInitialHover;
            this.Clicked        += this_Clicked;
        }
示例#4
0
        /// <summary>
        /// Draws the GUI Item
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        public override void Draw(vxEngine vxEngine)
        {
            base.Draw(vxEngine);

            viewport = vxEngine.GraphicsDevice.Viewport;

            //
            //Draw Button
            //
            vxEngine.SpriteBatch.Begin();
            Color ColorReq = Colour;

            if (HasFocus)
            {
                ColorReq = Color.Black;
            }

            vxEngine.SpriteBatch.Draw(BackTexture, Rec_Back, ColorReq * 0.5f);
            vxEngine.SpriteBatch.End();

            foreach (vxGUIBaseItem bsGuiItm in Items)
            {
                bsGuiItm.Draw(vxEngine);
            }
        }
示例#5
0
        public override void DrawByOwner(vxEngine vxEngine)
        {
            base.DrawByOwner(vxEngine);

            //
            //Update Rectangle
            //
            BoundingRectangle = new Rectangle((int)(Position.X), (int)(Position.Y),
                                              ButtonWidth, ButtonHeight);

            //
            //Draw Button
            //
            float i = 1;

            if (HasFocus)
            {
                i = 1.250f;
            }
            vxEngine.SpriteBatch.Draw(vxEngine.Assets.Textures.Blank, BoundingRectangle, Color_Normal * i);
            vxEngine.SpriteBatch.Draw(ButtonImage, new Rectangle((int)(Position.X + 2), (int)(Position.Y + 2),
                                                                 ButtonHeight - 4, ButtonHeight - 4), Color.LightGray * i);

            vxEngine.SpriteBatch.DrawString(vxEngine.vxGUITheme.Font, "Name: " + Text,
                                            new Vector2((int)(Position.X + ButtonHeight + Padding * 2), (int)(Position.Y + 8)),
                                            Colour_Text);
            vxEngine.SpriteBatch.DrawString(vxEngine.Assets.Fonts.DebugFont, "Path: " + FilePath,
                                            new Vector2((int)(Position.X + ButtonHeight + Padding * 2), (int)(Position.Y + vxEngine.vxGUITheme.Font.MeasureString(Text).Y + 10)),
                                            Colour_Text);
        }
示例#6
0
        public override void Update(vxEngine vxEngine)
        {
            base.Update(vxEngine);

            //Update Rectangle
            BoundingRectangle = new Rectangle((int)(Position.X - Padding), (int)(Position.Y - Padding / 2), Width, Height + Padding / 2);
        }
示例#7
0
        public override void DrawByOwner(vxEngine vxEngine)
        {
            base.DrawByOwner(vxEngine);

            //Draw Regular Image
            vxEngine.SpriteBatch.Draw(ButtonImage, BoundingRectangle, Color_Normal * Alpha);

            /*
             * //Draw Hover Items
             * if(DrawHoverBackground)
             *      vxEngine.SpriteBatch.Draw(vxEngine.Assets.Textures.Blank, BoundingRectangle, Color_Highlight * HoverAlpha * Alpha);
             */
            if (HoverButtonImage != null)
            {
                vxEngine.SpriteBatch.Draw(HoverButtonImage, BoundingRectangle, Color_Highlight * HoverAlpha * Alpha);
            }


            if (IsTogglable && ToggleState)
            {
                if (HoverButtonImage != null)
                {
                    vxEngine.SpriteBatch.Draw(HoverButtonImage, BoundingRectangle, Color_Normal);
                }
            }
        }
        public vxCamera3D(vxEngine vxEngine, Vector3 position, float pitch, float yaw, Matrix projectionMatrix, CameraType CameraType)
        {
            this.vxEngine = vxEngine;

            Position   = position;
            Yaw        = yaw;
            Pitch      = pitch;
            Projection = projectionMatrix;

            Speed = 10;

            mFieldOfView = MathHelper.PiOver4;
            mAspectRatio = 600 / 800;
            mNearPlane   = 0.1f;
            mFarPlane    = 1000;

            this.CameraType = CameraType;

            calcProjectionMatrix();

            if (CameraType == CameraType.ChaseCamera)
            {
                Reset();
            }
        }
        /// <summary>
        /// Sets up a Serve List Dialog Item which holds information pertaining too a Discovered Server.
        /// </summary>
        /// <param name="vxEngine"></param>
        /// <param name="ServerName"></param>
        /// <param name="ServerAddress"></param>
        /// <param name="ServerPort"></param>
        /// <param name="Position"></param>
        /// <param name="buttonImage"></param>
        /// <param name="ElementIndex"></param>
        public vxServerListItem(vxEngine vxEngine,
                                string ServerName,
                                string ServerAddress,
                                string ServerPort,
                                Vector2 Position,
                                Texture2D buttonImage,
                                int ElementIndex) : base(vxEngine, ServerName, Position, buttonImage, ElementIndex)
        {
            Padding = 4;

            this.ServerName    = ServerName;
            this.ServerAddress = ServerAddress;
            this.ServerPort    = ServerPort;

            Text             = ServerName;
            this.Position    = Position;
            OriginalPosition = Position;

            Index             = ElementIndex;
            ButtonImage       = buttonImage;
            BoundingRectangle = new Rectangle(0, 0, 64, 64);
            this.vxEngine     = vxEngine;

            Width = 3000;

            Color_Normal    = new Color(0.15f, 0.15f, 0.15f, 0.5f);
            Color_Highlight = Color.DarkOrange;
            Colour_Text     = Color.LightGray;
        }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.Controls.vxTextbox"/> class.
        /// </summary>
        /// <param name="vxEngine">Engine.</param>
        /// <param name="text">Text.</param>
        /// <param name="position">Position.</param>
        /// <param name="length">Length.</param>
        public vxTextbox(vxEngine vxEngine, string text, Vector2 position, int length)
        {
            //Set the Engine
            this.vxEngine = vxEngine;

            //Set Text
            Text = text;

            //Set Textbox Length
            Textbox_Length = length;
            Width          = length;

            //Set Position
            Position = position;

            //Set Justification
            InputJustification = InputJustification.All;

            //Set Colours
            Color_Normal    = vxEngine.vxGUITheme.vxTextboxes.BackgroundColour;
            Color_Highlight = vxEngine.vxGUITheme.vxTextboxes.BackgroundHoverColour;

            Colour_Text = vxEngine.vxGUITheme.vxTextboxes.TextColour;

            this.Font = vxEngine.vxGUITheme.Font;

            //Get Text Height
            Textbox_height = Math.Max(Textbox_height, (int)this.Font.MeasureString(Text).Y + Padding / 2);

            //Set the Bounding Rectangle from Text height, Width is set seperately
            BoundingRectangle = new Rectangle((int)(Position.X - Padding), (int)(Position.Y - Padding / 2), length, Textbox_height);
        }
        /// <summary>
        /// Calculates the cursor ray.
        /// </summary>
        /// <returns>The cursor ray.</returns>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="projectionMatrix">Projection matrix.</param>
        /// <param name="viewMatrix">View matrix.</param>
        public static Ray CalculateCursorRay(vxEngine vxEngine, Matrix projectionMatrix, Matrix viewMatrix)
        {
            Vector2    Position   = new Vector2();
            MouseState mouseState = Mouse.GetState();

            Position.X = Math.Max(0, mouseState.X);
            Position.Y = Math.Max(0, mouseState.Y);

            // create 2 positions in screenspace using the cursor position. 0 is as
            // close as possible to the camera, 1 is as far away as possible.
            Vector3 nearSource = new Vector3(Position, 0f);
            Vector3 farSource  = new Vector3(Position, 1f);

            // use Viewport.Unproject to tell what those two screen space positions
            // would be in world space. we'll need the projection matrix and view
            // matrix, which we have saved as member variables. We also need a world
            // matrix, which can just be identity.
            Vector3 nearPoint = vxEngine.GraphicsDevice.Viewport.Unproject(nearSource,
                                                                           projectionMatrix, viewMatrix, Matrix.Identity);

            Vector3 farPoint = vxEngine.GraphicsDevice.Viewport.Unproject(farSource,
                                                                          projectionMatrix, viewMatrix, Matrix.Identity);

            // find the direction vector that goes from the nearPoint to the farPoint
            // and normalize it....
            Vector3 direction = farPoint - nearPoint;

            direction.Normalize();

            // and then create a new ray using nearPoint as the source.
            return(new Ray(nearPoint, direction));
        }
示例#12
0
 public override void Draw(vxEngine vxEngine)
 {
     base.Draw(vxEngine);
     vxEngine.SpriteBatch.Begin();
     DrawByOwner(vxEngine);
     vxEngine.SpriteBatch.End();
 }
示例#13
0
        public override void Update(vxEngine vxEngine)
        {
            MouseState mouseState = vxEngine.InputManager.MouseState;

            if (mouseState.X > BoundingRectangle.Left && mouseState.X < BoundingRectangle.Right &&
                mouseState.Y < BoundingRectangle.Bottom && mouseState.Y > BoundingRectangle.Top)
            {
                if (mouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton == ButtonState.Released)
                {
                    Select();
                }
                else if (IsSelected == false)
                {
                    Hover();
                }
            }
            else if (mouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton == ButtonState.Released ||
                     IsSelected == false)
            {
                NotHover();
            }


            //Set State for next Loop
            PreviousMouseState = mouseState;

            if (IsSelected == true)
            {
                ProcessKeyInputs(0.0167f);
            }
        }
示例#14
0
        public vxThemeDialog(vxEngine Engine) : base(Engine)
        {
            Width  = 150;
            Height = 24;

            TextJustification = TextJustification.Center;

            BackgroundColour      = Color.LightGray;
            BackgroundHoverColour = Color.White;

            TextColour = Color.White;
            TextHover  = Color.White;


            Header_BackgroundImage = Engine.Assets.Textures.Blank;

            Header_Padding  = new Vector2(10, 10);
            Header_FineTune = new Vector2(0);

            int s = 35;

            Header_TextColour = new Color(s, s, s, 255);
            Header_TextHover  = Color.Black;

            Header_BackgroundColour      = Color.Gray;
            Header_BackgroundHoverColour = Color.DarkOrange;

            Header_BorderWidth = 1;
            Header_DoBorder    = false;
        }
        /// <summary>
        /// Updates the GUI Item
        /// </summary>
        /// <param name="mouseState">Mouse state.</param>
        public override void Update(vxEngine vxEngine)
        {
            base.Update(vxEngine);

            //Recalculate the Bounding rectangle each loop
            BoundingRectangle = new Rectangle((int)Position.X, (int)Position.Y, Width, Height);

            scrollBar.Position = new Vector2(
                BoundingRectangle.X + BoundingRectangle.Width - Padding - scrollBar.BarWidth,
                BoundingRectangle.Y + Padding);

            scrollBar.Update(vxEngine);

            //vxConsole.WriteToInGameDebug ("=> " + );
            float dif = Vector2.Subtract(Position, PositionPreviousFrame).Length();

            //foreach (vxGUIBaseItem bsGuiItm in Items)
            for (int i = 0; i < Items.Count; i++)
            {
                Items[i].Position = this.Position + PaddingVector + Items[i].OriginalPosition
                                    - new Vector2(0, (scrollBar.Percentage * (scrollBar.ScrollLength - this.Height + 2 * Padding)));

                if (this.HasFocus && dif < 0.05f)
                {
                    Items[i].Update(vxEngine);
                }
                else
                {
                    Items[i].NotHover();
                }
            }

            PositionPreviousFrame = this.Position;
        }
示例#16
0
        /// <summary>
        /// Takes a Screenshot and returns it as a Texture 2D
        /// </summary>
        /// <returns></returns>
        public static Texture2D TakeScreenshot(vxEngine vxEngine)
        {
            int w = vxEngine.GraphicsDevice.PresentationParameters.BackBufferWidth;
            int h = vxEngine.GraphicsDevice.PresentationParameters.BackBufferHeight;

#if VRTC_PLTFRM_XNA
            //force a frame to be drawn (otherwise back buffer is empty)
            vxEngine.Draw(new GameTime());

            //pull the picture from the buffer
            int[] backBuffer = new int[w * h];
            vxEngine.GraphicsDevice.GetBackBufferData(backBuffer);

            //copy into a texture
            Texture2D texture = new Texture2D(vxEngine.GraphicsDevice, w, h, false, vxEngine.GraphicsDevice.PresentationParameters.BackBufferFormat);
            texture.SetData(backBuffer);
            return(texture);

            /*
             * //save to disk
             * Stream streampng = File.OpenWrite(Path + ".png");
             * texture.SaveAsPng(streampng, w, h);
             * streampng.Dispose();
             * texture.Dispose();
             */
#else
            RenderTarget2D screenshot = new RenderTarget2D(vxEngine.GraphicsDevice, w, h);
            vxEngine.GraphicsDevice.SetRenderTarget(screenshot);
            //force a frame to be drawn (otherwise back buffer is empty)
            vxEngine.Draw(new GameTime());
            vxEngine.GraphicsDevice.SetRenderTarget(null);
            return(screenshot);           // new Texture2D(Game.GraphicsDevice, 1,1);
#endif
        }
示例#17
0
        public vxDialogArtProvider(vxEngine engine) : base(engine)
        {
            DefaultWidth  = 150;
            DefaultHeight = 24;

            Alpha = 1;

            TitleTextColour       = Color.Black;
            TitleAlpha            = 1;
            TitlePadding          = new Vector2(10, 10);
            TitleBackgroundColour = Color.DarkOrange;

            Padding = new Vector2(10, 10);

            Margin = new Vector4(0);

            DoBorder         = true;
            BorderWidth      = 2;
            TextColour       = Color.Black;
            BackgroundColour = Color.Black * 0.75f;

            BackgroundImage      = vxEngine.Assets.Textures.Blank;
            TitleBackgroundImage = vxEngine.Assets.Textures.Blank;



            textTitleSize = engine.Font.MeasureString("A");

            SetBounds();
        }
        public override void DrawByOwner(vxEngine vxEngine)
        {
            base.DrawByOwner(vxEngine);

            //
            //Update Rectangle
            //
            BoundingRectangle = new Rectangle((int)(Position.X), (int)(Position.Y),
                                              ButtonWidth, ButtonHeight);

            //
            //Draw Button
            //
            float i = 1;

            if (HasFocus)
            {
                i = 1.250f;
            }

            //Draw Button Background
            vxEngine.SpriteBatch.Draw(vxEngine.Assets.Textures.Blank, BoundingRectangle, Color_Normal * i);

            //Draw Icon
            if (ButtonImage != null)
            {
                vxEngine.SpriteBatch.Draw(ButtonImage, new Rectangle((int)(Position.X + 2), (int)(Position.Y + 2),
                                                                     ButtonHeight - 4, ButtonHeight - 4), Color.LightGray * i);
            }

            //Draw Text String
            vxEngine.SpriteBatch.DrawString(vxEngine.vxGUITheme.Font, Text,
                                            new Vector2((int)(Position.X + ButtonHeight + Padding * 2), (int)(Position.Y + 8)),
                                            Colour_Text);
        }
示例#19
0
 /// <summary>
 /// Draws the GUI Item
 /// </summary>
 /// <param name="vxEngine">Vx engine.</param>
 public override void Draw(vxEngine vxEngine)
 {
     //Draw Button
     vxEngine.SpriteBatch.Begin();
     this.DrawByOwner(vxEngine);
     vxEngine.SpriteBatch.End();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.xFileDialogItem"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="FilePath">File path.</param>
        /// <param name="Position">Position.</param>
        /// <param name="buttonImage">Button image.</param>
        /// <param name="ElementIndex">Element index.</param>
        /// <param name="function">Function.</param>
        public vxScrollPanelItem(vxEngine vxEngine,
                                 string Text,
                                 Vector2 Position,
                                 Texture2D buttonImage,
                                 int ElementIndex)
        {
            Padding       = 4;
            this.vxEngine = vxEngine;

            //Set Text
            this.Text = Text;

            //Set Position
            this.Position    = Position;
            OriginalPosition = Position;

            //Set Index
            Index = ElementIndex;

            //Set Button Image
            ButtonImage       = buttonImage;
            BoundingRectangle = new Rectangle(0, 0, 64, 64);

            Width = 3000;

            Color_Normal         = new Color(0.15f, 0.15f, 0.15f, 0.5f);
            Color_Highlight      = Color.DarkOrange;
            Colour_Text          = Color.LightGray;
            this.OnInitialHover += this_OnInitialHover;
            this.Clicked        += this_Clicked;
        }
示例#21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.Controls.vxButtonImage"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="position">Position.</param>
        /// <param name="buttonImage">Button image.</param>
        /// <param name="hoverImage">Hover image.</param>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        public vxButtonImage(vxEngine vxEngine,
                             Vector2 position,
                             Texture2D buttonImage,
                             Texture2D hoverImage,
                             int width,
                             int height)
        {
            //Get the current Game vxEngine
            this.vxEngine = vxEngine;

            //Set Position
            Position         = position;
            OriginalPosition = position;

            //Set Button Images
            ButtonImage      = buttonImage;
            HoverButtonImage = hoverImage;

            //Set Initial Bounding Rectangle
            Width             = width;
            Height            = height;
            BoundingRectangle = new Rectangle(0, 0, Width, Height);

            //Set Default Colours
            Color_Normal    = Color.White;
            Color_Highlight = Color.White;

            //Default is true
            DrawHoverBackground  = true;
            this.OnInitialHover += VxMenuEntry_OnInitialHover;
            this.Clicked        += VxButtonImage_Clicked;
        }
示例#22
0
        /// <summary>
        /// Draws the GUI Item
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        public override void Draw(vxEngine vxEngine)
        {
            base.Draw(vxEngine);

            if (TakingInput)
            {
                if (Keyboard.GetState().GetPressedKeys().Length > 0)
                {
                    Keys newKey = Keyboard.GetState().GetPressedKeys()[0];

                    if (newKey != Keys.Escape && newKey != Keys.OemTilde)
                    {
                        KeyBinding.Key = newKey;
                    }

                    TakingInput = false;

                    Button.Text            = KeyBinding.Key.ToString();
                    Button.Color_Highlight = Color.DarkOrange;
                }
            }


            //Update Rectangle
            int length = 354;

            BoundingRectangle = new Rectangle((int)(Position.X), (int)(Position.Y), length, Height);

            //
            //Draw Button
            //
            vxEngine.SpriteBatch.Begin();
            vxEngine.SpriteBatch.Draw(vxEngine.Assets.Textures.Blank, BoundingRectangle, Color.Black * 0.5f);
            vxEngine.SpriteBatch.End();
        }
示例#23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.xFileDialogItem"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="FilePath">File path.</param>
        /// <param name="Position">Position.</param>
        /// <param name="buttonImage">Button image.</param>
        /// <param name="ElementIndex">Element index.</param>
        /// <param name="function">Function.</param>
        public vxFileDialogItem(vxEngine vxEngine,
                                string FilePath,
                                Vector2 Position,
                                Texture2D buttonImage,
                                int ElementIndex)
        {
            Padding = 4;

            this.FilePath    = FilePath;
            FileName         = vxUtil.GetFileNameFromPath(FilePath);
            Text             = FileName;
            this.Position    = Position;
            OriginalPosition = Position;

            Index             = ElementIndex;
            ButtonImage       = buttonImage;
            BoundingRectangle = new Rectangle(0, 0, 64, 64);
            this.vxEngine     = vxEngine;

            Width = 3000;

            Color_Normal    = new Color(0.15f, 0.15f, 0.15f, 0.5f);
            Color_Highlight = Color.DarkOrange;
            Colour_Text     = Color.LightGray;
        }
示例#24
0
 /// <summary>
 /// Button Code
 /// </summary>
 /// <param name="text"></param>
 /// <param name="position"></param>
 /// <param name="function"></param>
 public xButton_Toggle(vxEngine vxEngine, string text, Vector2 position)
 {
     Text          = text;
     Position      = position;
     this.vxEngine = vxEngine;
     length        = Math.Max(100, (int)(vxEngine.vxGUITheme.Font.MeasureString(Text).X + Padding * 2));
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.vxTabControl"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="Width">Width.</param>
        /// <param name="Height">Height.</param>
        /// <param name="offSetPosition">Off set position.</param>
        /// <param name="GUIOrientation">GUI orientation.</param>
        public vxTabControl(vxEngine vxEngine, int Width, int Height, Vector2 offSetPosition, vxGUIItemOrientation GUIOrientation)
        {
            this.vxEngine = vxEngine;

            this.Width  = Width;
            this.Height = Height;

            OffsetPosition = offSetPosition;

            ItemOreintation = GUIOrientation;
            switch (GUIOrientation)
            {
            case vxGUIItemOrientation.Left:

                Position = offSetPosition - new Vector2(this.Width, 0);
                gap      = 0;
                break;

            case vxGUIItemOrientation.Right:

                Position   = new Vector2(vxEngine.GraphicsDevice.Viewport.Width, 0) + offSetPosition;
                TabHeight *= -1;
                break;
            }
            OriginalPosition     = Position;
            HoverAlphaMax        = 0.75f;
            HoverAlphaMin        = 0.5f;
            HoverAlphaDeltaSpeed = 10;
        }
示例#26
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.Controls.vxButton"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        /// <param name="text">Text.</param>
        /// <param name="position">Position.</param>
        public vxButton(vxEngine vxEngine, string text, Vector2 position)
            : base(position)
        {
            //Text
            this.Text = text;

            //Engine
            this.vxEngine = vxEngine;

            //Set up Font
            this.Font = vxEngine.vxGUITheme.Font;

            //Get Settings
//            this.Color_Normal = vxEngine.vxGUITheme.vxButtons.BackgroundColour;
//            this.Color_Highlight = vxEngine.vxGUITheme.vxButtons.BackgroundHoverColour;
//            this.Colour_Text = vxEngine.vxGUITheme.vxButtons.TextColour;
//
//            //Set Width and Height
//            Width = Math.Max(vxEngine.vxGUITheme.vxButtons.Width, (int)(this.Font.MeasureString(Text).X + Padding * 2));
//            Height = Math.Max(vxEngine.vxGUITheme.vxButtons.Height, (int)this.Font.MeasureString(Text).Y + Padding * 2);
//
            BoundingRectangle = new Rectangle(
                (int)(Position.X - Padding),
                (int)(Position.Y - Padding / 2),
                Width, Height);

            //Have this button get a clone of the current Art Provider
            this.ArtProvider = (vxButtonArtProvider)vxEngine.vxGUITheme.ArtProviderForButtons.Clone();

            this.OnInitialHover += this_OnInitialHover;
            this.Clicked        += this_Clicked;
        }
示例#27
0
        /// <summary>
        /// Draws the GUI Item
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        public override void Draw(vxEngine vxEngine)
        {
            base.Draw(vxEngine);

            //Update Rectangle
            BoundingRectangle = new Rectangle((int)(Position.X - Padding), (int)(Position.Y - Padding / 2), Width, Height + Padding / 2);

            //Draw Button
            vxEngine.SpriteBatch.Begin();

            //Draw Regular Image
            vxEngine.SpriteBatch.Draw(ButtonImage, BoundingRectangle, Enabled ? Color_Normal : Color.Gray);

            if (Enabled)
            {
                //Draw Hover Items
                //vxEngine.SpriteBatch.Draw (vxEngine.Assets.Textures.Blank, BoundingRectangle, Color_Highlight * HoverAlpha);

                if (HoverButtonImage != null)
                {
                    vxEngine.SpriteBatch.Draw(HoverButtonImage, BoundingRectangle, Color_Normal * HoverAlpha);
                }

                if (IsTogglable && ToggleState)
                {
                    if (HoverButtonImage != null)
                    {
                        vxEngine.SpriteBatch.Draw(HoverButtonImage, BoundingRectangle, Color_Normal);
                    }
                }
            }

            vxEngine.SpriteBatch.End();
        }
示例#28
0
        public override void DrawByOwner(vxEngine vxEngine)
        {
            base.DrawByOwner(vxEngine);

            Width = (int)this.Font.MeasureString(Text).X;
            vxEngine.SpriteBatch.DrawString(this.Font, Text, new Vector2(Position.X, Position.Y), Colour_Text);
        }
示例#29
0
        public vxLoadingScreen(vxEngine Engine) : base(Engine)
        {
            BackgroundColour = Color.LightGray;
            TextColour       = Color.Black;

            Position = new Vector2(0, 0);
        }
示例#30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.Core.Cursor3D"/> class.
        /// </summary>
        /// <param name="vxEngine">Vx engine.</param>
        public vxCursor3D(vxEngine vxEngine)
            : base(vxEngine, vxEngine.Assets.Models.UnitBox, Vector3.Zero)
        {
            //Always Start The Cursor at the Origin
            HitBox = new Box(Vector3.Zero, CubeSize, CubeSize, CubeSize);
            World  = Matrix.CreateScale(CubeSize);

            //Build the Axises
            List_Items.Add(new vxAxis(vxEngine, this, AxisDirections.X));
            List_Items.Add(new vxAxis(vxEngine, this, AxisDirections.Y));
            List_Items.Add(new vxAxis(vxEngine, this, AxisDirections.Z));

            //Add Rotators
            List_Rotators.Add(new vxAxisRotator(vxEngine, this, AxisDirections.X));
            List_Rotators.Add(new vxAxisRotator(vxEngine, this, AxisDirections.Y));
            List_Rotators.Add(new vxAxisRotator(vxEngine, this, AxisDirections.Z));

            Current3DScene.BEPUPhyicsSpace.Add(HitBox);
            //Current3DScene.Physics3DDebugDrawer.Add(HitBox);

            //Remove from the main list so that it can be drawn over the entire scene
            Current3DScene.Entities.Remove(this);
            Current3DScene.List_OverlayItems.Add(this);
            HitBox.CollisionInformation.CollisionRules.Personal = Virtex.Lib.Vrtc.Physics.BEPU.CollisionRuleManagement.CollisionRule.NoSolver;
        }