Used Reflection to figure out which rectangle should be drawn

This commit is contained in:
ZestyTS 2020-10-01 21:59:29 -07:00
parent 5ff070c24e
commit 5971cf617a

View file

@ -2,6 +2,7 @@
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Drawing.Text; using System.Drawing.Text;
using System.Linq;
namespace UWUVCI_AIO_WPF.Classes namespace UWUVCI_AIO_WPF.Classes
{ {
@ -12,6 +13,14 @@ namespace UWUVCI_AIO_WPF.Classes
private Bitmap _frame; private Bitmap _frame;
private Bitmap _titleScreen; private Bitmap _titleScreen;
private Font font; private Font font;
public string _imageVar;
public Rectangle _rectangleGBA = new Rectangle(132, 260, 399, 266);
public Rectangle _rectangleGBC = new Rectangle(183, 260, 296, 266);
public Rectangle _rectangleH4V3 = new Rectangle(131, 249, 400, 300);
// Rectangle rectanglewii = new Rectangle(224, 201, 832, 332);
public Rectangle _rectangleWII = new Rectangle(224, 200, 832, 333);
public Bitmap Frame public Bitmap Frame
{ {
set set
@ -62,7 +71,7 @@ namespace UWUVCI_AIO_WPF.Classes
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)
{ {
if (!this.disposed) if (!disposed)
{ {
if (disposing) if (disposing)
{ {
@ -106,51 +115,14 @@ namespace UWUVCI_AIO_WPF.Classes
Pen outline = new Pen(Color.FromArgb(222, 222, 222), 4.0F); Pen outline = new Pen(Color.FromArgb(222, 222, 222), 4.0F);
Pen shadow = new Pen(Color.FromArgb(190, 190, 190), 6.0F); Pen shadow = new Pen(Color.FromArgb(190, 190, 190), 6.0F);
StringFormat format = new StringFormat(); StringFormat format = new StringFormat();
Rectangle rectangleGBA = new Rectangle(132, 260, 399, 266);
Rectangle rectangleGBC = new Rectangle(183, 260, 296, 266);
Rectangle rectangleH4V3 = new Rectangle(131, 249, 400, 300);
// Rectangle rectanglewii = new Rectangle(224, 201, 832, 332);
Rectangle rectanglewii = new Rectangle(224, 200, 832, 333);
if (console == "GBA")
{
if (TitleScreen != null)
g.DrawImage(TitleScreen, rectangleGBA);
else
g.FillRectangle(new SolidBrush(Color.Black), rectangleGBA);
}
else if (console == "GBC")
{
if (TitleScreen != null)
g.DrawImage(TitleScreen, rectangleGBC);
else
g.FillRectangle(new SolidBrush(Color.Black), rectangleGBC);
}
else if (console == "NDS")
{
if (TitleScreen != null)
{
g.DrawImage(TitleScreen, rectangleH4V3); _imageVar = "_rectangle" + (new[] { "other", "NDS" }.Contains(console) ? "H4V3" : console);
var rectangle = (Rectangle)GetType().GetField(_imageVar).GetValue(this);
}
else
g.FillRectangle(new SolidBrush(Color.Black), rectangleH4V3);
}
else if(console == "WII")
{
if (TitleScreen != null) if (TitleScreen != null)
g.DrawImage(TitleScreen, rectanglewii); g.DrawImage(TitleScreen, rectangle);
else else
g.FillRectangle(new SolidBrush(Color.Black), rectanglewii); g.FillRectangle(new SolidBrush(Color.Black), rectangle);
}
else
{
if (TitleScreen != null)
g.DrawImage(TitleScreen, rectangleH4V3);
else
g.FillRectangle(new SolidBrush(Color.Black), rectangleH4V3);
}
if (Frame != null) if (Frame != null)
g.DrawImage(Frame, new Rectangle(0, 0, 1280, 720)); g.DrawImage(Frame, new Rectangle(0, 0, 1280, 720));