mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-06-18 07:40:16 +00:00
Changed all GameWindow.Fullscreen properties to GameWindow.WindowState.
Added WindowState test app.
This commit is contained in:
parent
35b58ffda7
commit
c60558ed16
63
Source/Examples/Tests/GameWindowStates.cs
Normal file
63
Source/Examples/Tests/GameWindowStates.cs
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#region --- License ---
|
||||||
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
||||||
|
* See license.txt for license info
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace Examples.Tests
|
||||||
|
{
|
||||||
|
[Example("GameWindow states.", ExampleCategory.Test)]
|
||||||
|
public class GameWindowStates : GameWindow
|
||||||
|
{
|
||||||
|
public GameWindowStates()
|
||||||
|
: base(800, 600)
|
||||||
|
{
|
||||||
|
this.VSync = VSyncMode.On;
|
||||||
|
this.Keyboard.KeyRepeat = true;
|
||||||
|
this.Keyboard.KeyUp += new OpenTK.Input.KeyUpEvent(Keyboard_KeyUp);
|
||||||
|
|
||||||
|
GL.ClearColor(System.Drawing.Color.SteelBlue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Keyboard_KeyUp(OpenTK.Input.KeyboardDevice sender, OpenTK.Input.Key key)
|
||||||
|
{
|
||||||
|
if (key == OpenTK.Input.Key.Escape)
|
||||||
|
this.Exit();
|
||||||
|
|
||||||
|
if (key == OpenTK.Input.Key.Space)
|
||||||
|
{
|
||||||
|
switch (this.WindowState)
|
||||||
|
{
|
||||||
|
case WindowState.Normal: this.WindowState = WindowState.Maximized; break;
|
||||||
|
case WindowState.Maximized: this.WindowState = WindowState.Minimized; break;
|
||||||
|
case WindowState.Minimized: this.WindowState = WindowState.Fullscreen; break;
|
||||||
|
case WindowState.Fullscreen: this.WindowState = WindowState.Normal; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnRenderFrame(RenderFrameEventArgs e)
|
||||||
|
{
|
||||||
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
|
|
||||||
|
SwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
using (GameWindowStates ex = new GameWindowStates())
|
||||||
|
{
|
||||||
|
Utilities.SetWindowTitle(ex);
|
||||||
|
ex.Run(20.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,8 +38,10 @@ namespace Examples.Tutorial
|
||||||
/// <param name="key">The key that was pressed.</param>
|
/// <param name="key">The key that was pressed.</param>
|
||||||
void Keyboard_KeyDown(KeyboardDevice sender, Key key)
|
void Keyboard_KeyDown(KeyboardDevice sender, Key key)
|
||||||
{
|
{
|
||||||
if ((sender[Key.AltLeft] || sender[Key.AltRight]) && sender[Key.Enter])
|
if (WindowState != WindowState.Fullscreen)
|
||||||
this.Fullscreen = !this.Fullscreen;
|
WindowState = WindowState.Fullscreen;
|
||||||
|
else
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
|
||||||
if (sender[Key.Escape])
|
if (sender[Key.Escape])
|
||||||
this.Exit();
|
this.Exit();
|
||||||
|
|
|
@ -119,9 +119,10 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
// Alt+Enter toggles fullscreen mode.
|
// Alt+Enter toggles fullscreen mode.
|
||||||
if ((Keyboard[Key.AltLeft] || Keyboard[Key.AltRight]) && Keyboard[Key.Enter])
|
if ((Keyboard[Key.AltLeft] || Keyboard[Key.AltRight]) && Keyboard[Key.Enter])
|
||||||
{
|
if (WindowState != WindowState.Fullscreen)
|
||||||
Fullscreen = !Fullscreen;
|
WindowState = WindowState.Fullscreen;
|
||||||
}
|
else
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
|
||||||
// Plus/Minus change the target render frequency.
|
// Plus/Minus change the target render frequency.
|
||||||
// PageUp/PageDown change the target update frequency.
|
// PageUp/PageDown change the target update frequency.
|
||||||
|
|
|
@ -110,9 +110,10 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
if ((Keyboard[OpenTK.Input.Key.AltLeft] || Keyboard[OpenTK.Input.Key.AltRight]) &&
|
if ((Keyboard[OpenTK.Input.Key.AltLeft] || Keyboard[OpenTK.Input.Key.AltRight]) &&
|
||||||
Keyboard[OpenTK.Input.Key.Enter])
|
Keyboard[OpenTK.Input.Key.Enter])
|
||||||
{
|
if (WindowState != WindowState.Fullscreen)
|
||||||
Fullscreen = !Fullscreen;
|
WindowState = WindowState.Fullscreen;
|
||||||
}
|
else
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
|
|
||||||
if (Mouse[OpenTK.Input.MouseButton.Left])
|
if (Mouse[OpenTK.Input.MouseButton.Left])
|
||||||
x_angle += Mouse.XDelta;
|
x_angle += Mouse.XDelta;
|
||||||
|
|
|
@ -14,7 +14,7 @@ using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
@ -221,7 +221,10 @@ namespace Examples.Tutorial
|
||||||
|
|
||||||
if ((Keyboard[OpenTK.Input.Key.AltLeft] || Keyboard[OpenTK.Input.Key.AltRight]) &&
|
if ((Keyboard[OpenTK.Input.Key.AltLeft] || Keyboard[OpenTK.Input.Key.AltRight]) &&
|
||||||
Keyboard[OpenTK.Input.Key.Enter])
|
Keyboard[OpenTK.Input.Key.Enter])
|
||||||
Fullscreen = !Fullscreen;
|
if (WindowState != WindowState.Fullscreen)
|
||||||
|
WindowState = WindowState.Fullscreen;
|
||||||
|
else
|
||||||
|
WindowState = WindowState.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue