From 9e355122a5d6f618ebf971a36db9439f23111603 Mon Sep 17 00:00:00 2001 From: Daniel Collin Date: Mon, 7 Jan 2013 17:47:38 +0100 Subject: [PATCH] Limit edit boxes input till numbers only (fine as this is for Rocket only but shouldn't be in regular emgui (needs flag)) --- ogl_editor/emgui/src/Emgui.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ogl_editor/emgui/src/Emgui.c b/ogl_editor/emgui/src/Emgui.c index c8d64a5..c21c947 100644 --- a/ogl_editor/emgui/src/Emgui.c +++ b/ogl_editor/emgui/src/Emgui.c @@ -1024,9 +1024,15 @@ void Emgui_editBoxXY(int x, int y, int width, int height, int bufferLength, char default : { + // Rocket hack: + // Currenty for rocket we only need 0-9 as input (for the edit field + // so we only update here if those are the keys int offset = emini(bufferLength - 2, len); - buffer[offset + 0] = (char)keyCode; - buffer[offset + 1] = 0; + if (keyCode >= '0' && keyCode <= '9') + { + buffer[offset + 0] = (char)keyCode; + buffer[offset + 1] = 0; + } break; } }