Inheritance: FlatRedBall.PositionedObject
Ejemplo n.º 1
0
        public SpriteGridBorder(Cursor cursor, Camera camera)
        {
            this.cursor = cursor;
            this.camera = camera;

            mMainRectangle = Polygon.CreateRectangle(1,1);
            ShapeManager.AddPolygon(mMainRectangle);



            mCornerHandles = new Polygon[4];
            mSideHandles = new Polygon[4];
            for (int i = 0; i < 4; i++)
            {
                mCornerHandles[i] = Polygon.CreateRectangle(.5f, .5f);
                mCornerHandles[i].Color = System.Drawing.Color.Yellow;
                ShapeManager.AddPolygon(mCornerHandles[i]);

                mSideHandles[i] = Polygon.CreateRectangle(.5f, .5f);
                mSideHandles[i].Color = System.Drawing.Color.Yellow;
                ShapeManager.AddPolygon(mSideHandles[i]);
            }
             
            Visible = false;
        }
Ejemplo n.º 2
0
		public GameForm() : base()
		{

			//set the window caption.  This should be the name of your game with version number.  
			//Edit your assembly info to alter your version number of your game
            this.Text = "ParticleEditor - Editing unsaved .emix";

            camera = SpriteManager.Cameras[0];

            cursor = GuiManager.Cursor;

            FlatRedBallServices.Update();


			gameData = new EditorData();

			gameData.Initialize(this);


                EditorData.guiData.Initialize();



			GuiData.Messages.Initialize(this);

            GuiManager.RefreshTextSize();
		}
Ejemplo n.º 3
0
        public void Draw(FlatRedBall.Camera camera)
        {
            ////////////////////////Early Out///////////////////////////////

            if (DisableDrawing)
            {
                return;
            }

            //////////////////////End Early Out/////////////////////////////


            // This is the first call of the frame, so reset this value:
            SystemManagers.Default.Renderer.ClearPerformanceRecordingVariables();

            if (FlatRedBall.Graphics.Renderer.CurrentLayer == null)
            {
                mManagers.TextManager.RenderTextTextures();
                mManagers.Draw(mManagers.Renderer.MainLayer);
            }
            else if (mFrbToGumLayers.ContainsKey(FlatRedBall.Graphics.Renderer.CurrentLayer))
            {
                mManagers.Draw(mFrbToGumLayers[FlatRedBall.Graphics.Renderer.CurrentLayer]);
            }

            var renderBreaks = FlatRedBall.Graphics.Renderer.LastFrameRenderBreakList;

            if (renderBreaks != null)
            {
#if DEBUG
                // This object handles its own render breaks
                if (renderBreaks.Count != 0)
                {
                    var last = renderBreaks.Last();

                    if (last.ObjectCausingBreak == this)
                    {
                        renderBreaks.RemoveAt(renderBreaks.Count - 1);
                    }
                }
#endif
                foreach (var item in mManagers.Renderer.SpriteRenderer.LastFrameDrawStates)
                {
                    foreach (var changeRecord in item.ChangeRecord)
                    {
                        var renderBreak = new RenderBreak(0,
                                                          changeRecord.Texture,
                                                          ColorOperation.Texture,
                                                          BlendOperation.Regular,
                                                          TextureAddressMode.Clamp);

#if DEBUG
                        renderBreak.ObjectCausingBreak = changeRecord.ObjectRequestingChange;
#endif
                        renderBreaks.Add(renderBreak);
                    }
                }
            }
            mManagers.Renderer.ForceEnd();
        }
Ejemplo n.º 4
0
 internal static void ResetCamera(Camera cameraToReset)
 {
     cameraToReset.X = 0;
         cameraToReset.Y = 0;
         cameraToReset.XVelocity = 0;
         cameraToReset.YVelocity = 0;
 }
Ejemplo n.º 5
0
			internal static void ResetCamera (Camera cameraToReset)
			{
				cameraToReset.X = 0;
				cameraToReset.Y = 0;
				cameraToReset.XVelocity = 0;
				cameraToReset.YVelocity = 0;
				// Glue does not generate a detach call because the camera may be attached by this point
			}
Ejemplo n.º 6
0
        public FileButtonWindow(Cursor cursor)
        {
            camera = SpriteManager.Cameras[0];
            this.messages = GuiData.messages;
            sesgMan = GameData.sesgMan;

            mAssetsRelativeToSpriteRig = true;
        }
        // For saving.
        public SpriteEditorSceneProperties(Camera camera, Camera boundsCamera, float pixelSize)
        {
            Camera = CameraSave.FromCamera(camera);
            BoundsCamera = CameraSave.FromCamera(boundsCamera);
            TextureReference = new List<TextureReference>();
			PixelSize = pixelSize;
//            Gui.GuiData.listWindow
        }
Ejemplo n.º 8
0
 internal static void SetupCamera(Camera cameraToSetUp, GraphicsDeviceManager graphicsDeviceManager)
 {
     #if !WINDOWS_PHONE
     FlatRedBallServices.GraphicsOptions.SetResolution(800, 600);
     #else
     graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
     #endif
     cameraToSetUp.UsePixelCoordinates(false, 800, 600);
 }
Ejemplo n.º 9
0
		//GameForm form;

        #endregion


        public void Initialize()
		{
			#region initialize engine managers and data
			//this.form = form;
			//gameData = GameForm.gameData;
            camera = SpriteManager.Camera;

			guiData = EditorData.guiData;
			#endregion
		}
Ejemplo n.º 10
0
        public void UpdateScale(Camera camera)
        {
            float scale = (float)mCrossHair[0].RelativePoint1.X;

            float desiredScale = 5 / camera.PixelsPerUnitAt(this.Z);

            mCrossHair[0].ScaleBy(desiredScale / scale);
            mCrossHair[1].ScaleBy(desiredScale / scale);

        }
        public void SetFromRuntime(Camera camera, Camera boundsCamera, float pixelSize, bool boundsVisible)
        {

            Camera = CameraSave.FromCamera(camera);
            BoundsCamera = CameraSave.FromCamera(boundsCamera, true);
            BoundsVisible = boundsVisible;
            
            PixelSize = pixelSize;
//            Gui.GuiData.listWindow
        }
Ejemplo n.º 12
0
			internal static void SetupCamera (Camera cameraToSetUp, GraphicsDeviceManager graphicsDeviceManager)
			{
				#if !WINDOWS_PHONE && !WINDOWS_8 && !IOS && !ANDROID
				FlatRedBallServices.GraphicsOptions.SetResolution(800, 600);
				#endif
				#if WINDOWS_PHONE || WINDOWS_8 || IOS || ANDROID
				graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
				#endif
				cameraToSetUp.UsePixelCoordinates();
			}
        public void ApplyTo(Camera cameraToApplyTo)
        {
            bool isPixelPerfect2D = this.Camera.OrthogonalHeight <= 0;

            this.Camera.SetCamera(cameraToApplyTo);

            if (isPixelPerfect2D)
            {
                cameraToApplyTo.UsePixelCoordinates();
            }
        }
Ejemplo n.º 14
0
        public RenderTargetRenderer(Camera camera, bool generateMipMaps = false)
        {
            mWidth = camera.DestinationRectangle.Width;
            mHeight = camera.DestinationRectangle.Height;

            var device = FlatRedBallServices.GraphicsDevice;
            mRenderTarget = new RenderTarget2D(device, mWidth, mHeight,
                generateMipMaps, device.DisplayMode.Format, DepthFormat.Depth24);

            this.Camera = camera;
        }
Ejemplo n.º 15
0
        public void SetFromRuntime(Camera camera, Camera boundsCamera, bool boundsVisible)
        {

            Camera = CameraSave.FromCamera(camera);
            if (boundsCamera != null)
            {
                BoundsCamera = CameraSave.FromCamera(boundsCamera, true);
            }
            BoundsVisible = boundsVisible;
            //            Gui.GuiData.listWindow
        }
Ejemplo n.º 16
0
 public void Draw(FlatRedBall.Camera camera)
 {
     if (FlatRedBall.Graphics.Renderer.CurrentLayer == null)
     {
         mManagers.TextManager.RenderTextTextures();
         mManagers.Draw(mManagers.Renderer.MainLayer);
     }
     else if (mFrbToGumLayers.ContainsKey(FlatRedBall.Graphics.Renderer.CurrentLayer))
     {
         mManagers.Draw(mFrbToGumLayers[FlatRedBall.Graphics.Renderer.CurrentLayer]);
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Sets the argument Camera to the saved Camera values associated with the argument IElement,
        /// or does nothing if there is not an entry for the IElement.
        /// </summary>
        /// <param name="element">The element to use as the key when searching for Camera values.</param>
        /// <param name="camera">The camera to assign.</param>
        /// <returns>Whether properties on the Camera were set.  Properties will not be set if there isn't an entry for the given element.</returns>
        #endregion
        public bool SetCameraToSavedValues(IElement element, Camera camera)
        {
            ElementCameraSave ecs = this[element.Name];
            bool returnValue = false;
            if (ecs != null)
            {
                ecs.CameraSave.SetCamera(SpriteManager.Camera);
                returnValue = true;
            }

            return returnValue;
        }
Ejemplo n.º 18
0
        public CameraBounds(Camera cameraShowing)
        {
            if (cameraShowing == null)
            {
                throw new NullReferenceException("Need a non-null Camera to show");
            }

            mCamera = cameraShowing;

            mRectangle = ShapeManager.AddAxisAlignedRectangle();

        }
Ejemplo n.º 19
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        protected Playable(Layer layer)
        {
            //Set layer
            m_Layer = layer;

            //Empties variables
            m_Model		= null;

            //Initialize variables
            CalculateAABB();
            m_Active = false;
            m_Camera = new Camera(FlatRedBallServices.GlobalContentManager);
        }
Ejemplo n.º 20
0
        public static void Initialize()
        {
            // Create the mBoundsCamera before the GUI since the GUI will create a PropertyGrid for this object.
            mBoundsCamera = new Camera(FlatRedBallServices.GlobalContentManager);
            mBoundsCamera.DrawsWorld = false;
            mBoundsCamera.DrawsToScreen = false;

            GuiData.Initialize();

            // This needs to happen after the bounds camera is created.
            mEditorLogic = new EditorLogic();

            // make resizable
            new EditorObjects.FormMethods();
        }
Ejemplo n.º 21
0
        public void SetElementCameraSave(IElement element, Camera camera)
        {
            CameraSave cameraSave = CameraSave.FromCamera(camera, false);

            ElementCameraSave ecs = this[element.Name];

            if (ecs == null)
            {
                ecs = new ElementCameraSave();
                ecs.ElementName = element.Name;
                ElementCameraSaves.Add(ecs);
            }

            ecs.CameraSave = cameraSave;
        }
        public void SetCameras(Camera camera, Camera boundsCamera)
        {

            bool isPixelPerfect2D = this.Camera.OrthogonalHeight <= 0;

            this.Camera.SetCamera(camera);
            this.BoundsCamera.SetCamera(boundsCamera);

            if (isPixelPerfect2D)
            {
                camera.UsePixelCoordinates();
            }
                        

        }
Ejemplo n.º 23
0
        public RenderTargetRenderer(int width, int height, bool generateMipMaps = false)
        {
            mWidth = width;
            mHeight = height;

            var device = FlatRedBallServices.GraphicsDevice;
            mRenderTarget = new RenderTarget2D(device, mWidth, mHeight,
                generateMipMaps, device.DisplayMode.Format, DepthFormat.Depth24);

            Camera = new Camera(null, mWidth, mHeight);
            Camera.UsePixelCoordinates();
            Camera.Z = 40;
            Camera.DrawsWorld = false;

        }
Ejemplo n.º 24
0
        public void Draw(FlatRedBall.Camera camera)
        {
            // This is needed to update the Sprite's VerticesForDrawing
            SpriteManager.ManualUpdate(mSprite);

            // Set graphics states
            FlatRedBallServices.GraphicsDevice.RasterizerState = RasterizerState.CullNone;

            // Set the vertex declaration
            VertexDeclaration vd = Renderer.PositionColorTextureVertexDeclaration;

            //Vector3 lightDirection = (mSprite.Position-new Vector3(GuiManager.Cursor.WorldXAt(0), GuiManager.Cursor.WorldYAt(0), 500));
            //lightDirection.Normalize();
            // Set Parameters here:
            mEffect.Parameters["ColorMap"].SetValue(mSprite.Texture);
            mEffect.Parameters["View"].SetValue(camera.View);
            mEffect.Parameters["Projection"].SetValue(camera.Projection);
            mEffect.Parameters["lightPos"].SetValue(new Vector3(GuiManager.Cursor.WorldXAt(0), GuiManager.Cursor.WorldYAt(0), 20));
            mEffect.Parameters["NormalMap"].SetValue(FlatRedBallServices.Load <Texture2D>(Textures.PlayerTexture2Normal));
            mEffect.Parameters["spritePos"].SetValue(mSprite.Position);
            mEffect.Parameters["spriteWidth"].SetValue(mSprite.Texture.Width);
            mEffect.Parameters["spriteHeight"].SetValue(mSprite.Texture.Height);
            mEffect.Parameters["spriteRotation"].SetValue(mSprite.RotationZ);


            //swapping vertexes to draw sprite correctly
            VertexPositionColorTexture[] vpct = mSprite.VerticesForDrawing;
            VertexPositionColorTexture   v2   = vpct[2];

            vpct[2] = vpct[3];
            vpct[3] = v2;

            foreach (EffectPass pass in mEffect.CurrentTechnique.Passes)
            {
                // Start each pass
                pass.Apply();

                // Do this to avoid magic numbers:
                const int numberOfTrianglesInASprite = 2;

                // Draw the shape
                FlatRedBallServices.GraphicsDevice.DrawUserPrimitives <VertexPositionColorTexture>(
                    PrimitiveType.TriangleStrip, vpct, 0, numberOfTrianglesInASprite);
            }
        }
Ejemplo n.º 25
0
			internal static void SetupCamera (Camera cameraToSetUp, GraphicsDeviceManager graphicsDeviceManager, int width, int height)
			{
				#if WINDOWS
				FlatRedBall.FlatRedBallServices.GraphicsOptions.SetResolution(width, height);
				#elif IOS || ANDROID
				FlatRedBall.FlatRedBallServices.GraphicsOptions.SetFullScreen(FlatRedBall.FlatRedBallServices.GraphicsOptions.ResolutionWidth, FlatRedBall.FlatRedBallServices.GraphicsOptions.ResolutionHeight);
				#endif
				#if WINDOWS_PHONE || WINDOWS_8 || IOS || ANDROID
				if (height > width)
				{
					graphicsDeviceManager.SupportedOrientations = DisplayOrientation.Portrait;
				}
				else
				{
					graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
				}
				#endif
				cameraToSetUp.UsePixelCoordinates();
			}
Ejemplo n.º 26
0
        public SESpriteGridManager()
		{
			camera = GameData.Camera;
			cursor = GameData.Cursor;
			currentSprites = GameData.EditorLogic.CurrentSprites;

			messages = GuiData.messages;

            mSpriteGridBorder = new SpriteGridBorder(cursor,
                camera);

            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "XLeftBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "XRightBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "YTopBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "YBottomBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "ZCloseBound", RepopulateSpriteGrid);
            UndoManager.SetAfterUpdateDelegate(typeof(SpriteGrid), "ZFarBound", RepopulateSpriteGrid);

            tla = new List<TextureLocation<Texture2D>>();
        }
Ejemplo n.º 27
0
        private void UpdateDisplayedProperties(Camera camera)
        {
            ExcludeAllMembers();

            // For some reason categorizing the properties didn't work here.  I can't
            // get them to categorize, but that's okay, I'll eventually replace this with
            // the wpf grid.
            IncludeMember("X");
            IncludeMember("Y");
            IncludeMember("Z");



            IncludeMember("Orthogonal");

            if (camera.Orthogonal)
            {
                IncludeMember("OrthogonalWidth");
                IncludeMember("OrthogonalHeight");
            }
            else
            {
                IncludeMember("FieldOfView");

                IncludeMember("RotationX");
                IncludeMember("RotationY");
                IncludeMember("RotationZ");
                
            }


            IncludeMember("BackgroundColor");

            IncludeMember("Filtering", typeof(bool), OnFilteringChange, GetFiltering);


        }
Ejemplo n.º 28
0
        internal override void DrawSelfAndChildren(Camera camera)
        {
            if (Highlighted)
            {
                float xPos = .5f + mWorldUnitX + Width / 2.0f;
                float yPos = mWorldUnitY;
                float highlightScaleX = .5f + this.Width / 2.0f;
                float highlightScaleY = mTextScale ;

                StaticVertices[0].Position.X = xPos - (float)highlightScaleX;
                StaticVertices[0].Position.Y = (float)(yPos - highlightScaleY);
                StaticVertices[0].TextureCoordinate.X = .0234375f;
                StaticVertices[0].TextureCoordinate.Y = .65f;

                StaticVertices[1].Position.X = xPos - (float)highlightScaleX;
                StaticVertices[1].Position.Y = (float)(yPos + highlightScaleY);
                StaticVertices[1].TextureCoordinate.X = .0234375f;
                StaticVertices[1].TextureCoordinate.Y = .65f;

                StaticVertices[2].Position.X = xPos + (float)highlightScaleX;
                StaticVertices[2].Position.Y = (float)(yPos + highlightScaleY);
                StaticVertices[2].TextureCoordinate.X = .02734375f;
                StaticVertices[2].TextureCoordinate.Y = .66f;

                StaticVertices[3] = StaticVertices[0];
                StaticVertices[4] = StaticVertices[2];

                StaticVertices[5].Position.X = xPos + (float)highlightScaleX;
                StaticVertices[5].Position.Y = (float)(yPos - highlightScaleY);
                StaticVertices[5].TextureCoordinate.X = .02734375f;
                StaticVertices[5].TextureCoordinate.Y = .66f;

                GuiManager.WriteVerts(StaticVertices);
            }

            base.DrawSelfAndChildren(camera);
        }
Ejemplo n.º 29
0
 public void Draw(FlatRedBall.Camera camera)
 {
     mManagers.Draw();
 }
        public CameraBoundsPropertyGrid(Camera camera)
            : base(GuiManager.Cursor)
        {
            #region Set "this" properties

            GuiManager.AddWindow(this);
            HasCloseButton = true;
            Name = "Camera Bounds";
            this.SelectedObject = camera;

            this.ExcludeMember("NearClipPlane");
            this.ExcludeMember("FarClipPlane");
            RemoveCategory("Clip Plane");
            
            #endregion

            #region SetMemberChangeEvent to update the bounds on any UI change
            SetMemberChangeEvent("X", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("Y", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("Z", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("Orthogonal", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("FieldOfView", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("AspectRatio", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("OrthogonalWidth", new GuiMessage(UpdateBoundsEvent));
            SetMemberChangeEvent("OrthogonalHeight", new GuiMessage(UpdateBoundsEvent));

            UsePixelCoordinatesClick += UpdateBoundsEvent;
            #endregion

            #region Create the camera bounds

            mCameraBounds = new EditorObjects.CameraBounds(camera);
            mCameraBounds.Visible = true;

            #endregion

            //mBoundsOptions = new ComboBox(mCursor);
            //mBoundsOptions.ScaleX = 7;
            //this.AddWindow(mBoundsOptions, "Size");
            //mBoundsOptions.AddItem("Default 2D");
            //mBoundsOptions.AddItem("Default 3D");
            //SetLabelForWindow(mBoundsOptions, "Setting");

            IncludeMember("Orthogonal", "Size");
            IncludeMember("OrthogonalWidth", "Size");
            IncludeMember("OrthogonalHeight", "Size");
            IncludeMember("FieldOfView", "Size");
            IncludeMember("AspectRatio", "Size");
            ShowDestinationRectangle(true);

            ShowCameraConfigurations("Size");

            IncludeMember("X", "Position");
            IncludeMember("Y", "Position");
            IncludeMember("Z", "Position");

            mTargetZUpDown = new UpDown(mCursor);
            this.AddWindow(mTargetZUpDown, "Position");
            this.SetLabelForWindow(mTargetZUpDown, "Target Z");
            mTargetZUpDown.ValueChanged += new GuiMessage(ChangeTargetZ);
            RemoveCategory("Uncategorized");
            
            UpdateBounds();
        }
Ejemplo n.º 31
0
 void IWindow.Activity(Camera camera)
 {
 }
Ejemplo n.º 32
0
        internal override void DrawSelfAndChildren(Camera camera)
        {

            base.DrawSelfAndChildren(camera);

            #region Highlighted

            float xPos = TITLE_BAR_X_SHIFT + (float)mWorldUnitX;

            for (int i = 0; i < mItems.Count; i++)
            {
                mItems[i].TurnOffDrawHighlighted();
            }

            foreach (CollapseItem ci in mHighlightedItems)
            {
                if (IsVisibleInBox(ci))
                {
                    ci.mDrawHighlighted = true;
                    int highlightedNum = GetItemNumber(ci) - mStartAt;

                    mHighlight.Y = mScaleY - 2 - mDistanceBetweenLines * highlightedNum + mWorldUnitY;

#if FRB_MDX
                    StaticVertices[0].Color = StaticVertices[1].Color = StaticVertices[2].Color = StaticVertices[3].Color = StaticVertices[4].Color = StaticVertices[5].Color = 0xff000000;
#else
                    StaticVertices[0].Color.PackedValue = StaticVertices[1].Color.PackedValue = StaticVertices[2].Color.PackedValue =
                        StaticVertices[3].Color.PackedValue = StaticVertices[4].Color.PackedValue = StaticVertices[5].Color.PackedValue = 0xff000000;

#endif

                    StaticVertices[0].Position.Z = StaticVertices[1].Position.Z = StaticVertices[2].Position.Z =
                        StaticVertices[3].Position.Z = StaticVertices[4].Position.Z = StaticVertices[5].Position.Z =
                        camera.Z + FlatRedBall.Math.MathFunctions.ForwardVector3.Z * 100;
                    StaticVertices[0].Position.X = xPos - (float)mHighlight.ScaleX;
                    StaticVertices[0].Position.Y = (float)(mHighlight.Y - mHighlight.ScaleY);
                    StaticVertices[0].TextureCoordinate.X = .0234375f;
                    StaticVertices[0].TextureCoordinate.Y = .65f;

                    StaticVertices[1].Position.X = xPos - (float)mHighlight.ScaleX;
                    StaticVertices[1].Position.Y = (float)(mHighlight.Y + mHighlight.ScaleY);
                    StaticVertices[1].TextureCoordinate.X = .0234375f;
                    StaticVertices[1].TextureCoordinate.Y = .65f;

                    StaticVertices[2].Position.X = xPos + (float)mHighlight.ScaleX;
                    StaticVertices[2].Position.Y = (float)(mHighlight.Y + mHighlight.ScaleY);
                    StaticVertices[2].TextureCoordinate.X = .02734375f;
                    StaticVertices[2].TextureCoordinate.Y = .66f;

                    StaticVertices[3] = StaticVertices[0];
                    StaticVertices[4] = StaticVertices[2];

                    StaticVertices[5].Position.X = xPos + (float)mHighlight.ScaleX;
                    StaticVertices[5].Position.Y = (float)(mHighlight.Y - mHighlight.ScaleY);
                    StaticVertices[5].TextureCoordinate.X = .02734375f;
                    StaticVertices[5].TextureCoordinate.Y = .66f;

                    GuiManager.WriteVerts(StaticVertices);
                }

            }
            #endregion

            #region Draw the CollapseItems
            float startY = FirstItemScreenY;
            int numToDraw = NumberOfVisibleElements;
            int numDrawn = 0;
            int itemNum = 0;
            for (int j = 0; j < Items.Count; j++)
            {
                bool isHighlighted = mHighlightedItems.Contains(Items[j]);

                Items[j].Draw(camera, startY,
                    mWorldUnitX - mScaleX + 1.2f,
                    TextScaleX * 2, 0, ref itemNum,
                    ref numDrawn, mStartAt, numToDraw, mDistanceBetweenLines);
                if (numDrawn > numToDraw - 1) break;
            }

            #endregion

            #region Draw the Lines

            startY = (float)(mWorldUnitY + mScaleY - 2.0f);

            float highlightScaleX = ScaleX - mHighlightBarHorizontalBuffer;

            // .135 is too low
            const float lineThickness = .137f;
            // .14 is too high

            if (Lined)
            {
                for (int j = mStartAt; j < GetNumCollapsed(); j++)
                {
                    startY -= 2;
                    if (startY < mWorldUnitY - mScaleY + .5f) break;

                    StaticVertices[0].Position.X = xPos - highlightScaleX;
                    StaticVertices[0].Position.Y = (startY + .95f);
                    StaticVertices[0].TextureCoordinate.X = 0f;
                    StaticVertices[0].TextureCoordinate.Y = .905f;


                    StaticVertices[1].Position.X = xPos - highlightScaleX;
                    StaticVertices[1].Position.Y = (startY + .95f + lineThickness);
                    StaticVertices[1].TextureCoordinate.X = .0f;
                    StaticVertices[1].TextureCoordinate.Y = .904f;

                    StaticVertices[2].Position.X = xPos + highlightScaleX;
                    StaticVertices[2].Position.Y = (startY + .95f + lineThickness);
                    StaticVertices[2].TextureCoordinate.X = .001f;
                    StaticVertices[2].TextureCoordinate.Y = .904f;

                    StaticVertices[3] = StaticVertices[0];
                    StaticVertices[4] = StaticVertices[2];

                    StaticVertices[5].Position.X = xPos + highlightScaleX;
                    StaticVertices[5].Position.Y = (startY + .95f);
                    StaticVertices[5].TextureCoordinate.X = .001f;
                    StaticVertices[5].TextureCoordinate.Y = .905f;

                    GuiManager.WriteVerts(StaticVertices);
                }
            }
            #endregion

            #region Draw the insert location (if visible)



            if (mInsertLocation != -1)
            {
                startY = (float)(mWorldUnitY + mScaleY - 2.0f) - mDistanceBetweenLines * (mInsertLocation - mStartAt);


                StaticVertices[0].Position.X = xPos - highlightScaleX;
                StaticVertices[0].Position.Y = (startY + .91f);
                StaticVertices[0].TextureCoordinate.X = 0f;
                StaticVertices[0].TextureCoordinate.Y = .901f;

                StaticVertices[1].Position.X = xPos - highlightScaleX;
                StaticVertices[1].Position.Y = (startY + 1.19f);
                StaticVertices[1].TextureCoordinate.X = .0f;
                StaticVertices[1].TextureCoordinate.Y = .90f;

                StaticVertices[2].Position.X = xPos + highlightScaleX;
                StaticVertices[2].Position.Y = (startY + 1.19f);
                StaticVertices[2].TextureCoordinate.X = .001f;
                StaticVertices[2].TextureCoordinate.Y = .90f;

                StaticVertices[3] = StaticVertices[0];
                StaticVertices[4] = StaticVertices[2];

                StaticVertices[5].Position.X = xPos + highlightScaleX;
                StaticVertices[5].Position.Y = (startY + .91f);
                StaticVertices[5].TextureCoordinate.X = .001f;
                StaticVertices[5].TextureCoordinate.Y = .901f;

                GuiManager.WriteVerts(StaticVertices);
            }
            #endregion

        }
Ejemplo n.º 33
0
 void FlatRedBall.Gui.IWindow.Activity(FlatRedBall.Camera camera)
 {
 }
Ejemplo n.º 34
0
 internal static void SetupCamera(Camera cameraToSetUp, GraphicsDeviceManager graphicsDeviceManager)
 {
     cameraToSetUp.UsePixelCoordinates();
 }
Ejemplo n.º 35
0
        internal void UpdateVertices(Camera camera)
        {
            // Vic says: I tried to optimize this on
            // March 6, 2011 for the windows phone - I
            // couldn't get it to run any faster on the
            // the emulator.  Seems like it's pretty darn
            // optimized.
            mVertices[0].Position.X = (mScaleX * mVertices[0].Scale.X);
            mVertices[1].Position.X = (mScaleX * mVertices[1].Scale.X);
            mVertices[2].Position.X = (mScaleX * mVertices[2].Scale.X);
            mVertices[3].Position.X = (mScaleX * mVertices[3].Scale.X);

            mVertices[0].Position.Y = (mScaleY * mVertices[0].Scale.Y);
            mVertices[1].Position.Y = (mScaleY * mVertices[1].Scale.Y);
            mVertices[2].Position.Y = (mScaleY * mVertices[2].Scale.Y);
            mVertices[3].Position.Y = (mScaleY * mVertices[3].Scale.Y);

            mVertices[0].Position.Z = 0;
            mVertices[1].Position.Z = 0;
            mVertices[2].Position.Z = 0;
            mVertices[3].Position.Z = 0;

            if (this.ListsBelongingTo.Contains(camera.mSpritesToBillBoard))
            {
                Matrix modifiedMatrix =  mRotationMatrix * SpriteManager.Camera.RotationMatrix;

                MathFunctions.TransformVector(ref mVertices[0].Position, ref modifiedMatrix);
                MathFunctions.TransformVector(ref mVertices[1].Position, ref modifiedMatrix);
                MathFunctions.TransformVector(ref mVertices[2].Position, ref modifiedMatrix);
                MathFunctions.TransformVector(ref mVertices[3].Position, ref modifiedMatrix);
            }
            else
            {
                MathFunctions.TransformVector(ref mVertices[0].Position, ref mRotationMatrix);
                MathFunctions.TransformVector(ref mVertices[1].Position, ref mRotationMatrix);
                MathFunctions.TransformVector(ref mVertices[2].Position, ref mRotationMatrix);
                MathFunctions.TransformVector(ref mVertices[3].Position, ref mRotationMatrix);
            }

            mVertices[0].Position += Position;
            mVertices[1].Position += Position;
            mVertices[2].Position += Position;
            mVertices[3].Position += Position;

        }
Ejemplo n.º 36
0
 public void Activity(FlatRedBall.Camera camera)
 {
 }