paint: cleanup
This commit is contained in:
@@ -1271,10 +1271,6 @@ void minic_register_builtins() {
|
||||
minic_struct_set_size("cached_shader_context_t", (int)sizeof(cached_shader_context_t));
|
||||
minic_struct_field_set_type("cached_shader_context_t", "context", "shader_context_t");
|
||||
|
||||
// types.h array types
|
||||
minic_register_struct_native("string_t_array_t", array_fields, array_offsets, array_types, array_ptr_derefs, 3);
|
||||
minic_struct_set_size("string_t_array_t", (int)sizeof(string_t_array_t));
|
||||
|
||||
// config_t (16 of 62 fields; most script-relevant)
|
||||
static const char *config_fields[] = {"window_w", "window_h", "window_scale", "rp_supersample", "recent_projects", "plugins",
|
||||
"keymap", "theme", "undo_steps", "camera_fov", "layer_res", "brush_live",
|
||||
@@ -1294,8 +1290,8 @@ void minic_register_builtins() {
|
||||
MINIC_T_INT, MINIC_T_INT, MINIC_T_INT, MINIC_T_INT};
|
||||
minic_register_struct_native("config_t", config_fields, config_offsets, config_types, config_deref_types, 16);
|
||||
minic_struct_set_size("config_t", (int)sizeof(config_t));
|
||||
minic_struct_field_set_type("config_t", "recent_projects", "string_t_array_t");
|
||||
minic_struct_field_set_type("config_t", "plugins", "string_t_array_t");
|
||||
minic_struct_field_set_type("config_t", "recent_projects", "string_array_t");
|
||||
minic_struct_field_set_type("config_t", "plugins", "string_array_t");
|
||||
|
||||
// context_t (16 of many fields; most script-relevant)
|
||||
static const char *ctx_fields[] = {"paint_object", "ddirty", "pdirty", "rdirty", "material", "layer",
|
||||
@@ -1337,11 +1333,11 @@ void minic_register_builtins() {
|
||||
MINIC_T_PTR, MINIC_T_PTR, MINIC_T_PTR, MINIC_T_PTR};
|
||||
minic_register_struct_native("project_format_t", pf_fields, pf_offsets, pf_types, pf_deref_types, 16);
|
||||
minic_struct_set_size("project_format_t", (int)sizeof(project_format_t));
|
||||
minic_struct_field_set_type("project_format_t", "assets", "string_t_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "assets", "string_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "camera_world", "f32_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "camera_origin", "f32_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "font_assets", "string_t_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "script_datas", "string_t_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "font_assets", "string_array_t");
|
||||
minic_struct_field_set_type("project_format_t", "script_datas", "string_array_t");
|
||||
|
||||
// iron_math
|
||||
R(iron_random_init, "v(i)");
|
||||
|
||||
+6
-12
@@ -5,7 +5,7 @@ typedef struct storage {
|
||||
char *file;
|
||||
char *text;
|
||||
bool modified;
|
||||
struct string_t_array *expanded;
|
||||
struct string_array *expanded;
|
||||
i32 window_w;
|
||||
i32 window_h;
|
||||
i32 window_x;
|
||||
@@ -23,12 +23,6 @@ typedef struct ui_coloring_t_array {
|
||||
int capacity;
|
||||
} ui_coloring_t_array_t;
|
||||
|
||||
typedef struct string_t_array {
|
||||
char **buffer;
|
||||
int length;
|
||||
int capacity;
|
||||
} string_t_array_t;
|
||||
|
||||
extern any_map_t *ui_children;
|
||||
|
||||
ui_t *ui_create(ui_options_t *ops);
|
||||
@@ -196,7 +190,7 @@ char *armpack_to_string(buffer_t *bytes) {
|
||||
}
|
||||
|
||||
void list_folder(char *path) {
|
||||
string_t_array_t *files = file_read_directory(path);
|
||||
string_array_t *files = file_read_directory(path);
|
||||
for (i32 i = 0; i < files->length; ++i) {
|
||||
char *f = files->buffer[i];
|
||||
char *abs = string("%s/%s", path, f);
|
||||
@@ -268,7 +262,7 @@ void render(void *_) {
|
||||
if (ui_window(editor_handle, storage->sidebar_w + 1, 0, iron_window_width() - storage->sidebar_w - minimap_w, iron_window_height(), false)) {
|
||||
ui_handle_t *htab = ui_handle("main.ts:204");
|
||||
char *file_name = substring(storage->file, string_last_index_of(storage->file, "/") + 1, string_length(storage->file));
|
||||
string_t_array_t *file_names = any_array_create_from_raw(
|
||||
string_array_t *file_names = any_array_create_from_raw(
|
||||
(void *[]){
|
||||
file_name,
|
||||
},
|
||||
@@ -340,7 +334,7 @@ void render(void *_) {
|
||||
|
||||
void save_file() {
|
||||
// Trim
|
||||
string_t_array_t *lines = string_split(storage->text, "\n");
|
||||
string_array_t *lines = string_split(storage->text, "\n");
|
||||
for (i32 i = 0; i < lines->length; ++i) {
|
||||
lines->buffer[i] = trim_end(lines->buffer[i]);
|
||||
}
|
||||
@@ -384,7 +378,7 @@ void draw_minimap() {
|
||||
}
|
||||
draw_begin(minimap, true, theme->SEPARATOR_COL);
|
||||
draw_set_color(0xff333333);
|
||||
string_t_array_t *lines = string_split(storage->text, "\n");
|
||||
string_array_t *lines = string_split(storage->text, "\n");
|
||||
i32 minimap_full_h = lines->length * 2;
|
||||
f32 scroll_progress = -editor_handle->scroll_offset / (float)(lines->length * UI_ELEMENT_H());
|
||||
i32 out_of_screen = minimap_full_h - minimap_h;
|
||||
@@ -397,7 +391,7 @@ void draw_minimap() {
|
||||
// Out of screen
|
||||
break;
|
||||
}
|
||||
string_t_array_t *words = string_split(lines->buffer[i + offset], " ");
|
||||
string_array_t *words = string_split(lines->buffer[i + offset], " ");
|
||||
i32 x = 0;
|
||||
for (i32 j = 0; j < words->length; ++j) {
|
||||
char *word = words->buffer[j];
|
||||
|
||||
Reference in New Issue
Block a user