mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-23 22:31:06 +00:00
Fix line endings.
This commit is contained in:
parent
1540fab506
commit
03765583da
|
@ -8,11 +8,11 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace Examples.Tests
|
namespace Examples.Tests
|
||||||
|
@ -21,45 +21,45 @@ namespace Examples.Tests
|
||||||
public class GameWindowStates : GameWindow
|
public class GameWindowStates : GameWindow
|
||||||
{
|
{
|
||||||
TextureFont font = new TextureFont(new Font(FontFamily.GenericSansSerif, 16.0f));
|
TextureFont font = new TextureFont(new Font(FontFamily.GenericSansSerif, 16.0f));
|
||||||
TextPrinter printer = new TextPrinter();
|
TextPrinter printer = new TextPrinter();
|
||||||
|
|
||||||
#region GetNext and GetPrevious methods for enums.
|
#region GetNext and GetPrevious methods for enums.
|
||||||
|
|
||||||
T GetNext<T>(T t)
|
T GetNext<T>(T t)
|
||||||
{
|
{
|
||||||
if (!(t is Enum))
|
if (!(t is Enum))
|
||||||
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()),
|
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()),
|
||||||
"t");
|
"t");
|
||||||
|
|
||||||
string[] names = Enum.GetNames(t.GetType());
|
string[] names = Enum.GetNames(t.GetType());
|
||||||
T[] values = (T[])Enum.GetValues(t.GetType());
|
T[] values = (T[])Enum.GetValues(t.GetType());
|
||||||
|
|
||||||
int current_index = Array.IndexOf(names, t.ToString());
|
int current_index = Array.IndexOf(names, t.ToString());
|
||||||
if (current_index >= values.Length - 1)
|
if (current_index >= values.Length - 1)
|
||||||
return values[0];
|
return values[0];
|
||||||
else
|
else
|
||||||
return values[current_index + 1];
|
return values[current_index + 1];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T GetPrevious<T>(T t)
|
T GetPrevious<T>(T t)
|
||||||
{
|
{
|
||||||
if (!(t is Enum))
|
if (!(t is Enum))
|
||||||
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()),
|
throw new ArgumentException(String.Format("Should be an Enum type (is {0}).", t.GetType().ToString()),
|
||||||
"t");
|
"t");
|
||||||
|
|
||||||
string[] names = Enum.GetNames(t.GetType());
|
string[] names = Enum.GetNames(t.GetType());
|
||||||
T[] values = (T[])Enum.GetValues(t.GetType());
|
T[] values = (T[])Enum.GetValues(t.GetType());
|
||||||
|
|
||||||
int current_index = Array.IndexOf(names, t.ToString());
|
int current_index = Array.IndexOf(names, t.ToString());
|
||||||
if (current_index <= 0)
|
if (current_index <= 0)
|
||||||
return values[values.Length - 1];
|
return values[values.Length - 1];
|
||||||
else
|
else
|
||||||
return values[current_index - 1];
|
return values[current_index - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public GameWindowStates()
|
public GameWindowStates()
|
||||||
: base(800, 600)
|
: base(800, 600)
|
||||||
{
|
{
|
||||||
|
@ -78,31 +78,31 @@ namespace Examples.Tests
|
||||||
this.Exit();
|
this.Exit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenTK.Input.Key.Number1:
|
case OpenTK.Input.Key.Number1:
|
||||||
|
|
||||||
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
|
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
|
||||||
WindowState = GetPrevious(WindowState);
|
WindowState = GetPrevious(WindowState);
|
||||||
else
|
else
|
||||||
WindowState = GetNext(WindowState);
|
WindowState = GetNext(WindowState);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenTK.Input.Key.Number2:
|
case OpenTK.Input.Key.Number2:
|
||||||
|
|
||||||
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
|
if (sender[Key.ShiftLeft] || sender[Key.ShiftRight])
|
||||||
WindowBorder = GetPrevious(WindowBorder);
|
WindowBorder = GetPrevious(WindowBorder);
|
||||||
else
|
else
|
||||||
WindowBorder = GetNext(WindowBorder);
|
WindowBorder = GetNext(WindowBorder);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenTK.Input.Key.Number3:
|
case OpenTK.Input.Key.Number3:
|
||||||
|
|
||||||
if (this.WindowState == WindowState.Fullscreen)
|
if (this.WindowState == WindowState.Fullscreen)
|
||||||
this.WindowState = WindowState.Normal;
|
this.WindowState = WindowState.Normal;
|
||||||
else
|
else
|
||||||
this.WindowState = WindowState.Fullscreen;
|
this.WindowState = WindowState.Fullscreen;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,17 +119,17 @@ namespace Examples.Tests
|
||||||
printer.Begin();
|
printer.Begin();
|
||||||
|
|
||||||
printer.Draw("Instructions:", font); GL.Translate(0, font.Height, 0);
|
printer.Draw("Instructions:", font); GL.Translate(0, font.Height, 0);
|
||||||
printer.Draw(String.Format("1 - cycle through window styles (current: {0}).", this.WindowState), font);
|
printer.Draw(String.Format("1 - cycle through window styles (current: {0}).", this.WindowState), font);
|
||||||
GL.Translate(0, font.Height, 0);
|
GL.Translate(0, font.Height, 0);
|
||||||
printer.Draw(String.Format("2 - cycle through window borders (current: {0}).", this.WindowBorder), font);
|
printer.Draw(String.Format("2 - cycle through window borders (current: {0}).", this.WindowBorder), font);
|
||||||
GL.Translate(0, font.Height, 0);
|
GL.Translate(0, font.Height, 0);
|
||||||
printer.Draw(String.Format("3 - toggle fullscreen (current: {0}).",
|
printer.Draw(String.Format("3 - toggle fullscreen (current: {0}).",
|
||||||
this.WindowState == WindowState.Fullscreen ? "enabled" : "disabled"), font);
|
this.WindowState == WindowState.Fullscreen ? "enabled" : "disabled"), font);
|
||||||
|
|
||||||
|
|
||||||
printer.End();
|
printer.End();
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
Thread.Sleep(5);
|
Thread.Sleep(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace Examples.Tests
|
||||||
{
|
{
|
||||||
using (GameWindowStates ex = new GameWindowStates())
|
using (GameWindowStates ex = new GameWindowStates())
|
||||||
{
|
{
|
||||||
Utilities.SetWindowTitle(ex);
|
Utilities.SetWindowTitle(ex);
|
||||||
ex.Run(20.0);
|
ex.Run(20.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue