-
Notifications
You must be signed in to change notification settings - Fork 0
/
TextInput.h
39 lines (27 loc) · 876 Bytes
/
TextInput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef HOMEWORK_TEXTINPUT_H
#define HOMEWORK_TEXTINPUT_H
#include "SDL.h"
#include <string.h>
#include "Utility.h"
#include "ctype.h"
#include "SDL_ttf.h"
#include "Graphics.h"
typedef struct TextInput {
char *text;
size_t length;
size_t cursorPosition;
int cursorPosInPx;
int lastUpdate;
size_t selection;
SDL_Surface *surface;
} TextInput;
TextInput textinput_create();
void textinput_start();
bool textinput_handle_event(TextInput *textinput, SDL_Event *e);
void textinput_update_graphic(TextInput *textinput, TTF_Font *font);
SDL_Rect textinput_get_cursor_rect(TextInput *textinput, TTF_Font *font, int x, int y);
void textinput_render(TextInput *textinput, TTF_Font *font, int x, int y, SDL_Renderer *renderer);
void textinput_clear(TextInput *textinput);
void textinput_free(TextInput *textinput);
void textinput_end();
#endif //HOMEWORK_TEXTINPUT_H