... | ... |
@@ -1,18 +1,18 @@ |
1 | 1 |
/* |
2 |
- * boxui.c |
|
2 |
+ * boxui.h |
|
3 | 3 |
* |
4 |
- * Multiplatform UI library for SDL2. |
|
4 |
+ * Multiplatform UI library for SDL3. |
|
5 | 5 |
* |
6 | 6 |
* HEADER FILE |
7 | 7 |
* |
8 |
- * (c) 2023 Dario Rodriguez <antartica@box-ui.org> |
|
8 |
+ * (c) 2023-2024 Dario Rodriguez <antartica@box-ui.org> |
|
9 | 9 |
* Licensed under the terms of the GNU GPL v3. |
10 | 10 |
*/ |
11 | 11 |
|
12 | 12 |
#ifndef BOXUI_H |
13 | 13 |
#define BOXUI_H |
14 | 14 |
|
15 |
-#include "SDL.h" |
|
15 |
+#include "SDL3/SDL.h" |
|
16 | 16 |
|
17 | 17 |
typedef void boxui_t; |
18 | 18 |
|
... | ... |
@@ -25,35 +25,33 @@ typedef void boxui_t; |
25 | 25 |
#define DEBUG_FPRINTF(a) |
26 | 26 |
#endif |
27 | 27 |
|
28 |
-boxui_t *boxui_init(char *title,int defaultw, int defaulth, int flags); |
|
28 |
+boxui_t *boxui_init(SDL_Window *window, SDL_Renderer *renderer, int width, int height); |
|
29 | 29 |
void boxui_free(boxui_t *boxui); |
30 | 30 |
|
31 |
+int boxui_resize(boxui_t *boxui, int width, int height); |
|
32 |
+ |
|
31 | 33 |
int boxui_setuserptr(boxui_t *boxui, void *userptr); |
32 | 34 |
void *boxui_getuserptr(boxui_t *boxui); |
33 | 35 |
|
34 |
-int boxui_setfps(boxui_t *boxui, int fps); |
|
35 |
-int boxui_getfps(boxui_t *boxui); |
|
36 |
+int boxui_setsignal(boxui_t *boxui, int signalno, char *actionstr); |
|
37 |
+ |
|
38 |
+int boxui_event(boxui_t *boxui, SDL_Event *event); |
|
39 |
+ |
|
36 | 40 |
int boxui_tick(boxui_t *boxui); |
37 |
-int boxui_ghostrender(boxui_t *boxui); |
|
38 | 41 |
|
39 |
-int boxui_refreshevents(boxui_t *boxui); |
|
40 |
-int boxui_getevent(boxui_t *boxui, SDL_Event *event); |
|
42 |
+int boxui_haschanged(boxui_t *paramboxui); |
|
41 | 43 |
|
42 |
-int boxui_event_isquit(boxui_t *boxui, SDL_Event *event); |
|
43 |
-int boxui_event_iskeydown(boxui_t *boxui, SDL_Event *event, int *keycode); |
|
44 |
-int boxui_event_isresize(boxui_t *boxui, SDL_Event *event, int *neww, int *newh); |
|
44 |
+SDL_Texture *boxui_gettexture(boxui_t *boxui); |
|
45 | 45 |
|
46 |
-void boxui_resize(boxui_t *boxui, int neww, int newh); |
|
46 |
+char *boxui_getevent(boxui_t *boxui, char **eventdata); |
|
47 |
+char *boxui_getaction(boxui_t *boxui, char **actiondata); |
|
47 | 48 |
|
48 | 49 |
#ifndef __GNUC__ |
49 |
-int boxui_putactionstr(boxui_t *boxui, char *firstelem, ...); |
|
50 |
+int boxui_putaction(boxui_t *boxui, char *firstelem, ...); |
|
50 | 51 |
#else |
51 |
- int boxui_putactionstr(boxui_t *boxui, char *firstelem, ...) __attribute__((sentinel)); |
|
52 |
+ int boxui_putaction(boxui_t *boxui, char *firstelem, ...) __attribute__((sentinel)); |
|
52 | 53 |
#endif |
53 | 54 |
|
54 |
-char *boxui_getactionstr(boxui_t *boxui, char **secondelemtoend); |
|
55 |
- |
|
56 |
- |
|
57 | 55 |
#ifndef __GNUC__ |
58 | 56 |
char *boxui_add(boxui_t *boxui, char *filedebug, int linedebug, char *classwiname, char *format, ...); |
59 | 57 |
char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...); |
... | ... |
@@ -62,12 +60,35 @@ char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, |
62 | 60 |
char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6))); |
63 | 61 |
#endif |
64 | 62 |
|
63 |
+int boxuiutil_datacmp(char *datastr,char *key,char *value); |
|
64 |
+ |
|
65 | 65 |
#ifndef __GNUC__ |
66 |
-char *boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...); |
|
66 |
+int boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...); |
|
67 | 67 |
#else |
68 |
- char *boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6))); |
|
68 |
+ int boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6))); |
|
69 | 69 |
#endif |
70 | 70 |
|
71 |
+#if 0 //if0 |
|
72 |
+int boxui_setfps(boxui_t *boxui, int fps); |
|
73 |
+int boxui_getfps(boxui_t *boxui); |
|
74 |
+int boxui_tick(boxui_t *boxui); |
|
75 |
+int boxui_ghostrender(boxui_t *boxui); |
|
76 |
+ |
|
77 |
+int boxui_refreshevents(boxui_t *boxui); |
|
78 |
+int boxui_getevent(boxui_t *boxui, SDL_Event *event); |
|
79 |
+ |
|
80 |
+int boxui_event_isquit(boxui_t *boxui, SDL_Event *event); |
|
81 |
+int boxui_event_iskeydown(boxui_t *boxui, SDL_Event *event, int *keycode); |
|
82 |
+int boxui_event_isresize(boxui_t *boxui, SDL_Event *event, int *neww, int *newh); |
|
83 |
+ |
|
84 |
+void boxui_resize(boxui_t *boxui, int neww, int newh); |
|
85 |
+ |
|
86 |
+char *boxui_getactionstr(boxui_t *boxui, char **secondelemtoend); |
|
87 |
+ |
|
88 |
+ |
|
89 |
+ |
|
90 |
+#endif //if0 |
|
91 |
+ |
|
71 | 92 |
|
72 | 93 |
|
73 | 94 |
#endif |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,75 @@ |
1 |
+/* |
|
2 |
+ * boxui.c |
|
3 |
+ * |
|
4 |
+ * Multiplatform UI library for SDL2. |
|
5 |
+ * |
|
6 |
+ * HEADER FILE |
|
7 |
+ * |
|
8 |
+ * (c) 2023 Dario Rodriguez <antartica@box-ui.org> |
|
9 |
+ * Licensed under the terms of the GNU GPL v3. |
|
10 |
+ */ |
|
11 |
+ |
|
12 |
+#ifndef BOXUI_H |
|
13 |
+#define BOXUI_H |
|
14 |
+ |
|
15 |
+#include "SDL.h" |
|
16 |
+ |
|
17 |
+typedef void boxui_t; |
|
18 |
+ |
|
19 |
+#define _F __FILE__ |
|
20 |
+#define _L __LINE__ |
|
21 |
+ |
|
22 |
+#if defined(DEBUG) && defined(LINUX) |
|
23 |
+#define DEBUG_FPRINTF(a) fprintf a |
|
24 |
+#else |
|
25 |
+#define DEBUG_FPRINTF(a) |
|
26 |
+#endif |
|
27 |
+ |
|
28 |
+boxui_t *boxui_init(char *title,int defaultw, int defaulth, int flags); |
|
29 |
+void boxui_free(boxui_t *boxui); |
|
30 |
+ |
|
31 |
+int boxui_setuserptr(boxui_t *boxui, void *userptr); |
|
32 |
+void *boxui_getuserptr(boxui_t *boxui); |
|
33 |
+ |
|
34 |
+int boxui_setfps(boxui_t *boxui, int fps); |
|
35 |
+int boxui_getfps(boxui_t *boxui); |
|
36 |
+int boxui_tick(boxui_t *boxui); |
|
37 |
+int boxui_ghostrender(boxui_t *boxui); |
|
38 |
+ |
|
39 |
+int boxui_refreshevents(boxui_t *boxui); |
|
40 |
+int boxui_getevent(boxui_t *boxui, SDL_Event *event); |
|
41 |
+ |
|
42 |
+int boxui_event_isquit(boxui_t *boxui, SDL_Event *event); |
|
43 |
+int boxui_event_iskeydown(boxui_t *boxui, SDL_Event *event, int *keycode); |
|
44 |
+int boxui_event_isresize(boxui_t *boxui, SDL_Event *event, int *neww, int *newh); |
|
45 |
+ |
|
46 |
+void boxui_resize(boxui_t *boxui, int neww, int newh); |
|
47 |
+ |
|
48 |
+#ifndef __GNUC__ |
|
49 |
+int boxui_putactionstr(boxui_t *boxui, char *firstelem, ...); |
|
50 |
+#else |
|
51 |
+ int boxui_putactionstr(boxui_t *boxui, char *firstelem, ...) __attribute__((sentinel)); |
|
52 |
+#endif |
|
53 |
+ |
|
54 |
+char *boxui_getactionstr(boxui_t *boxui, char **secondelemtoend); |
|
55 |
+ |
|
56 |
+ |
|
57 |
+#ifndef __GNUC__ |
|
58 |
+char *boxui_add(boxui_t *boxui, char *filedebug, int linedebug, char *classwiname, char *format, ...); |
|
59 |
+char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...); |
|
60 |
+#else |
|
61 |
+ char *boxui_add(boxui_t *boxui, char *filedebug, int linedebug, char *classwiname, char *format, ...) __attribute__((format(printf,5,6))); |
|
62 |
+ char *boxui_config(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6))); |
|
63 |
+#endif |
|
64 |
+ |
|
65 |
+#ifndef __GNUC__ |
|
66 |
+char *boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...); |
|
67 |
+#else |
|
68 |
+ char *boxui_pack(boxui_t *boxui, char *filedebug, int linedebug, char *winame, char *format, ...) __attribute__((format(printf,5,6))); |
|
69 |
+#endif |
|
70 |
+ |
|
71 |
+ |
|
72 |
+ |
|
73 |
+#endif |
|
74 |
+ |
|
75 |
+ |