RenderPanel - DrawScreenInfo() - clean up a lot of sloppy code and optimize some things
This commit is contained in:
parent
3420f0bc5e
commit
f9ecea8464
|
@ -5,6 +5,7 @@ using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using SlimDX;
|
using SlimDX;
|
||||||
using SlimDX.Direct3D9;
|
using SlimDX.Direct3D9;
|
||||||
|
@ -331,21 +332,20 @@ namespace BizHawk.MultiClient
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DrawScreenInfo()
|
public void DrawScreenInfo()
|
||||||
{
|
{
|
||||||
int x, y;
|
|
||||||
if (Global.Config.DisplayFrameCounter)
|
if (Global.Config.DisplayFrameCounter)
|
||||||
{
|
{
|
||||||
x = GetX(Global.Config.DispFrameCx, Global.Config.DispFrameanchor);
|
int x = GetX(Global.Config.DispFrameCx, Global.Config.DispFrameanchor);
|
||||||
y = GetY(Global.Config.DispFrameCy, Global.Config.DispFrameanchor);
|
int y = GetY(Global.Config.DispFrameCy, Global.Config.DispFrameanchor);
|
||||||
MessageFont.DrawString(null, MakeFrameCounter(), x + 1,
|
MessageFont.DrawString(null, MakeFrameCounter(), x + 1,
|
||||||
y + 1, new Color4(Color.Black));
|
y + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, MakeFrameCounter(), x,
|
MessageFont.DrawString(null, MakeFrameCounter(), x,
|
||||||
y, Color.FromArgb(Global.Config.MessagesColor));
|
y, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
if (Global.Config.DisplayInput)
|
if (Global.Config.DisplayInput)
|
||||||
{
|
{
|
||||||
Color c;
|
Color c;
|
||||||
x = GetX(Global.Config.DispInpx, Global.Config.DispInpanchor);
|
int x = GetX(Global.Config.DispInpx, Global.Config.DispInpanchor);
|
||||||
y = GetY(Global.Config.DispInpy, Global.Config.DispInpanchor);
|
int y = GetY(Global.Config.DispInpy, Global.Config.DispInpanchor);
|
||||||
if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
|
if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
|
||||||
{
|
{
|
||||||
c = Color.FromArgb(Global.Config.MovieInput);
|
c = Color.FromArgb(Global.Config.MovieInput);
|
||||||
|
@ -360,35 +360,35 @@ namespace BizHawk.MultiClient
|
||||||
if (Global.MovieSession.MultiTrack.IsActive)
|
if (Global.MovieSession.MultiTrack.IsActive)
|
||||||
{
|
{
|
||||||
MessageFont.DrawString(null, MT, Global.Config.DispFPSx + 1, //TODO: Multitrack position variables
|
MessageFont.DrawString(null, MT, Global.Config.DispFPSx + 1, //TODO: Multitrack position variables
|
||||||
Global.Config.DispFPSy + 1, new Color4(Color.Black));
|
Global.Config.DispFPSy + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, MT, Global.Config.DispFPSx,
|
MessageFont.DrawString(null, MT, Global.Config.DispFPSx,
|
||||||
Global.Config.DispFPSy, Color.FromArgb(Global.Config.MessagesColor));
|
Global.Config.DispFPSy, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
if (Global.Config.DisplayFPS && FPS != null)
|
if (Global.Config.DisplayFPS && FPS != null)
|
||||||
{
|
{
|
||||||
x = GetX(Global.Config.DispFPSx, Global.Config.DispFPSanchor);
|
int x = GetX(Global.Config.DispFPSx, Global.Config.DispFPSanchor);
|
||||||
y = GetY(Global.Config.DispFPSy, Global.Config.DispFPSanchor);
|
int y = GetY(Global.Config.DispFPSy, Global.Config.DispFPSanchor);
|
||||||
MessageFont.DrawString(null, FPS, x + 1,
|
MessageFont.DrawString(null, FPS, x + 1,
|
||||||
y + 1, new Color4(Color.Black));
|
y + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, FPS, x,
|
MessageFont.DrawString(null, FPS, x,
|
||||||
y, Color.FromArgb(Global.Config.MessagesColor));
|
y, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Config.DisplayLagCounter)
|
if (Global.Config.DisplayLagCounter)
|
||||||
{
|
{
|
||||||
x = GetX(Global.Config.DispLagx, Global.Config.DispLaganchor);
|
int x = GetX(Global.Config.DispLagx, Global.Config.DispLaganchor);
|
||||||
y = GetY(Global.Config.DispLagy, Global.Config.DispLaganchor);
|
int y = GetY(Global.Config.DispLagy, Global.Config.DispLaganchor);
|
||||||
if (Global.Emulator.IsLagFrame)
|
if (Global.Emulator.IsLagFrame)
|
||||||
{
|
{
|
||||||
AlertFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx + 1,
|
AlertFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx + 1,
|
||||||
Global.Config.DispLagy + 1, new Color4(Color.Black));
|
Global.Config.DispLagy + 1, Color.Black);
|
||||||
AlertFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx,
|
AlertFont.DrawString(null, MakeLagCounter(), Global.Config.DispLagx,
|
||||||
Global.Config.DispLagy, Color.FromArgb(Global.Config.AlertMessageColor));
|
Global.Config.DispLagy, Color.FromArgb(Global.Config.AlertMessageColor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageFont.DrawString(null, MakeLagCounter(), x + 1,
|
MessageFont.DrawString(null, MakeLagCounter(), x + 1,
|
||||||
y + 1, new Color4(Color.Black));
|
y + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, MakeLagCounter(), x,
|
MessageFont.DrawString(null, MakeLagCounter(), x,
|
||||||
y, Color.FromArgb(Global.Config.MessagesColor));
|
y, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
|
@ -396,35 +396,33 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
if (Global.Config.DisplayRerecordCount)
|
if (Global.Config.DisplayRerecordCount)
|
||||||
{
|
{
|
||||||
x = GetX(Global.Config.DispRecx, Global.Config.DispRecanchor);
|
int x = GetX(Global.Config.DispRecx, Global.Config.DispRecanchor);
|
||||||
y = GetY(Global.Config.DispRecy, Global.Config.DispRecanchor);
|
int y = GetY(Global.Config.DispRecy, Global.Config.DispRecanchor);
|
||||||
MessageFont.DrawString(null, MakeRerecordCount(), x + 1,
|
MessageFont.DrawString(null, MakeRerecordCount(), x + 1,
|
||||||
y + 1, new Color4(Color.Black));
|
y + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, MakeRerecordCount(), x,
|
MessageFont.DrawString(null, MakeRerecordCount(), x,
|
||||||
y, Color.FromArgb(Global.Config.MessagesColor));
|
y, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: clean this up or replace with simple draw symbols
|
if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
|
||||||
if (Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY
|
|
||||||
|| Global.MainForm.UserMovie.Mode == MOVIEMODE.PLAY)
|
|
||||||
{
|
{
|
||||||
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 47,
|
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 47,
|
||||||
0 + 1, new Color4(Color.Black));
|
0 + 1, Color.Black);
|
||||||
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 48,
|
MessageFont.DrawString(null, "Play", backingControl.Size.Width - 48,
|
||||||
0, Color.FromArgb(Global.Config.MovieColor));
|
0, Color.FromArgb(Global.Config.MovieColor));
|
||||||
}
|
}
|
||||||
else if (Global.MainForm.UserMovie.Mode == MOVIEMODE.RECORD)
|
else if (Global.MainForm.UserMovie.Mode == MOVIEMODE.RECORD)
|
||||||
{
|
{
|
||||||
AlertFont.DrawString(null, "Record", backingControl.Size.Width - 65,
|
AlertFont.DrawString(null, "Record", backingControl.Size.Width - 65,
|
||||||
0 + 1, new Color4(Color.Black));
|
0 + 1, Color.Black);
|
||||||
AlertFont.DrawString(null, "Record", backingControl.Size.Width - 64,
|
AlertFont.DrawString(null, "Record", backingControl.Size.Width - 64,
|
||||||
0, Color.FromArgb(Global.Config.MovieColor));
|
0, Color.FromArgb(Global.Config.MovieColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Global.Config.DisplaySubtitles)
|
if (Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE && Global.Config.DisplaySubtitles)
|
||||||
{
|
{
|
||||||
//TODO: implement multiple subtitles at once feature
|
//TODO: implement multiple subtitles at once feature
|
||||||
Subtitle s = new Subtitle(Global.MainForm.UserMovie.Subtitles.GetSubtitle(Global.Emulator.Frame));
|
Subtitle s = Global.MainForm.UserMovie.Subtitles.GetSubtitle(Global.Emulator.Frame);
|
||||||
MessageFont.DrawString(null, s.Message, s.X + 1,
|
MessageFont.DrawString(null, s.Message, s.X + 1,
|
||||||
s.Y + 1, new Color4(Color.Black));
|
s.Y + 1, new Color4(Color.Black));
|
||||||
MessageFont.DrawString(null, s.Message, s.X,
|
MessageFont.DrawString(null, s.Message, s.X,
|
||||||
|
@ -471,7 +469,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
int x = 3;
|
int x = 3;
|
||||||
int y = backingControl.Size.Height - (line * 18);
|
int y = backingControl.Size.Height - (line * 18);
|
||||||
MessageFont.DrawString(null, messages[i].Message, x + 2, y + 2, new Color4(Color.Black));
|
MessageFont.DrawString(null, messages[i].Message, x + 2, y + 2, Color.Black);
|
||||||
MessageFont.DrawString(null, messages[i].Message, x, y, Color.FromArgb(Global.Config.MessagesColor));
|
MessageFont.DrawString(null, messages[i].Message, x, y, Color.FromArgb(Global.Config.MessagesColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,21 +487,18 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public string MakeInputDisplay()
|
public string MakeInputDisplay()
|
||||||
{
|
{
|
||||||
string tmp = Global.GetOutputControllersAsMnemonic();
|
StringBuilder s = new StringBuilder(Global.GetOutputControllersAsMnemonic());
|
||||||
tmp = tmp.Replace(".", " ");
|
s.Replace(".", " ");
|
||||||
tmp = tmp.Replace("|", "");
|
s.Replace("|", "");
|
||||||
return tmp;
|
return s.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string MakeRerecordCount()
|
public string MakeRerecordCount()
|
||||||
{
|
{
|
||||||
string tmp = "";
|
|
||||||
if (Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE)
|
if (Global.MainForm.UserMovie.Mode != MOVIEMODE.INACTIVE)
|
||||||
{
|
return "Rerecord Count: " + Global.MainForm.UserMovie.Rerecords.ToString();
|
||||||
tmp += "Rerecord Count: ";
|
else
|
||||||
tmp += Global.MainForm.UserMovie.Rerecords.ToString();
|
return "";
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue