|
@@ -12,6 +12,8 @@
|
|
|
|
|
|
|
|
#include "buffer.h"
|
|
#include "buffer.h"
|
|
|
|
|
|
|
|
|
|
+#define BUF_NAME_LST "<Buffer_List>"
|
|
|
|
|
+
|
|
|
DA_DEF_STRUCT(struct buffer, app_buffers);
|
|
DA_DEF_STRUCT(struct buffer, app_buffers);
|
|
|
|
|
|
|
|
enum keybind_dir {
|
|
enum keybind_dir {
|
|
@@ -83,6 +85,8 @@ struct vec2i app_calc_cursor(struct app app);
|
|
|
|
|
|
|
|
struct ret_app_vec2 app_calc_buffer_cam(struct app app, double dt);
|
|
struct ret_app_vec2 app_calc_buffer_cam(struct app app, double dt);
|
|
|
|
|
|
|
|
|
|
+struct buffer *app_create_buffer_list(struct app *app);
|
|
|
|
|
+
|
|
|
void app_add_global_keybind(struct app *app, const char *keybind,
|
|
void app_add_global_keybind(struct app *app, const char *keybind,
|
|
|
keybind_func func, enum keybind_dir dir);
|
|
keybind_func func, enum keybind_dir dir);
|
|
|
|
|
|
|
@@ -254,6 +258,34 @@ app_calc_buffer_cam(struct app app, double dt)
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+struct buffer *
|
|
|
|
|
+app_create_buffer_list(struct app *app)
|
|
|
|
|
+{
|
|
|
|
|
+ struct buffer *buf = NULL;
|
|
|
|
|
+ for ( size_t i = 0; i < app->bufs.size; ++i ) {
|
|
|
|
|
+ if ( str_eq_cstr_ns(app->bufs.items[i].name, BUF_NAME_LST) ) {
|
|
|
|
|
+ buf = &app->bufs.items[i];
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if ( buf == NULL ) {
|
|
|
|
|
+ DA_APPEND(app->bufs, buffer_create());
|
|
|
|
|
+ buf = &DA_TAIL(app->bufs);
|
|
|
|
|
+ }
|
|
|
|
|
+ buf->name = str_from_cstr_ns(BUF_NAME_LST);
|
|
|
|
|
+
|
|
|
|
|
+ for ( size_t i = 0; i < app->bufs.size; ++i ) {
|
|
|
|
|
+ if ( str_eq_cstr_ns(app->bufs.items[i].name, BUF_NAME_LST) ) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ buffer_insert_str_as_line(buf, app->bufs.items[i].name);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return buf;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static SDL_KeyCode
|
|
static SDL_KeyCode
|
|
|
char_to_keycode(char c)
|
|
char_to_keycode(char c)
|
|
|
{
|
|
{
|