Move status information from the title bar to the new status bar (#948)

* Move status information from the title bar to the new status bar

* jd's requested changes

* Ack's requested changes

* gdk's requested changes

* Remove frame time statistics
This commit is contained in:
Xpl0itR 2020-03-07 02:40:06 +00:00 committed by GitHub
parent ab3b6ea6d4
commit e2bb5e8091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 145 additions and 36 deletions

View file

@ -24,6 +24,8 @@ namespace Ryujinx.Ui
public ManualResetEvent WaitEvent { get; set; }
public static event EventHandler<StatusUpdatedEventArgs> StatusUpdatedEvent;
public bool IsActive { get; set; }
public bool IsStopped { get; set; }
public bool IsFocused { get; set; }
@ -32,12 +34,8 @@ namespace Ryujinx.Ui
private double _mouseY;
private bool _mousePressed;
private bool _titleEvent;
private bool _toggleFullscreen;
private string _newTitle;
private readonly long _ticksPerFrame;
private long _ticks = 0;
@ -179,6 +177,14 @@ namespace Ryujinx.Ui
Gtk.Application.Invoke(delegate
{
parent.Present();
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
: " | " + _device.System.TitleName;
string titleIdSection = string.IsNullOrWhiteSpace(_device.System.TitleIdText) ? string.Empty
: " | " + _device.System.TitleIdText.ToUpper();
parent.Title = $"Ryujinx {Program.Version}{titleNameSection}{titleIdSection}";
});
Thread renderLoopThread = new Thread(Render)
@ -319,19 +325,10 @@ namespace Ryujinx.Ui
_device.Statistics.RecordSystemFrameTime();
double hostFps = _device.Statistics.GetSystemFrameRate();
double gameFps = _device.Statistics.GetGameFrameRate();
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
: " | " + _device.System.TitleName;
string titleIdSection = string.IsNullOrWhiteSpace(_device.System.TitleIdText) ? string.Empty
: " | " + _device.System.TitleIdText.ToUpper();
_newTitle = $"Ryujinx {Program.Version}{titleNameSection}{titleIdSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " +
$"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}";
_titleEvent = true;
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
_device.EnableDeviceVsync,
$"Host: {_device.Statistics.GetSystemFrameRate():00.00} FPS",
$"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS"));
_device.System.SignalVsync();
@ -351,16 +348,6 @@ namespace Ryujinx.Ui
{
while (IsActive)
{
if (_titleEvent)
{
_titleEvent = false;
Gtk.Application.Invoke(delegate
{
this.ParentWindow.Title = _newTitle;
});
}
UpdateFrame();
// Polling becomes expensive if it's not slept