From 69511102de9b0f3ec6ad555baf2a01d9ee1c3dfd Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 13 Jun 2009 08:22:37 +0000 Subject: improved the font system even futher. utf8 is now used everywhere. it uses less memory as well --- src/game/editor/ed_editor.cpp | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'src/game/editor/ed_editor.cpp') diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index 7a8a1ae7..d56a0506 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -18,6 +18,7 @@ extern "C" { #include #include "ed_editor.hpp" +#include static int checker_texture = 0; static int background_texture = 0; @@ -209,44 +210,7 @@ int ui_do_edit_box(void *id, const RECT *rect, char *str, int str_size, float fo for(int i = 0; i < inp_num_events(); i++) { len = strlen(str); - - INPUT_EVENT e = inp_get_event(i); - char c = e.ch; - int k = e.key; - - if (at_index > len) - at_index = len; - - if (!(c >= 0 && c < 32) && c != 127) - { - if (len < str_size - 1 && at_index < str_size - 1) - { - memmove(str + at_index + 1, str + at_index, len - at_index + 1); - str[at_index] = c; - at_index++; - } - } - - if(e.flags&INPFLAG_PRESS) - { - if (k == KEY_BACKSPACE && at_index > 0) - { - memmove(str + at_index - 1, str + at_index, len - at_index + 1); - at_index--; - } - else if (k == KEY_DELETE && at_index < len) - memmove(str + at_index, str + at_index + 1, len - at_index); - else if (k == KEY_RETURN) - ui_clear_last_active_item(); - else if (k == KEY_LEFT && at_index > 0) - at_index--; - else if (k == KEY_RIGHT && at_index < len) - at_index++; - else if (k == KEY_HOME) - at_index = 0; - else if (k == KEY_END) - at_index = len; - } + LINEINPUT::manipulate(inp_get_event(i), str, str_size, &len, &at_index); } r = 1; -- cgit 1.4.1