Permalink
Browse files

Added basic monospaced text editor (for testing it can temporarily be…

… opened with F9)
  • Loading branch information...
1 parent b3822ec commit 033abb28f0737bfa3a2b611764f5e90945c2b727 @henon committed Dec 23, 2011
@@ -67,7 +67,9 @@ public partial class ManicDiggerGameWindow : IMyGameWindow, ILocalPlayerPosition
[Inject]
public ITerrainTextures d_TerrainTextures;
[Inject]
- public HudChat d_HudChat;
+ public HudChat d_HudChat;
+ [Inject]
+ public HudTextEditor d_HudTextEditor;
[Inject]
public HudInventory d_HudInventory;
[Inject]
@@ -264,8 +266,12 @@ void ManicDiggerGameWindow_KeyPress(object sender, OpenTK.KeyPressEventArgs e)
}
}
}
+ }
+ if (guistate == GuiState.EditText)
+ {
+ d_HudTextEditor.HandleKeyPress(sender, e);
}
- }
+ }
float overheadcameradistance = 10;
float tppcameradistance = 3;
void Mouse_WheelChanged(object sender, OpenTK.Input.MouseWheelEventArgs e)
@@ -708,8 +714,12 @@ void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
if (ENABLE_LAG == 0) { Log("Frame rate: vsync."); }
if (ENABLE_LAG == 1) { Log("Frame rate: unlimited."); }
if (ENABLE_LAG == 2) { Log("Frame rate: lag simulation."); }
+ }
+ if (e.Key == OpenTK.Input.Key.F9)
+ {
+ guistate = GuiState.EditText;
}
- if (e.Key == GetKey(OpenTK.Input.Key.F12))
+ if (e.Key == GetKey(OpenTK.Input.Key.F12))
{
d_Screenshot.SaveScreenshot();
screenshotflash = 5;
@@ -788,7 +798,14 @@ void Keyboard_KeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
{
GuiStateBackToGame();
}
- }
+ }
+ else if (guistate == GuiState.EditText) {
+ if (e.Key == GetKey(OpenTK.Input.Key.Escape))
+ {
+ GuiStateBackToGame();
+ }
+ d_HudTextEditor.HandleKeyDown(sender, e);
+ }
else throw new Exception();
}
public int[] drawDistances = { 32, 64, 128, 256, 512 };
@@ -1179,7 +1196,8 @@ void FrameTick(FrameEventArgs e)
}
else if (guistate == GuiState.CraftingRecipes)
{
- }
+ }
+ else if (guistate == GuiState.EditText) { }
else throw new Exception();
float movespeednow = MoveSpeedNow();
Acceleration acceleration = new Acceleration();
@@ -2360,6 +2378,7 @@ enum GuiState
Inventory,
MapLoading,
CraftingRecipes,
+ EditText
}
private void DrawMouseCursor()
{
@@ -2424,6 +2443,11 @@ private void Draw2d()
{
DrawCraftingRecipes();
}
+ break;
+ case GuiState.EditText:
+ {
+ d_HudTextEditor.Render();
+ }
break;
default:
throw new Exception();
@@ -2462,8 +2486,8 @@ private void Draw2d()
d_The3d.Draw2dText(((int)lagSeconds).ToString(), Width - 100, 50 + 50 + 10, 12, Color.White);
}
d_The3d.PerspectiveMode();
- }
- public int DISCONNECTED_ICON_AFTER_SECONDS = 10;
+ }
+ public int DISCONNECTED_ICON_AFTER_SECONDS = 10;
private void DrawScreenshotFlash()
{
d_The3d.Draw2dTexture(d_The3d.WhiteTexture(), 0, 0, Width, Height, null, Color.White);
@@ -263,8 +263,8 @@ private void MakeGame()
{
UseShadowsSimple();
}
- w.d_HudChat = new ManicDigger.Gui.HudChat() { d_Draw2d = the3d, d_ViewportSize = w };
-
+ w.d_HudChat = new ManicDigger.Gui.HudChat() { d_Draw2d = the3d, d_ViewportSize = w };
+ w.d_HudTextEditor = new HudTextEditor() { d_ViewportSize = w };
var dataItems = new GameDataItemsBlocks() { d_Data = gamedata };
var inventoryController = clientgame;
var inventoryUtil = new InventoryUtil();
Oops, something went wrong.

0 comments on commit 033abb2

Please sign in to comment.