mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-24 05:10:42 -04:00
Merge branch 'master' of github.com:UnknownShadow200/ClassicalSharp
This commit is contained in:
commit
50e45963b1
@ -32,9 +32,7 @@ namespace ClassicalSharp.Gui {
|
||||
|
||||
/// <summary> Causes the gui element to recreate all of its sub-elements and/or textures. </summary>
|
||||
/// <remarks> Typically used when bitmap font changes. </remarks>
|
||||
public virtual void Recreate() {
|
||||
Dispose(); Init();
|
||||
}
|
||||
public void Recreate() { Dispose(); Init(); }
|
||||
|
||||
/// <summary> Called when the game window is resized. </summary>
|
||||
public abstract void OnResize( int width, int height );
|
||||
|
37
ClassicalSharp/2D/Screens/DeathScreen.cs
Normal file
37
ClassicalSharp/2D/Screens/DeathScreen.cs
Normal file
@ -0,0 +1,37 @@
|
||||
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace ClassicalSharp.Gui.Screens {
|
||||
public class DeathScreen : MenuScreen {
|
||||
|
||||
public DeathScreen( Game game ) : base( game ) {
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 40, FontStyle.Regular );
|
||||
|
||||
widgets = new Widget[] {
|
||||
ChatTextWidget.Create( game, 0, -150, "Game over!", Anchor.Centre, Anchor.Centre, regularFont ),
|
||||
ChatTextWidget.Create( game, 0, -75, "Score: 0", Anchor.Centre, Anchor.Centre, titleFont ),
|
||||
ButtonWidget.Create( game, 0, 25, 401, 40, "Generate new level...",
|
||||
Anchor.Centre, Anchor.Centre, titleFont, GenLevelClick ),
|
||||
ButtonWidget.Create( game, 0, 75, 401, 40, "Load level...",
|
||||
Anchor.Centre, Anchor.Centre, titleFont, LoadLevelClick ),
|
||||
};
|
||||
}
|
||||
|
||||
void GenLevelClick( Game g, Widget w, MouseButton mouseBtn ) {
|
||||
if( mouseBtn != MouseButton.Left ) return;
|
||||
game.Gui.SetNewScreen( new GenLevelScreen( game ) );
|
||||
}
|
||||
|
||||
void LoadLevelClick( Game g, Widget w, MouseButton mouseBtn ) {
|
||||
if( mouseBtn != MouseButton.Left ) return;
|
||||
game.Gui.SetNewScreen( new LoadLevelScreen( game ) );
|
||||
}
|
||||
}
|
||||
}
|
@ -77,7 +77,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
return HandleMouseMove( widgets, mouseX, mouseY );
|
||||
}
|
||||
|
||||
public override bool HandlesMouseScroll( int delta ) { return true; }
|
||||
public override bool HandlesMouseScroll( int delta ) { return true; }
|
||||
|
||||
public override bool HandlesMouseUp( int mouseX, int mouseY, MouseButton button ) { return true; }
|
||||
|
||||
|
@ -113,7 +113,8 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
int index = 0;
|
||||
Texture tex = posAtlas.tex;
|
||||
tex.X1 = 2; tex.Width = (short)posAtlas.offset;
|
||||
IGraphicsApi.Make2DQuad( ref tex, FastColour.White, game.ModelCache.vertices, ref index );
|
||||
IGraphicsApi.Make2DQuad( ref tex, FastColour.WhitePacked,
|
||||
game.ModelCache.vertices, ref index );
|
||||
|
||||
Vector3I pos = Vector3I.Floor( game.LocalPlayer.Position );
|
||||
posAtlas.curX = posAtlas.offset + 2;
|
||||
|
@ -42,7 +42,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
VertexP3fT2fC4b[] vertices = game.ModelCache.vertices;
|
||||
int index = 0, atlasIndex = 0;
|
||||
int drawnY = 0, height = game.Height;
|
||||
FastColour col = new FastColour( 64, 64, 64 );
|
||||
int col = new FastColour( 64, 64, 64 ).Pack();
|
||||
|
||||
int texLoc = game.BlockInfo.GetTextureLoc( Block.Dirt, Side.Top );
|
||||
TerrainAtlas1D atlas = game.TerrainAtlas1D;
|
||||
|
@ -22,11 +22,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
}
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
gfx.Texturing = true;
|
||||
RenderMenuWidgets( delta );
|
||||
gfx.Texturing = false;
|
||||
|
||||
base.Render( delta );
|
||||
float cX = game.Width / 2, cY = game.Height / 2;
|
||||
gfx.Draw2DQuad( cX - 250, cY - 65, 500, 2, grey );
|
||||
gfx.Draw2DQuad( cX - 250, cY + 45, 500, 2, grey );
|
||||
@ -66,8 +62,9 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
public override void Init() {
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
base.Init();
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
|
||||
string flags = HotkeyListScreen.MakeFlagsString( curHotkey.Flags );
|
||||
if( curHotkey.Text == null ) curHotkey.Text = "";
|
||||
string staysOpen = curHotkey.StaysOpen ? "yes" : "no";
|
||||
|
@ -15,13 +15,6 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
MenuInputWidget selectedWidget;
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
gfx.Texturing = true;
|
||||
RenderMenuWidgets( delta );
|
||||
gfx.Texturing = false;
|
||||
}
|
||||
|
||||
public override bool HandlesMouseClick( int mouseX, int mouseY, MouseButton button ) {
|
||||
return HandleMouseClick( widgets, mouseX, mouseY, button );
|
||||
}
|
||||
@ -47,7 +40,6 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
public override void Init() {
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
base.Init();
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
|
||||
|
@ -4,21 +4,12 @@ using System.Drawing;
|
||||
using ClassicalSharp.Gui.Widgets;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace ClassicalSharp.Gui.Screens {
|
||||
namespace ClassicalSharp.Gui.Screens {
|
||||
public abstract class KeyBindingsScreen : MenuScreen {
|
||||
|
||||
public KeyBindingsScreen( Game game ) : base( game ) { }
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
gfx.Texturing = true;
|
||||
RenderMenuWidgets( delta );
|
||||
statusWidget.Render( delta );
|
||||
gfx.Texturing = false;
|
||||
}
|
||||
|
||||
Font keyFont;
|
||||
TextWidget statusWidget;
|
||||
static string[] keyNames;
|
||||
protected string[] leftDesc, rightDesc;
|
||||
protected KeyBind[] left, right;
|
||||
@ -29,13 +20,12 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
protected Action<Game, Widget> leftPage, rightPage;
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
if( keyNames == null )
|
||||
keyNames = Enum.GetNames( typeof( Key ) );
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
keyFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Italic );
|
||||
statusWidget = ChatTextWidget.Create( game, 0, 130, "",
|
||||
Anchor.Centre, Anchor.Centre, regularFont );
|
||||
|
||||
if( keyNames == null )
|
||||
keyNames = Enum.GetNames( typeof( Key ) );
|
||||
}
|
||||
|
||||
protected void MakeWidgets( int y ) {
|
||||
@ -44,14 +34,14 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
if( right == null ) {
|
||||
for( int i = 0; i < left.Length; i++ )
|
||||
Make( leftDesc[i], left[i], 0, ref y );
|
||||
Make( i, 0, ref y );
|
||||
} else {
|
||||
for( int i = 0; i < left.Length; i++ )
|
||||
Make( leftDesc[i], left[i], -btnWidth / 2 - 5, ref y );
|
||||
Make( i, -btnWidth / 2 - 5, ref y );
|
||||
|
||||
y = origin;
|
||||
for( int i = 0; i < right.Length; i++ )
|
||||
Make( rightDesc[i], right[i], btnWidth / 2 + 5, ref y );
|
||||
Make( i + left.Length, btnWidth / 2 + 5, ref y );
|
||||
}
|
||||
MakePages( origin );
|
||||
}
|
||||
@ -79,8 +69,8 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
if( rightPage == null ) widgets[index - 1].Disabled = true;
|
||||
}
|
||||
|
||||
void Make( string desc, KeyBind bind, int x, ref int y ) {
|
||||
string text = desc + ": " + keyNames[(int)game.Mapping( bind )];
|
||||
void Make( int i, int x, ref int y ) {
|
||||
string text = ButtonText( i );
|
||||
widgets[index++] = ButtonWidget.Create( game, x, y, btnWidth, btnHeight, text,
|
||||
Anchor.Centre, Anchor.Centre, keyFont, OnBindingClick );
|
||||
y += btnDistance;
|
||||
@ -89,24 +79,32 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
ButtonWidget curWidget;
|
||||
void OnBindingClick( Game game, Widget widget, MouseButton mouseBtn ) {
|
||||
int index = 0;
|
||||
if( mouseBtn == MouseButton.Right && (curWidget == null || curWidget == widget) ) {
|
||||
curWidget = (ButtonWidget)widget;
|
||||
int index = Array.IndexOf<Widget>( widgets, curWidget ) - 2;
|
||||
index = Array.IndexOf<Widget>( widgets, curWidget ) - 2;
|
||||
KeyBind mapping = Get( index, left, right );
|
||||
HandlesKeyDown( game.InputHandler.Keys.GetDefault( mapping ) );
|
||||
}
|
||||
if( mouseBtn != MouseButton.Left ) return;
|
||||
|
||||
if( curWidget == widget ) {
|
||||
if( curWidget != null ) {
|
||||
index = Array.IndexOf<Widget>( widgets, curWidget ) - 2;
|
||||
curWidget.SetText( ButtonText( index ) );
|
||||
curWidget = null;
|
||||
statusWidget.SetText( "" );
|
||||
} else {
|
||||
curWidget = (ButtonWidget)widget;
|
||||
int index = Array.IndexOf<Widget>( widgets, curWidget ) - 2;
|
||||
string desc = Get( index, leftDesc, rightDesc );
|
||||
string text = "&ePress new key binding for " + desc + ":";
|
||||
statusWidget.SetText( text );
|
||||
}
|
||||
|
||||
index = Array.IndexOf<Widget>( widgets, widget ) - 2;
|
||||
string text = ButtonText( index );
|
||||
curWidget = (ButtonWidget)widget;
|
||||
curWidget.SetText( "> " + text + " <" );
|
||||
}
|
||||
|
||||
string ButtonText( int i ) {
|
||||
KeyBind mapping = Get( i, left, right );
|
||||
Key key = game.InputHandler.Keys[mapping];
|
||||
string desc = Get( i, leftDesc, rightDesc );
|
||||
return desc + ": " + keyNames[(int)key];
|
||||
}
|
||||
|
||||
public override bool HandlesKeyDown( Key key ) {
|
||||
@ -115,40 +113,20 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
} else if( curWidget != null ) {
|
||||
int index = Array.IndexOf<Widget>( widgets, curWidget ) - 2;
|
||||
KeyBind mapping = Get( index, left, right );
|
||||
KeyMap map = game.InputHandler.Keys;
|
||||
Key oldKey = map[mapping];
|
||||
string reason;
|
||||
string desc = Get( index, leftDesc, rightDesc );
|
||||
|
||||
if( !map.IsKeyOkay( oldKey, key, out reason ) ) {
|
||||
const string format = "&eFailed to change \"{0}\". &c({1})";
|
||||
statusWidget.SetText( String.Format( format, desc, reason ) );
|
||||
} else {
|
||||
const string format = "&e\"{0}\" changed from &7{1} &eto &7{2}&e.";
|
||||
statusWidget.SetText( String.Format( format, desc, oldKey, key ) );
|
||||
|
||||
string text = desc + ": " + keyNames[(int)key];
|
||||
curWidget.SetText( text );
|
||||
map[mapping] = key;
|
||||
}
|
||||
game.InputHandler.Keys[mapping] = key;
|
||||
curWidget.SetText( ButtonText( index ) );
|
||||
curWidget = null;
|
||||
}
|
||||
return key < Key.F1 || key > Key.F35;
|
||||
return true;
|
||||
}
|
||||
|
||||
T Get<T>( int index, T[] a, T[] b ) {
|
||||
return index < a.Length ? a[index] : b[index - a.Length];
|
||||
}
|
||||
|
||||
public override void OnResize( int width, int height ) {
|
||||
base.OnResize( width, height );
|
||||
statusWidget.OnResize( width, height );
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
keyFont.Dispose();
|
||||
base.Dispose();
|
||||
statusWidget.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -125,7 +125,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
base.Init();
|
||||
left = new KeyBind[3];
|
||||
left[0] = KeyBind.MouseLeft; left[1] = KeyBind.MouseMiddle; left[2] = KeyBind.MouseRight;
|
||||
leftDesc = new string[] { "Left mouse", "Middle mouse", "Right mouse" };
|
||||
leftDesc = new string[] { "Left", "Middle", "Right" };
|
||||
|
||||
widgets = new Widget[left.Length + 5];
|
||||
title = "Mouse key bindings";
|
||||
|
@ -14,7 +14,6 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
protected MenuInputValidator[] validators;
|
||||
protected string[][] descriptions;
|
||||
protected TextGroupWidget extendedHelp;
|
||||
Font extendedHelpFont;
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
@ -38,9 +37,8 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
extendedHelpFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
}
|
||||
|
||||
@ -77,7 +75,6 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
public override void Dispose() {
|
||||
DisposeWidgets();
|
||||
game.Keyboard.KeyRepeat = false;
|
||||
extendedHelpFont.Dispose();
|
||||
DisposeExtendedHelp();
|
||||
base.Dispose();
|
||||
}
|
||||
@ -155,7 +152,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
int tableWidth, tableHeight;
|
||||
protected int extHelpY = 100;
|
||||
void MakeExtendedHelp( string[] desc ) {
|
||||
extendedHelp = new TextGroupWidget( game, desc.Length, extendedHelpFont, null,
|
||||
extendedHelp = new TextGroupWidget( game, desc.Length, regularFont, null,
|
||||
Anchor.Centre, Anchor.Centre );
|
||||
extendedHelp.Init();
|
||||
|
||||
|
@ -22,8 +22,8 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
|
||||
MakeNormal();
|
||||
|
@ -10,20 +10,16 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
public PauseScreen( Game game ) : base( game ) {
|
||||
}
|
||||
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
gfx.Texturing = true;
|
||||
RenderMenuWidgets( delta );
|
||||
gfx.Texturing = false;
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
base.Init();
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
game.Events.HackPermissionsChanged += CheckHacksAllowed;
|
||||
if( game.UseClassicOptions )
|
||||
|
||||
if( game.UseClassicOptions ) {
|
||||
MakeClassic();
|
||||
else
|
||||
MakeNormal();
|
||||
} else {
|
||||
MakeNormal();
|
||||
}
|
||||
|
||||
if( !game.Server.IsSinglePlayer ) {
|
||||
widgets[1].Disabled = true;
|
||||
widgets[2].Disabled = true;
|
||||
|
@ -52,7 +52,7 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
|
||||
public override void Init() {
|
||||
game.Keyboard.KeyRepeat = true;
|
||||
base.Init();
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
regularFont = new Font( game.FontName, 16, FontStyle.Regular );
|
||||
|
||||
inputWidget = MenuInputWidget.Create(
|
||||
|
@ -24,16 +24,21 @@ namespace ClassicalSharp.Gui.Screens {
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init() {
|
||||
titleFont = new Font( game.FontName, 16, FontStyle.Bold );
|
||||
}
|
||||
public override void Render( double delta ) {
|
||||
RenderMenuBounds();
|
||||
gfx.Texturing = true;
|
||||
RenderMenuWidgets( delta );
|
||||
gfx.Texturing = false;
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
for( int i = 0; i < widgets.Length; i++ ) {
|
||||
if( widgets[i] == null ) continue;
|
||||
widgets[i].Dispose();
|
||||
}
|
||||
titleFont.Dispose();
|
||||
|
||||
if( titleFont != null )
|
||||
titleFont.Dispose();
|
||||
if( regularFont != null )
|
||||
regularFont.Dispose();
|
||||
}
|
@ -56,7 +56,8 @@ namespace ClassicalSharp {
|
||||
part.U2 = part.U1 + width / (float)totalWidth;
|
||||
|
||||
curX += width;
|
||||
IGraphicsApi.Make2DQuad( ref part, FastColour.White, vertices, ref index );
|
||||
IGraphicsApi.Make2DQuad( ref part, FastColour.WhitePacked,
|
||||
vertices, ref index );
|
||||
}
|
||||
|
||||
public void AddInt( int value, VertexP3fT2fC4b[] vertices, ref int index ) {
|
||||
|
@ -70,8 +70,7 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
|
||||
public override void MoveTo( int newX, int newY ) {
|
||||
X = newX; Y = newY;
|
||||
Dispose();
|
||||
Init();
|
||||
Recreate();
|
||||
}
|
||||
|
||||
void MakeBackgroundTexture() {
|
||||
|
58
ClassicalSharp/2D/Widgets/SurvivalHudWidget.cs
Normal file
58
ClassicalSharp/2D/Widgets/SurvivalHudWidget.cs
Normal file
@ -0,0 +1,58 @@
|
||||
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
||||
using System;
|
||||
using ClassicalSharp.GraphicsAPI;
|
||||
|
||||
namespace ClassicalSharp.Gui.Widgets {
|
||||
public sealed class SurvivalHudWidget : Widget {
|
||||
|
||||
public SurvivalHudWidget( Game game ) : base( game ) {
|
||||
HorizontalAnchor = Anchor.Centre;
|
||||
VerticalAnchor = Anchor.BottomOrRight;
|
||||
}
|
||||
|
||||
// TODO: scaling
|
||||
public override void Init() {
|
||||
//float scale = 2 * game.GuiHotbarScale;
|
||||
Width = (int)(9 * 10);// * scale);
|
||||
Height = (int)9;// * scale);
|
||||
|
||||
X = game.Width / 2 - Width / 2;
|
||||
Y = game.Height - Height - 100;
|
||||
}
|
||||
|
||||
public override void Render( double delta ) {
|
||||
Model.ModelCache cache = game.ModelCache;
|
||||
int index = 0, health = game.LocalPlayer.Health;
|
||||
for( int heart = 0; heart < 10; heart++ ) {
|
||||
Texture tex = new Texture( 0, X + 16 * heart, Y - 18, 18, 18, backRec );
|
||||
IGraphicsApi.Make2DQuad( ref tex, FastColour.WhitePacked,
|
||||
cache.vertices, ref index );
|
||||
|
||||
if( health >= 2 ) {
|
||||
tex = new Texture( 0, X + 16 * heart + 2, Y - 18 + 2, 14, 14, fullRec );
|
||||
} else if( health == 1 ) {
|
||||
tex = new Texture( 0, X + 16 * heart + 2, Y - 18 + 2, 14, 14, halfRec );
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
IGraphicsApi.Make2DQuad( ref tex, FastColour.WhitePacked,
|
||||
cache.vertices, ref index );
|
||||
health -= 2;
|
||||
}
|
||||
|
||||
game.Graphics.Texturing = true;
|
||||
game.Graphics.BindTexture( game.Gui.IconsTex );
|
||||
game.Graphics.UpdateDynamicIndexedVb( DrawMode.Triangles, cache.vb, cache.vertices, index );
|
||||
game.Graphics.Texturing = false;
|
||||
}
|
||||
|
||||
static TextureRec backRec = new TextureRec( 16 / 256f, 0 / 256f, 9 / 256f, 9 / 256f );
|
||||
static TextureRec fullRec = new TextureRec( 53 / 256f, 1 / 256f, 7 / 256f, 7 / 256f );
|
||||
static TextureRec halfRec = new TextureRec( 62 / 256f, 1 / 256f, 7 / 256f, 7 / 256f );
|
||||
|
||||
public override void Dispose() { }
|
||||
|
||||
public override void MoveTo( int newX, int newY ) { X = newX; Y = newY; }
|
||||
}
|
||||
}
|
@ -88,16 +88,18 @@
|
||||
<Compile Include="2D\Drawing\IDrawer2D.cs" />
|
||||
<Compile Include="2D\Screens\ChatScreen.cs" />
|
||||
<Compile Include="2D\Screens\ClickableScreen.cs" />
|
||||
<Compile Include="2D\Screens\DeathScreen.cs" />
|
||||
<Compile Include="2D\Screens\ErrorScreen.cs" />
|
||||
<Compile Include="2D\Screens\FilesScreen.cs" />
|
||||
<Compile Include="2D\Screens\FpsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Inventory\InventoryScreen.cs" />
|
||||
<Compile Include="2D\Screens\Inventory\InventoryScreen.Input.cs" />
|
||||
<Compile Include="2D\Screens\Inventory\InventoryScreen.Scrolling.cs" />
|
||||
<Compile Include="2D\Screens\LoadingMapScreen.cs" />
|
||||
<Compile Include="2D\Screens\MenuScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\ClassicOptionsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\EditHotkeyScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\EnvSettingsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\FilesScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\GenLevelScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\GraphicsOptionsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\GuiOptionsScreen.cs" />
|
||||
@ -107,7 +109,6 @@
|
||||
<Compile Include="2D\Screens\Menu\KeyBindingsScreens.cs" />
|
||||
<Compile Include="2D\Screens\Menu\LoadLevelScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\MenuOptionsScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\MenuScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\NostalgiaScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\OptionsGroupScreen.cs" />
|
||||
<Compile Include="2D\Screens\Menu\PauseScreen.cs" />
|
||||
@ -136,6 +137,7 @@
|
||||
<Compile Include="2D\Widgets\PlayerList\ExtPlayerListWidget.cs" />
|
||||
<Compile Include="2D\Widgets\PlayerList\NormalPlayerListWidget.cs" />
|
||||
<Compile Include="2D\Widgets\PlayerList\PlayerListWidget.cs" />
|
||||
<Compile Include="2D\Widgets\SurvivalHudWidget.cs" />
|
||||
<Compile Include="2D\Widgets\TextWidget.cs" />
|
||||
<Compile Include="2D\Widgets\Widget.cs" />
|
||||
<Compile Include="Audio\AudioPlayer.cs" />
|
||||
|
@ -14,6 +14,8 @@ namespace ClassicalSharp.Entities {
|
||||
|
||||
public float SpawnYaw, SpawnPitch;
|
||||
|
||||
public short Health = 20;
|
||||
|
||||
/// <summary> The distance (in blocks) that players are allowed to
|
||||
/// reach to and interact/modify blocks in. </summary>
|
||||
public float ReachDistance = 5f;
|
||||
|
@ -6,7 +6,7 @@ namespace ClassicalSharp {
|
||||
|
||||
public enum KeyBind {
|
||||
Forward, Back, Left, Right, Jump, Respawn, SetSpawn, Chat,
|
||||
Inventory, ToggleFog, SendChat, PauseOrExit, PlayerList,
|
||||
Inventory, ToggleFog, SendChat, PauseOrExit, PlayerList,
|
||||
Speed, NoClip, Fly, FlyUp, FlyDown, ExtInput, HideFps,
|
||||
Screenshot, Fullscreen, ThirdPerson, HideGui, AxisLines,
|
||||
ZoomScrolling, HalfSpeed, MouseLeft, MouseMiddle, MouseRight,
|
||||
@ -24,25 +24,6 @@ namespace ClassicalSharp {
|
||||
}
|
||||
|
||||
Key[] keys, defaultKeys;
|
||||
bool IsReservedKey( Key key ) {
|
||||
return key == Key.Escape || key == Key.Slash || key == Key.BackSpace ||
|
||||
(key >= Key.Insert && key <= Key.End) ||
|
||||
(key >= Key.Number0 && key <= Key.Number9); // block hotbar
|
||||
}
|
||||
|
||||
public bool IsKeyOkay( Key oldKey, Key key, out string reason ) {
|
||||
if( oldKey == Key.Escape || oldKey == Key.F12 ) {
|
||||
reason = "This binding is locked";
|
||||
return false;
|
||||
}
|
||||
|
||||
if( IsReservedKey( key ) ) {
|
||||
reason = "New key is reserved";
|
||||
return false;
|
||||
}
|
||||
reason = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
public KeyMap() {
|
||||
// We can't use enum array initaliser because this causes problems when building with mono
|
||||
@ -70,7 +51,7 @@ namespace ClassicalSharp {
|
||||
for( int i = 0; i < names.Length; i++ ) {
|
||||
string key = "key-" + names[i];
|
||||
Key mapping = Options.GetEnum( key, keys[i] );
|
||||
if( !IsReservedKey( mapping ) )
|
||||
if( mapping != Key.Escape )
|
||||
keys[i] = mapping;
|
||||
}
|
||||
}
|
||||
|
@ -61,12 +61,12 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
internal int texVb;
|
||||
public virtual void Draw2DTexture( ref Texture tex, FastColour col ) {
|
||||
int index = 0;
|
||||
Make2DQuad( ref tex, col, texVerts, ref index );
|
||||
Make2DQuad( ref tex, col.Pack(), texVerts, ref index );
|
||||
SetBatchFormat( VertexFormat.P3fT2fC4b );
|
||||
UpdateDynamicIndexedVb( DrawMode.Triangles, texVb, texVerts, 4 );
|
||||
}
|
||||
|
||||
public static void Make2DQuad( ref Texture tex, FastColour col,
|
||||
public static void Make2DQuad( ref Texture tex, int col,
|
||||
VertexP3fT2fC4b[] vertices, ref int index ) {
|
||||
float x1 = tex.X, y1 = tex.Y, x2 = tex.X + tex.Width, y2 = tex.Y + tex.Height;
|
||||
#if USE_DX
|
||||
@ -75,11 +75,10 @@ namespace ClassicalSharp.GraphicsAPI {
|
||||
x1 -= 0.5f; x2 -= 0.5f;
|
||||
y1 -= 0.5f; y2 -= 0.5f;
|
||||
#endif
|
||||
int c = col.Pack();
|
||||
vertices[index++] = new VertexP3fT2fC4b( x1, y1, 0, tex.U1, tex.V1, c );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x2, y1, 0, tex.U2, tex.V1, c );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x2, y2, 0, tex.U2, tex.V2, c );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x1, y2, 0, tex.U1, tex.V2, c );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x1, y1, 0, tex.U1, tex.V1, col );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x2, y1, 0, tex.U2, tex.V1, col );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x2, y2, 0, tex.U2, tex.V2, col );
|
||||
vertices[index++] = new VertexP3fT2fC4b( x1, y2, 0, tex.U1, tex.V2, col );
|
||||
}
|
||||
|
||||
/// <summary> Updates the various matrix stacks and properties so that the graphics API state
|
||||
|
@ -50,7 +50,7 @@ namespace ClassicalSharp.Renderers {
|
||||
internal bool[] pendingTranslucent, pendingNormal;
|
||||
internal int[] totalUsed;
|
||||
internal ChunkUpdater updater;
|
||||
bool drawAllFaces = false, underWater = false;
|
||||
bool inTranslucent = false;
|
||||
|
||||
public MapRenderer( Game game ) {
|
||||
this.game = game;
|
||||
@ -110,12 +110,12 @@ namespace ClassicalSharp.Renderers {
|
||||
Vector3I coords = Vector3I.Floor( pos );
|
||||
|
||||
byte block = game.World.SafeGetBlock( coords );
|
||||
drawAllFaces = game.BlockInfo.IsTranslucent[block];
|
||||
bool outside = !game.World.IsValidPos( Vector3I.Floor( pos ) );
|
||||
underWater = drawAllFaces || (pos.Y < env.EdgeHeight && outside);
|
||||
inTranslucent = game.BlockInfo.IsTranslucent[block]
|
||||
|| (pos.Y < env.EdgeHeight && outside);
|
||||
|
||||
// If we are under water, render weather before to blend properly
|
||||
if( !underWater || env.Weather == Weather.Sunny ) return;
|
||||
if( !inTranslucent || env.Weather == Weather.Sunny ) return;
|
||||
gfx.AlphaBlending = true;
|
||||
game.WeatherRenderer.Render( deltaTime );
|
||||
gfx.AlphaBlending = false;
|
||||
@ -152,7 +152,7 @@ namespace ClassicalSharp.Renderers {
|
||||
|
||||
gfx.DepthWrite = true;
|
||||
// If we weren't under water, render weather after to blend properly
|
||||
if( !underWater && game.World.Env.Weather != Weather.Sunny ) {
|
||||
if( !inTranslucent && game.World.Env.Weather != Weather.Sunny ) {
|
||||
gfx.AlphaTest = true;
|
||||
game.WeatherRenderer.Render( deltaTime );
|
||||
gfx.AlphaTest = false;
|
||||
@ -271,12 +271,12 @@ namespace ClassicalSharp.Renderers {
|
||||
|
||||
void DrawTranslucentPart( ChunkInfo info, ref ChunkPartInfo part, int m ) {
|
||||
gfx.BindVb( part.VbId );
|
||||
bool drawLeft = (drawAllFaces || info.DrawLeft) && part.LeftCount > 0;
|
||||
bool drawRight = (drawAllFaces || info.DrawRight) && part.RightCount > 0;
|
||||
bool drawBottom = (drawAllFaces || info.DrawBottom) && part.BottomCount > 0;
|
||||
bool drawTop = (drawAllFaces || info.DrawTop) && part.TopCount > 0;
|
||||
bool drawFront = (drawAllFaces || info.DrawFront) && part.FrontCount > 0;
|
||||
bool drawBack = (drawAllFaces || info.DrawBack) && part.BackCount > 0;
|
||||
bool drawLeft = (inTranslucent || info.DrawLeft) && part.LeftCount > 0;
|
||||
bool drawRight = (inTranslucent || info.DrawRight) && part.RightCount > 0;
|
||||
bool drawBottom = (inTranslucent || info.DrawBottom) && part.BottomCount > 0;
|
||||
bool drawTop = (inTranslucent || info.DrawTop) && part.TopCount > 0;
|
||||
bool drawFront = (inTranslucent || info.DrawFront) && part.FrontCount > 0;
|
||||
bool drawBack = (inTranslucent || info.DrawBack) && part.BackCount > 0;
|
||||
|
||||
if( drawLeft && drawRight ) {
|
||||
gfx.DrawIndexedVb_TrisT2fC4b( part.LeftCount + part.RightCount, part.LeftIndex );
|
||||
|
@ -20,8 +20,8 @@ namespace ClassicalSharp.Singleplayer {
|
||||
|
||||
physics.OnRandomTick[Block.Dandelion] = HandleFlower;
|
||||
physics.OnRandomTick[Block.Rose] = HandleFlower;
|
||||
physics.OnRandomTick[Block.RedMushroom] = HandleFlower;
|
||||
physics.OnRandomTick[Block.BrownMushroom] = HandleFlower;
|
||||
physics.OnRandomTick[Block.RedMushroom] = HandleMushroom;
|
||||
physics.OnRandomTick[Block.BrownMushroom] = HandleMushroom;
|
||||
}
|
||||
|
||||
void HandleSapling( int index, byte block ) {
|
||||
@ -42,7 +42,7 @@ namespace ClassicalSharp.Singleplayer {
|
||||
void HandleGrass( int index, byte block ) {
|
||||
int x = index % map.Width;
|
||||
int y = (index / map.Width) / map.Length;
|
||||
int z = (index / map.Width) % map.Length;
|
||||
int z = (index / map.Width) % map.Length;
|
||||
if( y <= map.GetLightHeight( x, z ) )
|
||||
game.UpdateBlock( x, y, z, Block.Dirt );
|
||||
}
|
||||
@ -52,7 +52,25 @@ namespace ClassicalSharp.Singleplayer {
|
||||
int y = (index / map.Width) / map.Length;
|
||||
int z = (index / map.Width) % map.Length;
|
||||
if( y <= map.GetLightHeight( x, z ) )
|
||||
game.UpdateBlock( x, y, z, Block.Air );
|
||||
game.UpdateBlock( x, y, z, Block.Air );
|
||||
|
||||
byte below = Block.Dirt;
|
||||
if( y > 0 ) below = map.blocks[index - map.Width * map.Length];
|
||||
if( !(below == Block.Dirt || below == Block.Grass ) )
|
||||
game.UpdateBlock( x, y, z, Block.Air );
|
||||
}
|
||||
|
||||
void HandleMushroom( int index, byte block ) {
|
||||
int x = index % map.Width;
|
||||
int y = (index / map.Width) / map.Length;
|
||||
int z = (index / map.Width) % map.Length;
|
||||
if( y > map.GetLightHeight( x, z ) )
|
||||
game.UpdateBlock( x, y, z, Block.Air );
|
||||
|
||||
byte below = Block.Stone;
|
||||
if( y > 0 ) below = map.blocks[index - map.Width * map.Length];
|
||||
if( !(below == Block.Stone || below == Block.Cobblestone ) )
|
||||
game.UpdateBlock( x, y, z, Block.Air );
|
||||
}
|
||||
|
||||
// Algorithm source: Looking at the trees generated by the default classic server.
|
||||
|
@ -25,291 +25,51 @@
|
||||
//
|
||||
#endregion
|
||||
|
||||
namespace OpenTK.Input
|
||||
{
|
||||
namespace OpenTK.Input {
|
||||
/// <summary> The available keyboard keys. </summary>
|
||||
public enum Key : int
|
||||
{
|
||||
/// <summary>A key outside the known keys.</summary>
|
||||
public enum Key : int {
|
||||
// Key outside the known keys
|
||||
Unknown = 0,
|
||||
|
||||
// Modifiers
|
||||
/// <summary>The left shift key.</summary>
|
||||
ShiftLeft,
|
||||
/// <summary>The right shift key.</summary>
|
||||
ShiftRight,
|
||||
/// <summary>The left control key.</summary>
|
||||
ControlLeft,
|
||||
/// <summary>The right control key.</summary>
|
||||
ControlRight,
|
||||
/// <summary>The left alt key.</summary>
|
||||
AltLeft,
|
||||
/// <summary>The right alt key.</summary>
|
||||
AltRight,
|
||||
/// <summary>The left win key.</summary>
|
||||
WinLeft,
|
||||
/// <summary>The right win key.</summary>
|
||||
WinRight,
|
||||
/// <summary>The menu key.</summary>
|
||||
Menu,
|
||||
ShiftLeft, ShiftRight, ControlLeft, ControlRight,
|
||||
AltLeft, AltRight, WinLeft, WinRight, Menu,
|
||||
|
||||
// Function keys (hopefully enough for most keyboards - mine has 26)
|
||||
// <keysymdef.h> on X11 reports up to 35 function keys.
|
||||
/// <summary>The F1 key.</summary>
|
||||
F1,
|
||||
/// <summary>The F2 key.</summary>
|
||||
F2,
|
||||
/// <summary>The F3 key.</summary>
|
||||
F3,
|
||||
/// <summary>The F4 key.</summary>
|
||||
F4,
|
||||
/// <summary>The F5 key.</summary>
|
||||
F5,
|
||||
/// <summary>The F6 key.</summary>
|
||||
F6,
|
||||
/// <summary>The F7 key.</summary>
|
||||
F7,
|
||||
/// <summary>The F8 key.</summary>
|
||||
F8,
|
||||
/// <summary>The F9 key.</summary>
|
||||
F9,
|
||||
/// <summary>The F10 key.</summary>
|
||||
F10,
|
||||
/// <summary>The F11 key.</summary>
|
||||
F11,
|
||||
/// <summary>The F12 key.</summary>
|
||||
F12,
|
||||
/// <summary>The F13 key.</summary>
|
||||
F13,
|
||||
/// <summary>The F14 key.</summary>
|
||||
F14,
|
||||
/// <summary>The F15 key.</summary>
|
||||
F15,
|
||||
/// <summary>The F16 key.</summary>
|
||||
F16,
|
||||
/// <summary>The F17 key.</summary>
|
||||
F17,
|
||||
/// <summary>The F18 key.</summary>
|
||||
F18,
|
||||
/// <summary>The F19 key.</summary>
|
||||
F19,
|
||||
/// <summary>The F20 key.</summary>
|
||||
F20,
|
||||
/// <summary>The F21 key.</summary>
|
||||
F21,
|
||||
/// <summary>The F22 key.</summary>
|
||||
F22,
|
||||
/// <summary>The F23 key.</summary>
|
||||
F23,
|
||||
/// <summary>The F24 key.</summary>
|
||||
F24,
|
||||
/// <summary>The F25 key.</summary>
|
||||
F25,
|
||||
/// <summary>The F26 key.</summary>
|
||||
F26,
|
||||
/// <summary>The F27 key.</summary>
|
||||
F27,
|
||||
/// <summary>The F28 key.</summary>
|
||||
F28,
|
||||
/// <summary>The F29 key.</summary>
|
||||
F29,
|
||||
/// <summary>The F30 key.</summary>
|
||||
F30,
|
||||
/// <summary>The F31 key.</summary>
|
||||
F31,
|
||||
/// <summary>The F32 key.</summary>
|
||||
F32,
|
||||
/// <summary>The F33 key.</summary>
|
||||
F33,
|
||||
/// <summary>The F34 key.</summary>
|
||||
F34,
|
||||
/// <summary>The F35 key.</summary>
|
||||
F35,
|
||||
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,
|
||||
F11, F12, F13, F14, F15, F16, F17, F18, F19, F20,
|
||||
F21, F22, F23, F24, F25, F26, F27, F28, F29, F30,
|
||||
F31, F32, F33, F34, F35,
|
||||
|
||||
// Direction arrows
|
||||
/// <summary>The up arrow key.</summary>
|
||||
Up,
|
||||
/// <summary>The down arrow key.</summary>
|
||||
Down,
|
||||
/// <summary>The left arrow key.</summary>
|
||||
Left,
|
||||
/// <summary>The right arrow key.</summary>
|
||||
Right,
|
||||
Up, Down, Left, Right,
|
||||
|
||||
/// <summary>The enter key.</summary>
|
||||
Enter,
|
||||
/// <summary>The escape key.</summary>
|
||||
Escape,
|
||||
/// <summary>The space key.</summary>
|
||||
Space,
|
||||
/// <summary>The tab key.</summary>
|
||||
Tab,
|
||||
/// <summary>The backspace key.</summary>
|
||||
BackSpace,
|
||||
/// <summary>The insert key.</summary>
|
||||
Insert,
|
||||
/// <summary>The delete key.</summary>
|
||||
Delete,
|
||||
/// <summary>The page up key.</summary>
|
||||
PageUp,
|
||||
/// <summary>The page down key.</summary>
|
||||
PageDown,
|
||||
/// <summary>The home key.</summary>
|
||||
Home,
|
||||
/// <summary>The end key.</summary>
|
||||
End,
|
||||
/// <summary>The caps lock key.</summary>
|
||||
CapsLock,
|
||||
/// <summary>The scroll lock key.</summary>
|
||||
ScrollLock,
|
||||
/// <summary>The print screen key.</summary>
|
||||
PrintScreen,
|
||||
/// <summary>The pause key.</summary>
|
||||
Pause,
|
||||
/// <summary>The num lock key.</summary>
|
||||
NumLock,
|
||||
|
||||
// Special keys
|
||||
/// <summary>The clear key (Keypad5 with NumLock disabled, on typical keyboards).</summary>
|
||||
Clear,
|
||||
/// <summary>The sleep key.</summary>
|
||||
Sleep,
|
||||
// Action keys
|
||||
Enter, Escape, Space, Tab, BackSpace, Insert,
|
||||
Delete, PageUp, PageDown, Home, End, CapsLock,
|
||||
ScrollLock, PrintScreen, Pause, NumLock,
|
||||
|
||||
// Keypad keys
|
||||
/// <summary>The keypad 0 key.</summary>
|
||||
Keypad0,
|
||||
/// <summary>The keypad 1 key.</summary>
|
||||
Keypad1,
|
||||
/// <summary>The keypad 2 key.</summary>
|
||||
Keypad2,
|
||||
/// <summary>The keypad 3 key.</summary>
|
||||
Keypad3,
|
||||
/// <summary>The keypad 4 key.</summary>
|
||||
Keypad4,
|
||||
/// <summary>The keypad 5 key.</summary>
|
||||
Keypad5,
|
||||
/// <summary>The keypad 6 key.</summary>
|
||||
Keypad6,
|
||||
/// <summary>The keypad 7 key.</summary>
|
||||
Keypad7,
|
||||
/// <summary>The keypad 8 key.</summary>
|
||||
Keypad8,
|
||||
/// <summary>The keypad 9 key.</summary>
|
||||
Keypad9,
|
||||
/// <summary>The keypad divide key.</summary>
|
||||
KeypadDivide,
|
||||
/// <summary>The keypad multiply key.</summary>
|
||||
KeypadMultiply,
|
||||
/// <summary>The keypad subtract key.</summary>
|
||||
KeypadSubtract,
|
||||
/// <summary>The keypad add key.</summary>
|
||||
KeypadAdd,
|
||||
/// <summary>The keypad decimal key.</summary>
|
||||
KeypadDecimal,
|
||||
/// <summary>The keypad enter key.</summary>
|
||||
KeypadEnter,
|
||||
Keypad0, Keypad1, Keypad2, Keypad3, Keypad4,
|
||||
Keypad5, Keypad6, Keypad7, Keypad8, Keypad9,
|
||||
KeypadDivide, KeypadMultiply, KeypadSubtract,
|
||||
KeypadAdd, KeypadDecimal, KeypadEnter,
|
||||
|
||||
// Letters
|
||||
/// <summary>The A key.</summary>
|
||||
A,
|
||||
/// <summary>The B key.</summary>
|
||||
B,
|
||||
/// <summary>The C key.</summary>
|
||||
C,
|
||||
/// <summary>The D key.</summary>
|
||||
D,
|
||||
/// <summary>The E key.</summary>
|
||||
E,
|
||||
/// <summary>The F key.</summary>
|
||||
F,
|
||||
/// <summary>The G key.</summary>
|
||||
G,
|
||||
/// <summary>The H key.</summary>
|
||||
H,
|
||||
/// <summary>The I key.</summary>
|
||||
I,
|
||||
/// <summary>The J key.</summary>
|
||||
J,
|
||||
/// <summary>The K key.</summary>
|
||||
K,
|
||||
/// <summary>The L key.</summary>
|
||||
L,
|
||||
/// <summary>The M key.</summary>
|
||||
M,
|
||||
/// <summary>The N key.</summary>
|
||||
N,
|
||||
/// <summary>The O key.</summary>
|
||||
O,
|
||||
/// <summary>The P key.</summary>
|
||||
P,
|
||||
/// <summary>The Q key.</summary>
|
||||
Q,
|
||||
/// <summary>The R key.</summary>
|
||||
R,
|
||||
/// <summary>The S key.</summary>
|
||||
S,
|
||||
/// <summary>The T key.</summary>
|
||||
T,
|
||||
/// <summary>The U key.</summary>
|
||||
U,
|
||||
/// <summary>The V key.</summary>
|
||||
V,
|
||||
/// <summary>The W key.</summary>
|
||||
W,
|
||||
/// <summary>The X key.</summary>
|
||||
X,
|
||||
/// <summary>The Y key.</summary>
|
||||
Y,
|
||||
/// <summary>The Z key.</summary>
|
||||
Z,
|
||||
A, B, C, D, E, F, G, H, I, J,
|
||||
K, L, M, N, O, P, Q, R, S, T,
|
||||
U, V, W, X, Y, Z,
|
||||
|
||||
// Numbers
|
||||
/// <summary>The number 0 key.</summary>
|
||||
Number0,
|
||||
/// <summary>The number 1 key.</summary>
|
||||
Number1,
|
||||
/// <summary>The number 2 key.</summary>
|
||||
Number2,
|
||||
/// <summary>The number 3 key.</summary>
|
||||
Number3,
|
||||
/// <summary>The number 4 key.</summary>
|
||||
Number4,
|
||||
/// <summary>The number 5 key.</summary>
|
||||
Number5,
|
||||
/// <summary>The number 6 key.</summary>
|
||||
Number6,
|
||||
/// <summary>The number 7 key.</summary>
|
||||
Number7,
|
||||
/// <summary>The number 8 key.</summary>
|
||||
Number8,
|
||||
/// <summary>The number 9 key.</summary>
|
||||
Number9,
|
||||
Number0, Number1, Number2, Number3, Number4,
|
||||
Number5, Number6, Number7, Number8, Number9,
|
||||
|
||||
// Symbols
|
||||
/// <summary>The tilde key.</summary>
|
||||
Tilde,
|
||||
/// <summary>The minus key.</summary>
|
||||
Minus,
|
||||
//Equal,
|
||||
/// <summary>The plus key.</summary>
|
||||
Plus,
|
||||
/// <summary>The left bracket key.</summary>
|
||||
BracketLeft,
|
||||
/// <summary>The right bracket key.</summary>
|
||||
BracketRight,
|
||||
/// <summary>The semicolon key.</summary>
|
||||
Semicolon,
|
||||
/// <summary>The quote key.</summary>
|
||||
Quote,
|
||||
/// <summary>The comma key.</summary>
|
||||
Comma,
|
||||
/// <summary>The period key.</summary>
|
||||
Period,
|
||||
/// <summary>The slash key.</summary>
|
||||
Slash,
|
||||
/// <summary>The backslash key.</summary>
|
||||
BackSlash,
|
||||
/// <summary>Indicates the last available keyboard key.</summary>
|
||||
Tilde, Minus, Plus, BracketLeft, BracketRight,
|
||||
Semicolon, Quote, Comma, Period, Slash, BackSlash,
|
||||
|
||||
// Last available keyboard key
|
||||
LastKey
|
||||
}
|
||||
}
|
@ -69,11 +69,8 @@ namespace OpenTK.Platform.Windows {
|
||||
|
||||
AddKey(VirtualKeys.SCROLL, Key.ScrollLock);
|
||||
AddKey(VirtualKeys.SNAPSHOT, Key.PrintScreen);
|
||||
AddKey(VirtualKeys.CLEAR, Key.Clear);
|
||||
AddKey(VirtualKeys.INSERT, Key.Insert);
|
||||
|
||||
AddKey(VirtualKeys.SLEEP, Key.Sleep);
|
||||
|
||||
// Keypad
|
||||
for (int i = 0; i <= 9; i++) {
|
||||
AddKey((VirtualKeys)((int)VirtualKeys.NUMPAD0 + i), Key.Keypad0 + i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user