Beispiel #1
0
 public ModeGameplay(Game game, InputState inputState, GraphicsDevice graphicsDevice)
 {
     this.Game = game;
     this.InputState = inputState;
     Background = new Background(graphicsDevice);
     Map = new Rectangle(0, 0, 5000, 5000);
     Camera = new Camera(graphicsDevice.Viewport.Bounds, Map);
     SoundManager.camera = Camera;
 }
Beispiel #2
0
        public override void Draw(SpriteBatch spriteBatch, Rectangle map, Camera camera)
        {
            int xOffset = (camera.screen.Width - this.DrawBounds.Width) / 2;
            int yOffset = (camera.screen.Height - this.DrawBounds.Height) / 2;
            this.Position = new Vector2(xOffset, yOffset);

            spriteBatch.Draw(
                    Texture,
                    Position,
                    DrawBounds,
                    Tint,
                    Rotation,
                    Vector2.Zero,
                    1.0f,
                    SpriteEffects.None,
                    0f);

            Vector2 textOffset = new Vector2(32, 32);
            string text = GetText();
            spriteBatch.DrawString(Font, text, Position + textOffset, Color.White);
        }
Beispiel #3
0
 public GameScreen(G g)
 {
     camera = new Camera();
     island = new Island();
     CanTakePhoto = true;
 }
Beispiel #4
0
 public Camera()
 {
     c = this;
 }
Beispiel #5
0
 public SceneGraph(Rectangle map, Camera camera)
 {
     this.Map = map;
     this.Camera = camera;
 }
Beispiel #6
0
        public virtual void Draw(SpriteBatch spriteBatch, Rectangle map, Camera camera)
        {
            Vector2 drawPosition = Position;
            Rectangle viewport = camera.screen;

            if (camera.Position.X < viewport.Width)
            {
                if ((map.Width - Position.X) < viewport.Width)
                {
                    drawPosition.X = Position.X - map.Width;
                }
            }
            else if (map.Width - camera.Position.X < viewport.Width)
            {
                if (Position.X < viewport.Width)
                {
                    drawPosition.X = map.Width + Position.X;
                }
            }

            if (camera.Position.Y < viewport.Height)
            {
                if ((map.Height - Position.Y) < viewport.Height)
                {
                    drawPosition.Y = Position.Y - map.Height;
                }
            }
            else if (map.Height - camera.Position.Y < viewport.Height)
            {
                if (Position.Y < viewport.Height)
                {
                    drawPosition.Y = map.Height + Position.Y;
                }
            }

            spriteBatch.Draw(
                    Texture,
                    drawPosition,
                    DrawBounds,
                    Tint,
                    Rotation,
                    new Vector2(Center.X, Center.Y),
                    1.0f,
                    SpriteEffects.None,
                    0f);
        }