mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-21 01:39:32 +00:00
renamed to camera2d
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Game1
|
||||
private GraphicsDeviceManager _graphicsDeviceManager;
|
||||
private SpriteBatch _spriteBatch;
|
||||
private TextureRegion2D _textureRegion;
|
||||
private OrthographicCamera _camera;
|
||||
private Camera2D _camera;
|
||||
private Texture2D[] _backgroundTexture;
|
||||
private Texture2D _backgroundTextureClouds;
|
||||
private Texture2D _backgroundTextureSky;
|
||||
@@ -24,10 +24,9 @@ namespace Game1
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
_camera = new OrthographicCamera
|
||||
_camera = new Camera2D(GraphicsDevice.Viewport)
|
||||
{
|
||||
Origin = new Vector2(GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f),
|
||||
Zoom = 0.2f
|
||||
Zoom = 0.5f
|
||||
};
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
+9
-3
@@ -1,15 +1,21 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace MonoGame.Extended
|
||||
{
|
||||
public abstract class Camera : IMovable, IRotatable
|
||||
public class Camera2D : IMovable, IRotatable
|
||||
{
|
||||
protected Camera()
|
||||
public Camera2D(Viewport viewport)
|
||||
: this(viewport.Width, viewport.Height)
|
||||
{
|
||||
}
|
||||
|
||||
public Camera2D(int viewportWidth, int viewportHeight)
|
||||
{
|
||||
Position = Vector2.Zero;
|
||||
Rotation = 0;
|
||||
Zoom = 1;
|
||||
Origin = Vector2.Zero;
|
||||
Origin = new Vector2(viewportWidth / 2f, viewportHeight / 2f);
|
||||
}
|
||||
|
||||
public Vector2 Position { get; set; }
|
||||
@@ -34,10 +34,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Camera.cs" />
|
||||
<Compile Include="Camera2D.cs" />
|
||||
<Compile Include="IMovable.cs" />
|
||||
<Compile Include="IRotatable.cs" />
|
||||
<Compile Include="OrthographicCamera.cs" />
|
||||
<Compile Include="SpriteBatchExtensions.cs" />
|
||||
<Compile Include="TextureRegion2D.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace MonoGame.Extended
|
||||
{
|
||||
public class OrthographicCamera : Camera
|
||||
{
|
||||
public OrthographicCamera()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user