add fullscreen, enable input on focus, disable aplha
This commit is contained in:
parent
d54080c64e
commit
f37c01f08d
3 changed files with 84 additions and 4 deletions
|
@ -34,6 +34,8 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
private bool _titleEvent;
|
private bool _titleEvent;
|
||||||
|
|
||||||
|
private bool _toggleFullscreen;
|
||||||
|
|
||||||
private string _newTitle;
|
private string _newTitle;
|
||||||
|
|
||||||
private readonly long _ticksPerFrame;
|
private readonly long _ticksPerFrame;
|
||||||
|
@ -67,7 +69,11 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
|
_primaryController = new Input.NpadController(ConfigurationState.Instance.Hid.JoystickControls);
|
||||||
|
|
||||||
AddEvents((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));
|
AddEvents((int)(Gdk.EventMask.ButtonPressMask |
|
||||||
|
Gdk.EventMask.ButtonReleaseMask |
|
||||||
|
Gdk.EventMask.PointerMotionMask |
|
||||||
|
Gdk.EventMask.KeyPressMask |
|
||||||
|
Gdk.EventMask.KeyReleaseMask));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Parent_FocusOutEvent(object o, Gtk.FocusOutEventArgs args)
|
private void Parent_FocusOutEvent(object o, Gtk.FocusOutEventArgs args)
|
||||||
|
@ -87,6 +93,45 @@ namespace Ryujinx.Ui
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void HandleScreenState(KeyboardState keyboard)
|
||||||
|
{
|
||||||
|
bool toggleFullscreen = keyboard.IsKeyDown(OpenTK.Input.Key.F11) ||
|
||||||
|
((keyboard.IsKeyDown(OpenTK.Input.Key.AltLeft) || keyboard.IsKeyDown(OpenTK.Input.Key.AltRight))
|
||||||
|
&& keyboard.IsKeyDown(OpenTK.Input.Key.Enter));
|
||||||
|
|
||||||
|
if (toggleFullscreen == _toggleFullscreen)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_toggleFullscreen = toggleFullscreen;
|
||||||
|
|
||||||
|
if (IsFocussed)
|
||||||
|
{
|
||||||
|
if (this.ParentWindow.State.HasFlag(Gdk.WindowState.Fullscreen) )
|
||||||
|
{
|
||||||
|
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape) || _toggleFullscreen)
|
||||||
|
{
|
||||||
|
this.ParentWindow.Unfullscreen();
|
||||||
|
(this.Toplevel as MainWindow)?.ToggleExtraWidgets(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (keyboard.IsKeyDown(OpenTK.Input.Key.Escape))
|
||||||
|
{
|
||||||
|
Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_toggleFullscreen)
|
||||||
|
{
|
||||||
|
this.ParentWindow.Fullscreen();
|
||||||
|
(this.Toplevel as MainWindow)?.ToggleExtraWidgets(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void GLRenderer_Initialized(object sender, EventArgs e)
|
private void GLRenderer_Initialized(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Release the GL exclusivity that OpenTK gave us.
|
// Release the GL exclusivity that OpenTK gave us.
|
||||||
|
@ -211,9 +256,17 @@ namespace Ryujinx.Ui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
using (ScopedGLContext scopedGLContext = new ScopedGLContext(WindowInfo, GraphicsContext))
|
using (ScopedGLContext scopedGLContext = new ScopedGLContext(WindowInfo, GraphicsContext))
|
||||||
{
|
{
|
||||||
GL.ClearColor(Color4.Black);
|
GL.ClearColor(Color4.Black);
|
||||||
|
=======
|
||||||
|
GraphicsContext.MakeCurrent(WindowInfo);
|
||||||
|
|
||||||
|
GL.Disable(EnableCap.AlphaTest);
|
||||||
|
|
||||||
|
SwapBuffers();
|
||||||
|
>>>>>>> add fullscreen, enable input on focus, disable aplha
|
||||||
|
|
||||||
_ticks += _chrono.ElapsedTicks;
|
_ticks += _chrono.ElapsedTicks;
|
||||||
|
|
||||||
|
@ -272,7 +325,10 @@ namespace Ryujinx.Ui
|
||||||
this.ParentWindow.Title = _newTitle;
|
this.ParentWindow.Title = _newTitle;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
UpdateFrame();
|
if (IsFocussed)
|
||||||
|
{
|
||||||
|
UpdateFrame();
|
||||||
|
}
|
||||||
|
|
||||||
// Polling becomes expensive if it's not slept
|
// Polling becomes expensive if it's not slept
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
|
@ -299,6 +355,11 @@ namespace Ryujinx.Ui
|
||||||
|
|
||||||
KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();
|
KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();
|
||||||
|
|
||||||
|
Gtk.Application.Invoke(delegate
|
||||||
|
{
|
||||||
|
HandleScreenState(keyboard);
|
||||||
|
});
|
||||||
|
|
||||||
int leftJoystickDx = 0;
|
int leftJoystickDx = 0;
|
||||||
int leftJoystickDy = 0;
|
int leftJoystickDy = 0;
|
||||||
int rightJoystickDx = 0;
|
int rightJoystickDx = 0;
|
||||||
|
|
|
@ -49,6 +49,8 @@ namespace Ryujinx.Ui
|
||||||
#pragma warning disable IDE0044
|
#pragma warning disable IDE0044
|
||||||
|
|
||||||
[GUI] Window _mainWin;
|
[GUI] Window _mainWin;
|
||||||
|
[GUI] MenuBar _menuBar;
|
||||||
|
[GUI] Box _footerBox;
|
||||||
[GUI] CheckMenuItem _fullScreen;
|
[GUI] CheckMenuItem _fullScreen;
|
||||||
[GUI] MenuItem _stopEmulation;
|
[GUI] MenuItem _stopEmulation;
|
||||||
[GUI] CheckMenuItem _favToggle;
|
[GUI] CheckMenuItem _favToggle;
|
||||||
|
@ -444,6 +446,23 @@ namespace Ryujinx.Ui
|
||||||
_screenExitStatus.Set();
|
_screenExitStatus.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleExtraWidgets(bool show)
|
||||||
|
{
|
||||||
|
Gtk.Application.Invoke(delegate
|
||||||
|
{
|
||||||
|
if (show)
|
||||||
|
{
|
||||||
|
_menuBar.ShowAll();
|
||||||
|
_footerBox.ShowAll();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_menuBar.Hide();
|
||||||
|
_footerBox.Hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private static void UpdateGameMetadata(string titleId)
|
private static void UpdateGameMetadata(string titleId)
|
||||||
{
|
{
|
||||||
if (_gameLoaded)
|
if (_gameLoaded)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkMenuBar" id="MenuBar">
|
<object class="GtkMenuBar" id="_menuBar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
|
@ -402,7 +402,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="FooterBox">
|
<object class="GtkBox" id="_footerBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue