2008-08-30 08:01:29 +00:00
|
|
|
#ifndef GAME_CLIENT_LINEINPUT_H
|
|
|
|
#define GAME_CLIENT_LINEINPUT_H
|
2008-08-27 15:48:50 +00:00
|
|
|
|
|
|
|
// line input helter
|
|
|
|
class LINEINPUT
|
|
|
|
{
|
|
|
|
char str[256];
|
2009-06-13 08:22:37 +00:00
|
|
|
int len;
|
|
|
|
int cursor_pos;
|
2008-08-27 15:48:50 +00:00
|
|
|
public:
|
2009-06-13 08:22:37 +00:00
|
|
|
static void manipulate(INPUT_EVENT e, char *str, int str_max_size, int *str_len, int *cursor_pos);
|
|
|
|
|
2008-08-27 15:48:50 +00:00
|
|
|
class CALLBACK
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~CALLBACK() {}
|
|
|
|
virtual bool event(INPUT_EVENT e) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
LINEINPUT();
|
|
|
|
void clear();
|
|
|
|
void process_input(INPUT_EVENT e);
|
|
|
|
void set(const char *string);
|
|
|
|
const char *get_string() const { return str; }
|
|
|
|
int get_length() const { return len; }
|
|
|
|
unsigned cursor_offset() const { return cursor_pos; }
|
|
|
|
};
|
2008-08-30 08:01:29 +00:00
|
|
|
|
|
|
|
#endif
|