Key-Listener ist initialisiert. Fokus liegt aber noch auf Chat
This commit is contained in:
@@ -30,6 +30,8 @@ namespace WorldOfPeacecraft
|
||||
base.OnLayout (levent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnChatMessageSent (string message)
|
||||
{
|
||||
if (message.StartsWith ("/")) {
|
||||
|
||||
@@ -16,6 +16,12 @@ namespace WorldOfPeacecraft
|
||||
|
||||
void SendCommand (string command);
|
||||
|
||||
void moveUp();
|
||||
|
||||
void moveDown();
|
||||
void moveLeft();
|
||||
void moveRight();
|
||||
|
||||
void StartThreads();
|
||||
|
||||
void Stop();
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace WorldOfPeacecraft
|
||||
{
|
||||
Backend = backend;
|
||||
this.Paint += DoPaint;
|
||||
this.PreviewKeyDown += board_KeyPress;
|
||||
}
|
||||
|
||||
protected override void OnLayout (LayoutEventArgs levent)
|
||||
@@ -27,6 +28,26 @@ namespace WorldOfPeacecraft
|
||||
base.OnLayout (levent);
|
||||
}
|
||||
|
||||
private void board_KeyPress(object sender, PreviewKeyDownEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.A:
|
||||
this.Backend.moveLeft();
|
||||
break;
|
||||
case Keys.D:
|
||||
this.Backend.moveRight();
|
||||
break;
|
||||
case Keys.W:
|
||||
this.Backend.moveUp();
|
||||
break;
|
||||
case Keys.S:
|
||||
this.Backend.moveDown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void DoPaint (object source, PaintEventArgs args)
|
||||
{
|
||||
BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate (this.CreateGraphics (), this.DisplayRectangle);
|
||||
|
||||
Reference in New Issue
Block a user