Example #1
0
        protected override void MousePick(MouseOverList list, SpriteVertex[] vertex, bool istransparent)
        {
            int x = list.MousePosition.X - (int)vertex[0].Position.X;
            int y = list.MousePosition.Y - (int)vertex[0].Position.Y;

            if (Texture.Contains(x, y))
            {
                list.Add(this, vertex[0].Position);
            }
        }
Example #2
0
        protected override void MousePick(MouseOverList list, SpriteVertex[] vertex)
        {
            int x = list.MousePosition.X - (int)vertex[0].Position.X;
            int y = list.MousePosition.Y - (int)vertex[0].Position.Y;

            if (Texture.Contains(x, y))
            {
                list.Add(GameObject, vertex[0].Position);
            }
        }
Example #3
0
        private bool Draw3DStretched(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            Texture.Ticks = Engine.Ticks;

            int z = Z * 4;

            if (Engine.Profile.Current.HighlightGameObjects)
            {
                if (IsSelected)
                {
                    if (_storedHue == Vector3.Zero)
                    {
                        _storedHue = HueVector;
                    }
                    HueVector = ShaderHuesTraslator.SelectedHue;
                }
                else if (_storedHue != Vector3.Zero)
                {
                    HueVector  = _storedHue;
                    _storedHue = Vector3.Zero;
                }
            }

            Vector3.Add(ref position, ref _vertex0_yOffset, out _vertex[0].Position);
            Vector3.Add(ref position, ref _vertex1_yOffset, out _vertex[1].Position);
            Vector3.Add(ref position, ref _vertex2_yOffset, out _vertex[2].Position);
            Vector3.Add(ref position, ref _vertex3_yOffset, out _vertex[3].Position);

            _vertex[0].Position.Y += z;
            _vertex[1].Position.Y += z;
            _vertex[2].Position.Y += z;
            _vertex[3].Position.Y += z;

            //HueVector.Z = 1f - (AlphaHue / 255f);

            if (HueVector != _vertex[0].Hue)
            {
                _vertex[0].Hue = HueVector;
                _vertex[1].Hue = HueVector;
                _vertex[2].Hue = HueVector;
                _vertex[3].Hue = HueVector;
            }

            if (!batcher.DrawSprite(Texture, _vertex))
            {
                return(false);
            }

            if (objectList.IsMouseInObjectIsometric(_vertex))
            {
                objectList.Add(this, _vertex[0].Position);
            }

            return(true);
        }
Example #4
0
        private unsafe bool Draw3DStretched(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            Texture.Ticks = Engine.Ticks;

            int z = GameObject.Position.Z * 4;

            if (IsSelected)
            {
                if (_storedHue == Vector3.Zero)
                {
                    _storedHue = HueVector;
                }
                HueVector = ShaderHuesTraslator.SelectedHue;
            }
            else if (_storedHue != Vector3.Zero)
            {
                HueVector  = _storedHue;
                _storedHue = Vector3.Zero;
            }

            fixed(SpriteVertex *ptr = _vertex)
            {
                ptr[0].Position = position + _vertex0_yOffset;
                ptr[1].Position = position + _vertex1_yOffset;
                ptr[2].Position = position + _vertex2_yOffset;
                ptr[3].Position = position + _vertex3_yOffset;

                ptr[0].Position.Y += z;
                ptr[1].Position.Y += z;
                ptr[2].Position.Y += z;
                ptr[3].Position.Y += z;

                if (HueVector != ptr[0].Hue)
                {
                    ptr[0].Hue = HueVector;
                    ptr[1].Hue = HueVector;
                    ptr[2].Hue = HueVector;
                    ptr[3].Hue = HueVector;
                }
            }

            if (!batcher.DrawSprite(Texture, _vertex))
            {
                return(false);
            }

            if (objectList.IsMouseInObjectIsometric(_vertex))
            {
                objectList.Add(GameObject, _vertex[0].Position);
            }

            return(true);
        }
Example #5
0
        protected override void MousePick(MouseOverList list, SpriteVertex[] vertex, bool istransparent)
        {
            GameScene gs = Engine.SceneManager.GetScene <GameScene>();
            int       x1 = Engine.Profile.Current.GameWindowPosition.X + 6;
            int       y1 = Engine.Profile.Current.GameWindowPosition.Y + 6;

            int x = (int)(list.MousePosition.X / gs.Scale - vertex[0].Position.X);
            int y = (int)(list.MousePosition.Y / gs.Scale - vertex[0].Position.Y);

            x += x1;
            y += y1;

            if (Texture.Contains(x, y))
            {
                list.Add(this, vertex[0].Position);
            }
        }
Example #6
0
        private bool Draw3DStretched(SpriteBatch3D spriteBatch, Vector3 position, MouseOverList objectList)
        {
            Texture.Ticks       = CoreGame.Ticks;
            _vertex[0].Position = position + _vertex0_yOffset;
            _vertex[1].Position = position + _vertex1_yOffset;
            _vertex[2].Position = position + _vertex2_yOffset;
            _vertex[3].Position = position + _vertex3_yOffset;
            int z = GameObject.Position.Z * 4;

            for (int i = 0; i < 4; i++)
            {
                _vertex[i].Position.Y += z;
            }

            if (IsSelected)
            {
                if (_storedHue == Vector3.Zero)
                {
                    _storedHue = HueVector;
                }
                HueVector = RenderExtentions.SelectedHue;
            }
            else if (_storedHue != Vector3.Zero)
            {
                HueVector  = _storedHue;
                _storedHue = Vector3.Zero;
            }

            if (HueVector != _vertex[0].Hue)
            {
                _vertex[0].Hue = _vertex[1].Hue = _vertex[2].Hue = _vertex[3].Hue = HueVector;
            }

            if (!spriteBatch.DrawSprite(Texture, _vertex))
            {
                return(false);
            }

            if (objectList.IsMouseInObjectIsometric(_vertex))
            {
                objectList.Add(GameObject, _vertex[0].Position);
            }

            return(true);
        }
Example #7
0
        //private static Texture2D _edge;


        private void Pick(SpriteTexture texture, Rectangle area, Vector3 drawPosition, MouseOverList list)
        {
            int x;

            if (IsFlipped)
            {
                x = (int)drawPosition.X + area.X + 44 - list.MousePosition.X;
            }
            else
            {
                x = list.MousePosition.X - (int)drawPosition.X + area.X;
            }
            int y = list.MousePosition.Y - ((int)drawPosition.Y - area.Y);

            if (texture.Contains(x, y))
            {
                list.Add(this, drawPosition);
            }
        }
Example #8
0
        protected override void MousePick(MouseOverList list, SpriteVertex[] vertex)
        {
            int x = list.MousePosition.X - (int)vertex[0].Position.X;
            int y = list.MousePosition.Y - (int)vertex[0].Position.Y;

            //if (Art.Contains(GameObject.Graphic, x, y))
            //Land tile = (Land)GameObject;

            //if (!tile.IsStretched)
            //{
            //    if (Texture.Contains(x, y))
            //        list.Add(GameObject, vertex[0].Position);
            //}


            if (Texture.Contains(x, y))
            {
                list.Add(GameObject, vertex[0].Position);
            }
        }