コード例 #1
0
        public CameraController(RenderingLibrary.Camera camera, SystemManagers managers, Cursor cursor, GraphicsDeviceControl control, Ruler topRuler, Ruler leftRuler)
        {
            this.TopRuler = topRuler;
            this.LeftRuler = leftRuler;
            Cursor = cursor;
            Camera = camera;
            Managers = managers;

            cameraPanningLogic = new CameraPanningLogic(control, managers, cursor, null);

        }
コード例 #2
0
ファイル: GumIdb.cs プロジェクト: vchelaru/FlatRedBall
        public void AddGumLayerToFrbLayer(RenderingLibrary.Graphics.Layer gumLayer, FlatRedBall.Graphics.Layer frbLayer)
        {
            if (mFrbToGumLayers.ContainsKey(frbLayer) == false)
            {
                mFrbToGumLayers[frbLayer] = new List<RenderingLibrary.Graphics.Layer>();
            }

            mFrbToGumLayers[frbLayer].Add(gumLayer);
            SpriteManager.AddToLayerAllowDuplicateAdds(this, frbLayer);
        }
コード例 #3
0
        private static void MoveOriginToTopLeft(RenderingLibrary.Camera camera)
        {
            // top-left origin.
            //float desiredX = (-Border + camera.ClientWidth / 2.0f) / camera.Zoom;
            //if (desiredX != camera.X)
            //{
            //    camera.X = desiredX;
            //}

            //camera.Y = (-Border + camera.ClientHeight / 2.0f) / camera.Zoom;

            camera.X = 0;
            camera.Y = 0;
        }
コード例 #4
0
        private void MoveSpriteAccordingToAlignmentAndOffset(RenderingLibrary.Graphics.Sprite sprite, AnimationFrameSave frame)
        {
            // Event though we may not be rendering the main Sprite, we want to use the main Sprite's animation:
            IAnimation animation = mSprite.Animation;

            if (sprite != null && sprite.Visible && mSprite.Animation != null)
            {
                int index = sprite.Animation.CurrentFrameIndex;

                float animationXOffset = 0;
                float animationYOffset = 0;

                AnimationChainSave chain = SelectedState.Self.SelectedChain;



                if (chain != null && chain.Frames.Count > index)
                {
                    if (frame == null)
                    {
                        frame = chain.Frames[index];
                    }

                    animationXOffset = frame.RelativeX * OffsetMultiplier;
                    animationYOffset = frame.RelativeY * OffsetMultiplier;
                }

                if (SpriteAlignment == Data.SpriteAlignment.Center)
                {
                    float xOffset = (-sprite.EffectiveWidth) / 2.0f;
                    float yOffset = (-sprite.EffectiveHeight) / 2.0f;

                    sprite.X = xOffset + animationXOffset;
                    sprite.Y = yOffset - animationYOffset;
                }
                else
                {
                    sprite.X = 0 + animationXOffset;
                    sprite.Y = 0 - animationYOffset;
                }

            }
        }
コード例 #5
0
        private void UpdateSpriteToAnimationFrame(AnimationFrameSave afs, RenderingLibrary.Graphics.Sprite sprite)
        {
            sprite.Animate = false;

            sprite.Texture = WireframeManager.Self.GetTextureForFrame(afs);
            if (sprite.Texture != null)
            {
                sprite.SourceRectangle = GetSourceRetangleForFrame(afs, sprite.Texture);
                if(sprite.SourceRectangle.HasValue)
                {
                    sprite.Width = sprite.SourceRectangle.Value.Width;
                    sprite.Height = sprite.SourceRectangle.Value.Height;
                }
            }
            sprite.FlipHorizontal = afs.FlipHorizontal;
            sprite.FlipVertical = afs.FlipVertical;
            sprite.Animation = mSprite.Animation;

            MoveSpriteAccordingToAlignmentAndOffset(sprite, afs);
        }