public class RecordDiff
{
private static List<RecordDiff> registered_list = new List<RecordDiff>();
bool isfullscreen = false;
bool isgdfullscreen = false;
bool iswidescreen = false;
Point preferedbackbuffwh = new Point();
SurfaceFormat preferedbackbufferformat;
Rectangle windowclientbounds = new Rectangle();
DisplayOrientation displayorientation = DisplayOrientation.Default;
Rectangle gdpresentationparambounds = new Rectangle();
Point presentationparametersbackbufferwh = new Point();
SurfaceFormat presentationparametersbackbufferformat;
Viewport viewport = new Viewport();
Rectangle viewporttilesafearea = new Rectangle();
Point displaymodeWh = new Point();
Rectangle displaymodetilesafearea = new Rectangle();
bool isdefaultgraphicsadapter = true;
Point gdcurrentdisplaymodewh = new Point();
Rectangle gdcurrentdisplaymodetilesafearea = new Rectangle();
public static bool EnoughRecords { get { return (registered_list.Count > 1); } }
public RecordDiff(GraphicsDeviceManager gdm, GraphicsDevice gd, GameWindow Window)
{
isfullscreen = gdm.IsFullScreen;
isgdfullscreen = gd.PresentationParameters.IsFullScreen;
iswidescreen = false;
preferedbackbuffwh = new Point(gdm.PreferredBackBufferWidth, gdm.PreferredBackBufferHeight);
preferedbackbufferformat = gdm.PreferredBackBufferFormat;
windowclientbounds = Window.ClientBounds;
displayorientation = gd.PresentationParameters.DisplayOrientation;
gdpresentationparambounds = gd.PresentationParameters.Bounds;
presentationparametersbackbufferwh = new Point(gd.PresentationParameters.BackBufferWidth, gd.PresentationParameters.BackBufferHeight);
presentationparametersbackbufferformat = gd.PresentationParameters.BackBufferFormat;
viewport = gd.Viewport;
viewporttilesafearea = gd.Viewport.TitleSafeArea;
displaymodeWh = new Point(gd.DisplayMode.Width, gd.DisplayMode.Height);
displaymodetilesafearea = gd.DisplayMode.TitleSafeArea;
isdefaultgraphicsadapter = true;//gd.Adapter.IsDefaultAdapter; // not implemented in monogame
gdcurrentdisplaymodewh = new Point(gd.Adapter.CurrentDisplayMode.Width, gd.Adapter.CurrentDisplayMode.Height);
gdcurrentdisplaymodetilesafearea = gd.Adapter.CurrentDisplayMode.TitleSafeArea;
// add it
registered_list.Add(this);
}
public static void DisplayDifferences(bool displayunchanged)
{
if (EnoughRecords)
{
int to = registered_list.Count - 1;
int from = to - 1;
TheDifferences(registered_list[from], registered_list[to], displayunchanged);
}
}
private static void TheDifferences(RecordDiff A, RecordDiff B, bool displayunchanged)
{
string differences = "";
string stayedthesame = "";
string formating = "\n diff {0} CHANGE FROM {1} TO {2}";
string formating2 = "\n nochange {0}";
string changedvar = "";
differences += string.Format("\n ------ changes that occured -----------");
differences += string.Format("\n ---------------------------------------");
stayedthesame += string.Format("\n ------ remained unchanged -----------");
stayedthesame += string.Format("\n ---------------------------------------");
if (A.isfullscreen != B.isfullscreen) { changedvar = "gdm.FullScreen"; differences += string.Format(formating, changedvar, A.isfullscreen, B.isfullscreen); }
else { stayedthesame += string.Format(formating2, "gdm.FullScreen"); }
if (A.isgdfullscreen != B.isgdfullscreen) { changedvar = "gd.PresentationParameters.IsFullScreen"; differences += string.Format(formating, changedvar, A.isgdfullscreen, B.isgdfullscreen); }
else { stayedthesame += string.Format(formating2, "gd.PresentationParameters.IsFullScreen"); }
if (A.iswidescreen != B.iswidescreen) { changedvar = "gd.Adapter.isWideScreen"; differences += string.Format(formating, changedvar, A.iswidescreen, B.iswidescreen); }
else { stayedthesame += string.Format(formating2, "gd.Adapter.isWideScreen"); }
if (A.preferedbackbuffwh != B.preferedbackbuffwh) { changedvar = "gdm.PreferredBackBuffer(Width Height)"; differences += string.Format(formating, changedvar, A.preferedbackbuffwh, B.preferedbackbuffwh); }
else { stayedthesame += string.Format(formating2, "gdm.PreferredBackBuffer(Width Height)"); }
if (A.preferedbackbufferformat != B.preferedbackbufferformat) { changedvar = "gdm.PreferredBackBufferFormat"; differences += string.Format(formating, changedvar, A.preferedbackbufferformat, B.preferedbackbufferformat); }
else { stayedthesame += string.Format(formating2, "gdm.PreferredBackBufferFormat"); }
if (A.windowclientbounds != B.windowclientbounds) { changedvar = "Window.ClientBounds"; differences += string.Format(formating, changedvar, A.windowclientbounds, B.windowclientbounds); }
else { stayedthesame += string.Format(formating2, "Window.ClientBounds"); }
if (A.displayorientation != B.displayorientation) { changedvar = "gd.PresentationParameters.DisplayOrientation"; differences += string.Format(formating, changedvar, A.displayorientation, B.displayorientation); }
else { stayedthesame += string.Format(formating2, "gd.PresentationParameters.DisplayOrientation"); }
if (A.gdpresentationparambounds != B.gdpresentationparambounds) { changedvar = "gd.PresentationParameters.Bounds"; differences += string.Format(formating, changedvar, A.gdpresentationparambounds, B.gdpresentationparambounds); }
else { stayedthesame += string.Format(formating2, "gd.PresentationParameters.Bounds"); }
if (A.presentationparametersbackbufferwh != B.presentationparametersbackbufferwh) { changedvar = "gd.PresentationParameters.BackBuffer(WidthHeight)"; differences += string.Format(formating, changedvar, A.presentationparametersbackbufferwh, B.presentationparametersbackbufferwh); }
else { stayedthesame += string.Format(formating2, "gd.PresentationParameters.BackBuffer(WidthHeight)"); }
if (A.presentationparametersbackbufferformat != B.presentationparametersbackbufferformat) { changedvar = "gd.PresentationParameters.BackBufferFormat"; differences += string.Format(formating, changedvar, A.presentationparametersbackbufferformat, B.presentationparametersbackbufferformat); }
else { stayedthesame += string.Format(formating2, "gd.PresentationParameters.BackBufferFormat"); }
if (A.viewport.Bounds != B.viewport.Bounds) { changedvar = "gd.Viewport"; differences += string.Format(formating, changedvar, A.viewport, B.viewport); }
else { stayedthesame += string.Format(formating2, "gd.Viewport"); }
if (A.viewporttilesafearea != B.viewporttilesafearea) { changedvar = "gd.Viewport.TitleSafeArea"; differences += string.Format(formating, changedvar, A.viewporttilesafearea, B.viewporttilesafearea); }
else { stayedthesame += string.Format(formating2, "gd.Viewport.TitleSafeArea"); }
if (A.displaymodeWh != B.displaymodeWh) { changedvar = "gd.DisplayMode.(Width, Height)"; differences += string.Format(formating, changedvar, A.displaymodeWh, B.displaymodeWh); }
else { stayedthesame += string.Format(formating2, "gd.DisplayMode.(Width, Height)"); }
if (A.displaymodetilesafearea != B.displaymodetilesafearea) { changedvar = "gd.DisplayMode.TitleSafeArea"; differences += string.Format(formating, changedvar, A.displaymodetilesafearea, B.displaymodetilesafearea); }
else { stayedthesame += string.Format(formating2, "gd.DisplayMode.TitleSafeArea"); }
if (A.isdefaultgraphicsadapter != B.isdefaultgraphicsadapter) { changedvar = "gd.Adapter.IsDefaultAdapter"; differences += string.Format(formating, changedvar, A.isdefaultgraphicsadapter, B.isdefaultgraphicsadapter); }
else { stayedthesame += string.Format(formating2, "gd.Adapter.IsDefaultAdapter"); }
if (A.gdcurrentdisplaymodewh != B.gdcurrentdisplaymodewh) { changedvar = "gd.Adapter.CurrentDisplayMode.WH"; differences += string.Format(formating, changedvar, A.gdcurrentdisplaymodewh, B.gdcurrentdisplaymodewh); }
else { stayedthesame += string.Format(formating2, "gd.Adapter.CurrentDisplayMode.WH"); }
if (A.gdcurrentdisplaymodetilesafearea != B.gdcurrentdisplaymodetilesafearea) { changedvar = "gd.Adapter.CurrentDisplayMode.TitleSafeArea"; differences += string.Format(formating, changedvar, A.gdcurrentdisplaymodetilesafearea, B.gdcurrentdisplaymodetilesafearea); }
else { stayedthesame += string.Format(formating2, "gd.Adapter.CurrentDisplayMode.TitleSafeArea"); }
differences += string.Format("\n ---------------------------------------");
stayedthesame += string.Format("\n ---------------------------------------");
//
Console.WriteLine(differences);
if (displayunchanged)
Console.WriteLine(stayedthesame);
}
public static void DisplayCurrentStatus(GraphicsDeviceManager gdm, GraphicsDevice gd, GameWindow Window)
{
Console.WriteLine(" DisplayCurrentStatus ");
if (gdm.IsFullScreen)
Console.WriteLine(" ___________Info______Gdm_Currently FullScreen");
else
Console.WriteLine(" ___________Info______Gdm_Currently Windowed");
if (gd.PresentationParameters.IsFullScreen)
Console.WriteLine(" gd.PresentationParameters.IsFullScreen Currently FullScreen");
else
Console.WriteLine(" gd.PresentationParameters.IsFullScreen Currently Windowed");
Console.WriteLine(" gd.Adapter.IsWideScreen " + gd.Adapter.IsWideScreen);
Console.WriteLine(" gdm.PreferredBackBuffer WH: Width:" + gdm.PreferredBackBufferWidth + " Height:" + gdm.PreferredBackBufferHeight);
Console.WriteLine(" gdm.PreferredBackBufferFormat " + gdm.PreferredBackBufferFormat);
Console.WriteLine(" Window.ClientBounds " + Window.ClientBounds);
Console.WriteLine(" gd.PresentationParameters.DisplayOrientation " + gd.PresentationParameters.DisplayOrientation);
Console.WriteLine(" gd.PresentationParameters.Bounds " + gd.PresentationParameters.Bounds);
Console.WriteLine(" gd.PresentationParameters.BackBuffer WH: Width:" + gd.PresentationParameters.BackBufferWidth + " Height:" + gd.PresentationParameters.BackBufferHeight);
Console.WriteLine(" gd.PresentationParameters.BackBufferFormat " + gd.PresentationParameters.BackBufferFormat);
Console.WriteLine(" gd.Viewport " + gd.Viewport);
Console.WriteLine(" gd.Viewport.TitleSafeArea " + gd.Viewport.TitleSafeArea);
Console.WriteLine(" gd.DisplayMode.Width, Height Width:" + gd.DisplayMode.Width + " Height:" + gd.DisplayMode.Height);
Console.WriteLine(" gd.DisplayMode.TitleSafeArea " + gd.DisplayMode.TitleSafeArea);
//Console.WriteLine("gd.Adapter.IsDefaultAdapter " + gd.Adapter.IsDefaultAdapter); //// not yet implemented in monogame
Console.WriteLine(" gd.Adapter.IsDefaultAdapter not yet implemented in monogame");
Console.WriteLine(" gd.Adapter.CurrentDisplayMode WH: Width:" + gd.Adapter.CurrentDisplayMode.Width + " Height:" + gd.Adapter.CurrentDisplayMode.Height);
Console.WriteLine(" gd.Adapter.CurrentDisplayMode.TitleSafeArea " + gd.Adapter.CurrentDisplayMode.TitleSafeArea);
Console.WriteLine(" ________________________________");
}
}
}
}