From 25dbedd79211413f21e1d9e37d7e76911bd755c4 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Sat, 27 Oct 2012 17:52:26 +0200 Subject: [PATCH] Key up/down handling --- ogl_editor/src/Editor.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ogl_editor/src/Editor.c b/ogl_editor/src/Editor.c index 974b778..1656b11 100644 --- a/ogl_editor/src/Editor.c +++ b/ogl_editor/src/Editor.c @@ -82,11 +82,32 @@ void Editor_update() bool Editor_keyDown(int key) { bool handled_key = true; + bool paused = RemoteConnection_isPaused(); switch (key) { - case EMGUI_ARROW_DOWN : break; - case EMGUI_ARROW_UP : break; + case EMGUI_ARROW_DOWN: + { + if (paused) + { + int row = ++s_editorData.trackViewInfo.rowPos; + RemoteConnection_sendSetRowCommand(row); + Editor_update(); + return true; + } + } + + case EMGUI_ARROW_UP: + { + if (paused) + { + int row = --s_editorData.trackViewInfo.rowPos; + RemoteConnection_sendSetRowCommand(row); + Editor_update(); + return true; + } + } + default : handled_key = false; break; } @@ -102,8 +123,7 @@ bool Editor_keyDown(int key) // TODO: Don't start playing if we are in edit mode (but space shouldn't be added in edit mode but we still // shouldn't start playing if we do - bool paused = !RemoteConnection_isPaused(); - RemoteConnection_sendPauseCommand(paused); + RemoteConnection_sendPauseCommand(!paused); return true; }