mirror of
https://github.com/riperiperi/FreeSO
synced 2026-08-13 20:26:13 -04:00
MPL per-file was used in older project files, but should apply to the whole project, so having it there was redundant.
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace FSOFacadeWorker
|
|
{
|
|
public class GraphicsDeviceServiceMock : IGraphicsDeviceService
|
|
{
|
|
GraphicsDevice _GraphicsDevice;
|
|
Form HiddenForm;
|
|
|
|
public GraphicsDeviceServiceMock()
|
|
{
|
|
HiddenForm = new Form()
|
|
{
|
|
Visible = true,
|
|
ShowInTaskbar = false
|
|
};
|
|
|
|
var Parameters = new PresentationParameters()
|
|
{
|
|
BackBufferWidth = 1280,
|
|
BackBufferHeight = 720,
|
|
DeviceWindowHandle = HiddenForm.Handle,
|
|
PresentationInterval = PresentInterval.Immediate,
|
|
IsFullScreen = false
|
|
};
|
|
|
|
_GraphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, Parameters);
|
|
_GraphicsDevice.Present();
|
|
}
|
|
|
|
public GraphicsDevice GraphicsDevice
|
|
{
|
|
get { return _GraphicsDevice; }
|
|
}
|
|
|
|
public event EventHandler<EventArgs> DeviceCreated;
|
|
public event EventHandler<EventArgs> DeviceDisposing;
|
|
public event EventHandler<EventArgs> DeviceReset;
|
|
public event EventHandler<EventArgs> DeviceResetting;
|
|
|
|
public void Release()
|
|
{
|
|
_GraphicsDevice.Dispose();
|
|
_GraphicsDevice = null;
|
|
|
|
HiddenForm.Close();
|
|
HiddenForm.Dispose();
|
|
HiddenForm = null;
|
|
}
|
|
}
|
|
}
|