experiments-monogame/UPWG/Elite/Scene.cs

56 lines
1.6 KiB
C#
Raw Normal View History

2024-09-06 23:47:51 +00:00
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Elite
{
public class Scene
{
public static int DefaultHeight = 800;
public static int DefaultWidth = 600;
public readonly int Width;
public readonly int Height;
public float Scale;
private SpriteBatch _batch;
private RenderTarget2D _target;
public Scene(int width, int height)
{
Width = width;
Height = height;
_batch = new SpriteBatch(Engine.Instance.GraphicsDevice);
_target = new RenderTarget2D(Engine.Instance.GraphicsDevice, Width, Height);
}
public Scene() : this(DefaultWidth, DefaultHeight)
{
}
public virtual void Draw(float elapsed)
{
Engine.Instance.GraphicsDevice.SetRenderTarget(_target);
Engine.Instance.GraphicsDevice.Clear(Color.SeaGreen);
/*
SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
foreach (var drawable in DrawList)
{
drawable.Draw(SpriteBatch);
}
SpriteBatch.End();
_graphicsDevice.SetRenderTarget(null);
SpriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
SpriteBatch.Draw(_target, Vector2.Zero, null, Color.LightBlue, 0.0f, Vector2.Zero, _scale,
SpriteEffects.None,
0.0f);
SpriteBatch.End();*/
}
public virtual void Update(float elapsed)
{
}
}
}