# HG changeset patch # User June Park # Date 1768237951 28800 # Node ID 3bb45eb679067ffa122c2276969c1d6c5b8508f0 # Parent bdcc610eeed8a40a38b2c3ed510a7b833f1982d4 [Postdog] Updated variables names and padding sizes. Needs more work. diff -r bdcc610eeed8 -r 3bb45eb67906 postdog/main.c --- a/postdog/main.c Mon Jan 12 09:11:58 2026 -0800 +++ b/postdog/main.c Mon Jan 12 09:12:31 2026 -0800 @@ -74,12 +74,13 @@ // Global UI state char *url_input_text = NULL; -char *url_result_text = NULL; -char **url_body_map = NULL; +char *result_text = NULL; +char **input_body_array = NULL; int active_method_dropdown = 0; int active_input_tab = 0; Seobeo_WebSocket *ws = NULL; boolean WS_BREAK = FALSE; +Color TEXT_COLOR = BLACK; int CompareHistoryItemsByDate(const void *a, const void *b) { HistoryItem *itemA = (HistoryItem *)a; @@ -248,11 +249,11 @@ title, url_input_text, method, - url_body_map[TAB_HEADER], - url_body_map[TAB_BODY], - url_body_map[TAB_GET_PARAMS], - url_body_map[TAB_WEBSOCKET], - url_result_text + input_body_array[TAB_HEADER], + input_body_array[TAB_BODY], + input_body_array[TAB_GET_PARAMS], + input_body_array[TAB_WEBSOCKET], + result_text ); char *filename = Dowa_Arena_Allocate(arena, 1024); if (!filename) @@ -287,7 +288,7 @@ ws = Seobeo_WebSocket_Connect(url_input_text); printf("URL %s\n", url_input_text); - if (Seobeo_WebSocket_Send_Text(ws, url_body_map[active_input_tab]) < 0) + if (Seobeo_WebSocket_Send_Text(ws, input_body_array[active_input_tab]) < 0) printf("Failed to send message\n"); printf("Receiving responses...\n"); @@ -302,7 +303,7 @@ if (p_msg->opcode == SEOBEO_WS_OPCODE_TEXT) { printf("Response %d: %.*s\n", received + 1, (int)p_msg->length, (char*)p_msg->data); - snprintf(url_result_text + strlen(url_result_text), RESULT_BUFFER_LENGTH - strlen(url_result_text), + snprintf(result_text + strlen(result_text), RESULT_BUFFER_LENGTH - strlen(result_text), "\n%s", (char*)p_msg->data); received++; } @@ -362,9 +363,9 @@ } { - if (url_body_map[TAB_HEADER] && strlen(url_body_map[TAB_HEADER]) > 0) + if (input_body_array[TAB_HEADER] && strlen(input_body_array[TAB_HEADER]) > 0) { - char *headersCopy = strdup(url_body_map[TAB_HEADER]); + char *headersCopy = strdup(input_body_array[TAB_HEADER]); char *line = strtok(headersCopy, "\n"); while (line != NULL) { @@ -379,9 +380,9 @@ res = Seobeo_Client_Request_Execute(req); if (res == NULL) - snprintf(url_result_text, RESULT_BUFFER_LENGTH, "Error: Failed to send the request\n"); + snprintf(result_text, RESULT_BUFFER_LENGTH, "Error: Failed to send the request\n"); else - snprintf(url_result_text, RESULT_BUFFER_LENGTH, "HTTP Status: %d\n\n%s", + snprintf(result_text, RESULT_BUFFER_LENGTH, "HTTP Status: %d\n\n%s", res->status_code, res->body ? res->body : ""); } Seobeo_Client_Request_Destroy(req); @@ -397,14 +398,14 @@ if (question_mark) *question_mark = '\0'; - int get_params_length = (int)strlen(url_body_map[TAB_GET_PARAMS]); + int get_params_length = (int)strlen(input_body_array[TAB_GET_PARAMS]); if (get_params_length == 0) return; char *separator = "?"; Dowa_Arena *arena = Dowa_Arena_Create(1024*1024); - char **lines = Dowa_String_Split(url_body_map[TAB_GET_PARAMS], "\n", get_params_length, 1, arena); + char **lines = Dowa_String_Split(input_body_array[TAB_GET_PARAMS], "\n", get_params_length, 1, arena); for (int i = 0; i < Dowa_Array_Length(lines); i++) { char *line = lines[i]; @@ -445,10 +446,10 @@ void PostDog_Params_Reset(void) { url_input_text[0] = '\0'; - url_result_text[0] = '\0'; + result_text[0] = '\0'; active_method_dropdown = 0; - for (int i = 0; i < Dowa_Array_Length(url_body_map); i++) - url_body_map[i][0] = '\0'; + for (int i = 0; i < Dowa_Array_Length(input_body_array); i++) + input_body_array[i][0] = '\0'; } void PostDog_Load_File(const char *filename) @@ -490,16 +491,16 @@ case 3: // Headers (TAB_HEADER) case 4: // Body (TAB_BODY) case 5: // Get Params (TAB_GET_PARAMS) - case 6: // Bar (TAB_WEBSOCKET) + case 6: // Websocket (TAB_WEBSOCKET) { int map_index = i - 3; // 3->0, 4->1, 5->2, 6->3 - snprintf(url_body_map[map_index], strlen(values[i]) + 1, "%s", values[i]); + snprintf(input_body_array[map_index], strlen(values[i]) + 1, "%s", values[i]); // Trim trailing newlines for (int j = strlen(values[i]); j > 0; j--) { - if (url_body_map[map_index][j] == '\n') + if (input_body_array[map_index][j] == '\n') { - url_body_map[map_index][j] = '\0'; + input_body_array[map_index][j] = '\0'; break; } } @@ -507,7 +508,7 @@ } default: // Response (index 7+) - snprintf(url_result_text, strlen(values[i]) + 1, "%s", values[i]); + snprintf(result_text, strlen(values[i]) + 1, "%s", values[i]); break; } } @@ -526,6 +527,18 @@ }; } +Rectangle AddPaddingAll(Rectangle rect, float top, float right,float down, float left) +{ + return (Rectangle){ + rect.x + left, + rect.y + top, + rect.width - (right + left), + rect.height - (top + down), + }; +} + + + Rectangle AddPaddingHorizontal(Rectangle rect, float padding) { return (Rectangle){ @@ -614,49 +627,48 @@ UnloadImage(logo_original); // -- Starting pos ---// - Rectangle history_sidebar = { 0 }; + Rectangle history_sidebar_rect = { 0 }; Dowa_Array_Reserve(history_items, 10); Dowa_Array_Reserve(new_history_items, 10); PostDog_History_Load(&history_items); int32 *history_deleted_items = NULL; - Rectangle url_area = { 0 }; - Rectangle textBounds = { 0 }; - Rectangle url_input_bounds = { 0 }; + Rectangle url_area_rect = { 0 }; + Rectangle url_input_bounds_rect = { 0 }; bool url_input_edit = false; - Rectangle url_text_bounds = { 0 }; - Rectangle url_enter_button = { 0 }; - Rectangle method_dropdown = { 0 }; + Rectangle url_text_bounds_rect = { 0 }; + Rectangle url_enter_button_rect = { 0 }; + Rectangle method_dropdown_rect = { 0 }; // Initialize global UI state url_input_text = (char *)malloc(sizeof(char) * URL_TEXT_BUFFER_LENGTH); snprintf(url_input_text, URL_TEXT_BUFFER_LENGTH, "wss://mrjunejune.com/echo"); - Dowa_Array_Push(url_body_map, (char *)malloc(sizeof(char) * HEADER_BUFFER_LENGTH)); - Dowa_Array_Push(url_body_map, (char *)malloc(sizeof(char) * BODY_BUFFER_LENGTH)); - Dowa_Array_Push(url_body_map, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH)); - Dowa_Array_Push(url_body_map, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH)); + Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * HEADER_BUFFER_LENGTH)); + Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * BODY_BUFFER_LENGTH)); + Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH)); + Dowa_Array_Push(input_body_array, (char *)malloc(sizeof(char) * DEFAULT_TEXT_BUFFER_LENGTH)); - snprintf(url_body_map[TAB_HEADER], HEADER_BUFFER_LENGTH, "Content-Type: application/json"); - snprintf(url_body_map[TAB_BODY], HEADER_BUFFER_LENGTH, ""); + snprintf(input_body_array[TAB_HEADER], HEADER_BUFFER_LENGTH, "Content-Type: application/json"); + snprintf(input_body_array[TAB_BODY], HEADER_BUFFER_LENGTH, ""); - url_result_text = (char *)malloc(sizeof(char) * RESULT_BUFFER_LENGTH); + result_text = (char *)malloc(sizeof(char) * RESULT_BUFFER_LENGTH); bool method_edit = false; int sendRequest; // -- input --// - Rectangle input_area = { 0 }; - Rectangle input_tab = { 0 }; - Rectangle input_tab_item = { 0 }; - Rectangle input_body = { 0 }; + Rectangle input_area_rect = { 0 }; + Rectangle input_tab_rect = { 0 }; + Rectangle input_tab_item_rect = { 0 }; + Rectangle input_body_rect = { 0 }; bool input_body_bool = false; // -- result --// - Rectangle result_area = { 0 }; - Rectangle result_body = { 0 }; + Rectangle result_area_rect = { 0 }; + Rectangle result_body_rect = { 0 }; // General styling. float padding = 10; // TODO make it % based? @@ -678,26 +690,27 @@ if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyDown(KEY_MINUS)) GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetStyle(DEFAULT, TEXT_SIZE) - 1); - Rectangle screen = { 0, 0, screen_width, screen_height }; + Rectangle screen_rect = { 0, 0, screen_width, screen_height }; // -- Side bar --// - history_sidebar = LeftColumn(screen, 0.15, padding); - Rectangle content_area = RightColumn(screen, history_sidebar, padding); - Rectangle logo_area = (Rectangle){ - .x = history_sidebar.x, - .y = history_sidebar.y, - .width = history_sidebar.width, + history_sidebar_rect = LeftColumn(screen_rect, 0.15, padding); + Rectangle content_area_rect = RightColumn(screen_rect, history_sidebar_rect, padding); + Rectangle logo_area_rect = (Rectangle){ + .x = history_sidebar_rect.x, + .y = history_sidebar_rect.y, + .width = history_sidebar_rect.width, .height = 80 }; - Rectangle history_list_area = Below(logo_area, padding); - history_list_area.width = history_sidebar.width; - history_list_area.height = history_sidebar.height - logo_area.height - padding; + Rectangle history_list_area_rect = Below(logo_area_rect, padding); + history_list_area_rect.x += padding; + history_list_area_rect.width = history_sidebar_rect.width - (2 * padding); + history_list_area_rect.height = history_sidebar_rect.height - logo_area_rect.height - padding; int32 new_history_items_length = Dowa_Array_Length(new_history_items); int32 history_item_length = Dowa_Array_Length(history_items); int32 total = new_history_items_length + history_item_length; - float item_height = history_list_area.height * 0.10; + float item_height = history_list_area_rect.height * 0.10; int32 number_of_skipped_items = 0; for (int i = 0; i < total; i++) @@ -712,70 +725,70 @@ } curr_history_items->rect = (Rectangle){ - .x = history_list_area.x, - .y = history_list_area.y + (padding + item_height) * (i - number_of_skipped_items) + history_scroll_offset, - .width = history_list_area.width, + .x = history_list_area_rect.x, + .y = history_list_area_rect.y + (padding + item_height) * (i - number_of_skipped_items) + history_scroll_offset, + .width = history_list_area_rect.width, .height = item_height }; } // --- URL --- // - url_area = (Rectangle){ - .x = content_area.x, - .y = content_area.y, - .width = content_area.width, - .height = content_area.height * 0.1 + url_area_rect = (Rectangle){ + .x = content_area_rect.x, + .y = content_area_rect.y, + .width = content_area_rect.width, + .height = content_area_rect.height * 0.1 }; - float url_control_y = url_area.y + (url_area.height - TEXT_SIZE * 2) / 2; + float url_control_y = url_area_rect.y + (url_area_rect.height - TEXT_SIZE * 2) / 2; - url_text_bounds = (Rectangle){ - .x = url_area.x + padding, + url_text_bounds_rect = (Rectangle){ + .x = url_area_rect.x + padding, .y = url_control_y, .width = 7 * (TEXT_SIZE / 2), .height = TEXT_SIZE * 2 }; - url_input_bounds = RightOf(url_text_bounds, padding); - url_input_bounds.width = url_area.width * 0.7; - url_input_bounds.height = TEXT_SIZE * 2; + url_input_bounds_rect = RightOf(url_text_bounds_rect, padding); + url_input_bounds_rect.width = url_area_rect.width * 0.7; + url_input_bounds_rect.height = TEXT_SIZE * 2; - url_enter_button = RightOf(url_input_bounds, padding); - url_enter_button.width = url_area.width * 0.1; - url_enter_button.height = TEXT_SIZE * 2; + url_enter_button_rect = RightOf(url_input_bounds_rect, padding); + url_enter_button_rect.width = url_area_rect.width * 0.1; + url_enter_button_rect.height = TEXT_SIZE * 2; - method_dropdown = RightOf(url_enter_button, padding); - method_dropdown.width = url_area.width * 0.1; - method_dropdown.height = TEXT_SIZE * 2; + method_dropdown_rect = RightOf(url_enter_button_rect, padding); + method_dropdown_rect.width = url_area_rect.width * 0.1; + method_dropdown_rect.height = TEXT_SIZE * 2; // -- Body -- // - Rectangle body_area = Below(url_area, 0); - body_area.height = content_area.height - url_area.height; + Rectangle body_area_rect = Below(url_area_rect, 0); + body_area_rect.height = content_area_rect.height - url_area_rect.height; - input_area = HorizontalSplit(body_area, 0.5); - result_area = RightOf(input_area, 0); - result_area.width = body_area.width - input_area.width; + input_area_rect = HorizontalSplit(body_area_rect, 0.5); + result_area_rect = RightOf(input_area_rect, 0); + result_area_rect.width = body_area_rect.width - input_area_rect.width; - input_tab = (Rectangle){ - .x = input_area.x + padding, - .y = input_area.y + padding, - .width = input_area.width - (2 * padding), - .height = input_area.height * 0.1 + input_tab_rect = (Rectangle){ + .x = input_area_rect.x + padding, + .y = input_area_rect.y + padding, + .width = input_area_rect.width - (2 * padding), + .height = input_area_rect.height * 0.1 }; - input_tab_item = input_tab; - input_tab_item.width = input_tab.width / 4; + input_tab_item_rect = input_tab_rect; + input_tab_item_rect.width = input_tab_rect.width / 4; - input_body = Below(input_tab, 0); - input_body.width = input_tab.width; - input_body.height = input_area.height - input_tab.height - (2 * padding); + input_body_rect = Below(input_tab_rect, 0); + input_body_rect.width = input_tab_rect.width; + input_body_rect.height = input_area_rect.height - input_tab_rect.height - (2 * padding); // -- Result -- / - result_body = (Rectangle){ - .x = result_area.x + padding, - .y = input_body.y, - .width = result_area.width - (2 * padding), - .height = input_body.height + result_body_rect = (Rectangle){ + .x = result_area_rect.x + padding, + .y = input_body_rect.y, + .width = result_area_rect.width - (2 * padding), + .height = input_body_rect.height }; Vector2 mouse_position = GetMousePosition(); @@ -789,22 +802,22 @@ } // Handle scroll wheel for history - if (InArea(mouse_position, history_list_area) && mouse_wheel != 0) { + if (InArea(mouse_position, history_list_area_rect) && mouse_wheel != 0) { history_scroll_offset += mouse_wheel * 30; // 30 pixels per wheel tick // Clamp scroll offset - float max_scroll = (total * (item_height + padding)) - history_list_area.height; + float max_scroll = (total * (item_height + padding)) - history_list_area_rect.height; if (history_scroll_offset > 0) history_scroll_offset = 0; if (history_scroll_offset < -max_scroll && max_scroll > 0) history_scroll_offset = -max_scroll; } // Handle scroll wheel for input body - if (InArea(mouse_position, input_body) && mouse_wheel != 0) { + if (InArea(mouse_position, input_body_rect) && mouse_wheel != 0) { input_body_scroll_offset += mouse_wheel * 30; if (input_body_scroll_offset > 0) input_body_scroll_offset = 0; } // Handle scroll wheel for result body - if (InArea(mouse_position, result_body) && mouse_wheel != 0) { + if (InArea(mouse_position, result_body_rect) && mouse_wheel != 0) { result_body_scroll_offset += mouse_wheel * 30; if (result_body_scroll_offset > 0) result_body_scroll_offset = 0; } @@ -812,23 +825,24 @@ BeginDrawing(); ClearBackground(GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); - DrawRectangleRec(history_sidebar, Fade(GRAY, 0.1f)); + // DrawRectangleRec(history_sidebar_rect, Fade(GRAY, 0.1f)); + DrawRectangleRounded(history_sidebar_rect, 0.5, 1, Fade(BLUE, 0.1f)); - // DrawRectangleRec(logo_area, Fade(BLUE, 0.2f)); - Rectangle logo_image_rect = AddPadding(logo_area, padding); + // DrawRectangleRec(logo_area_rect, Fade(BLUE, 0.2f)); + Rectangle logo_image_rect = AddPadding(logo_area_rect, padding); // Fit logo to area while maintaining aspect ratio float logo_size = logo_image_rect.height < logo_image_rect.width ? logo_image_rect.height : logo_image_rect.width; - Rectangle dest = { + Rectangle dest_rect = { .x = logo_image_rect.x + (logo_image_rect.width - logo_size) / 2, // Center horizontally .y = logo_image_rect.y, .width = logo_size, .height = logo_size }; - Rectangle source = { 0, 0, logo_texture.width, logo_texture.height }; - DrawTexturePro(logo_texture, source, dest, (Vector2){0, 0}, 0.0f, WHITE); + Rectangle source_rect = { 0, 0, logo_texture.width, logo_texture.height }; + DrawTexturePro(logo_texture, source_rect, dest_rect, (Vector2){0, 0}, 0.0f, WHITE); - BeginScissorMode(history_list_area.x, history_list_area.y, history_list_area.width, history_list_area.height); + BeginScissorMode(history_list_area_rect.x, history_list_area_rect.y, history_list_area_rect.width, history_list_area_rect.height); for (int i = 0; i < total; i++) { HistoryItem *curr_history_items = i < new_history_items_length ? @@ -837,24 +851,25 @@ if (curr_history_items->deleted) continue; - float diff = curr_history_items->rect.height*0.3; - // DrawRectangleRec(curr_history_items->rect, Fade(RED, 0.1f)); - Rectangle filename_area = curr_history_items->rect; + float diff = curr_history_items->rect.height*0.6; + DrawRectangleRounded(curr_history_items->rect, 0.5, 1, Fade(BLACK, 0.1f)); + Rectangle filename_area_rect = curr_history_items->rect; - filename_area.height -= diff; - Rectangle icon_area = Below(filename_area, 0); + filename_area_rect.height -= diff; + Rectangle icon_area = Below(filename_area_rect, 0); icon_area.height = diff; - DrawRectangleRec(filename_area, Fade(BLUE, 0.1f)); - DrawRectangleRec(icon_area, Fade(YELLOW, 0.1f)); + // DrawRectangleRec(filename_area_rect, Fade(BLUE, 0.1f)); + // DrawRectangleRec(icon_area, Fade(YELLOW, 0.1f)); + // DrawRectangleRec(AddPadding(filename_area_rect, 5), Fade(BLUE, 0.1f)); Rectangle icon_area_left_column = LeftColumn(icon_area, 0.5, 0); Rectangle icon_area_right_column = RightColumn(icon_area, icon_area_left_column, 0); - GuiDrawText(curr_history_items->title, AddPadding(filename_area, padding), TEXT_ALIGN_CENTER, RED); - if (GuiButton(AddPaddingHorizontal(icon_area_left_column, padding), "view")) + GuiDrawText(curr_history_items->title, AddPaddingHorizontal(curr_history_items->rect, padding), TEXT_ALIGN_MIDDLE, BLACK); + if (GuiButton(AddPadding(icon_area_left_column, padding), "view")) PostDog_Load_File(curr_history_items->filename); - if (GuiButton(AddPaddingHorizontal(icon_area_right_column,padding), "delete")) + if (GuiButton(AddPadding(icon_area_right_column, padding), "delete")) { if (!remove(PostDog_Construct_URL(curr_history_items->filename))) curr_history_items->deleted = TRUE; @@ -867,46 +882,46 @@ if (total > 0) { float content_height = total * (item_height + padding); - if (content_height > history_list_area.height) + if (content_height > history_list_area_rect.height) { - float scrollbar_height = (history_list_area.height / content_height) * history_list_area.height; - float scrollbar_y = history_list_area.y - (history_scroll_offset / content_height) * history_list_area.height; - Rectangle scrollbar = { - history_list_area.x + history_list_area.width - 5, + float scrollbar_height = (history_list_area_rect.height / content_height) * history_list_area_rect.height; + float scrollbar_y = history_list_area_rect.y - (history_scroll_offset / content_height) * history_list_area_rect.height; + Rectangle scrollbar_rect = { + history_list_area_rect.x + history_list_area_rect.width - 5, scrollbar_y, 5, scrollbar_height }; - DrawRectangleRec(scrollbar, Fade(WHITE, 0.5f)); + DrawRectangleRec(scrollbar_rect, Fade(WHITE, 0.5f)); } } // URL area Rect - GuiDrawText("URL: ", url_text_bounds, TEXT_ALIGN_CENTER, RED); - DrawRectangleRec(url_area, Fade(RED, 0.1f)); - if (GuiTextBox(url_input_bounds, url_input_text, DEFAULT_TEXT_BUFFER_LENGTH, url_input_edit)) + GuiDrawText("URL: ", url_text_bounds_rect, TEXT_ALIGN_CENTER, BLACK); + DrawRectangleRec(url_area_rect, Fade(BLACK, 0.1f)); + if (GuiTextBox(url_input_bounds_rect, url_input_text, DEFAULT_TEXT_BUFFER_LENGTH, url_input_edit)) url_input_edit = !url_input_edit; - sendRequest = GuiButton(url_enter_button, "ENTER"); + sendRequest = GuiButton(url_enter_button_rect, "ENTER"); if (sendRequest) PostDog_Http_Request(); - if (GuiDropdownBox(method_dropdown, "GET;POST;PUT;DELETE", &active_method_dropdown, method_edit)) + if (GuiDropdownBox(method_dropdown_rect, "GET;POST;PUT;DELETE", &active_method_dropdown, method_edit)) method_edit = !method_edit; // Input Tabs Rect - DrawRectangleRec(input_area, Fade(BLUE, 0.1f)); - DrawRectangleRec(input_tab, Fade(DARKBLUE, 0.1f)); + DrawRectangleRec(input_area_rect, Fade(BLUE, 0.1f)); + DrawRectangleRec(input_tab_rect, Fade(DARKBLUE, 0.1f)); GuiSetStyle(TOGGLE, GROUP_PADDING, 0); - GuiDrawRectangle(input_body, 1, GetColor(GuiGetStyle(TEXTBOX, BORDER)), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); + GuiDrawRectangle(input_body_rect, 1, GetColor(GuiGetStyle(TEXTBOX, BORDER)), GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED))); - BeginScissorMode(input_body.x, input_body.y, input_body.width, input_body.height); - Rectangle scrolled_input = AddPadding(input_body, padding * 2); - scrolled_input.y += input_body_scroll_offset; - scrolled_input.height = MAX_SCROLL_HEIGHT; + BeginScissorMode(input_body_rect.x, input_body_rect.y, input_body_rect.width, input_body_rect.height); + Rectangle scrolled_input_rect = AddPadding(input_body_rect, padding * 2); + scrolled_input_rect.y += input_body_scroll_offset; + scrolled_input_rect.height = MAX_SCROLL_HEIGHT; if (active_input_tab != TAB_WEBSOCKET) { WS_BREAK = TRUE; - if (JUNE_GuiTextBox(scrolled_input, url_body_map[active_input_tab], DEFAULT_TEXT_BUFFER_LENGTH, input_body_bool)) + if (JUNE_GuiTextBox(scrolled_input_rect, input_body_array[active_input_tab], DEFAULT_TEXT_BUFFER_LENGTH, input_body_bool)) input_body_bool = !input_body_bool; } else @@ -914,52 +929,52 @@ boolean temp = true; WS_BREAK = FALSE; if (GuiTextInputBox( - input_body, + input_body_rect, "send message", ws != NULL ? "connected" : "start messaging", - "send", url_body_map[active_input_tab], BODY_BUFFER_LENGTH, &temp) == 1) + "send", input_body_array[active_input_tab], BODY_BUFFER_LENGTH, &temp) == 1) PostDog_Websocket_Thread_Send(); } EndScissorMode(); if (input_body_scroll_offset < 0) { float scrollbar_height = 10; - float scrollbar_y = input_body.y - (input_body_scroll_offset / MAX_SCROLL_HEIGHT) * (input_body.height - scrollbar_height); - Rectangle scrollbar = { - input_body.x + input_body.width - 5, + float scrollbar_y = input_body_rect.y - (input_body_scroll_offset / MAX_SCROLL_HEIGHT) * (input_body_rect.height - scrollbar_height); + Rectangle scrollbar_rect = { + input_body_rect.x + input_body_rect.width - 5, scrollbar_y, 5, scrollbar_height }; - DrawRectangleRec(scrollbar, Fade(BLUE, 0.5f)); + DrawRectangleRec(scrollbar_rect, Fade(BLUE, 0.5f)); } - GuiToggleGroup(input_tab_item, "Header;Body;Get Param;Bar", &active_input_tab); + GuiToggleGroup(input_tab_item_rect, "Header;Body;Get Param;Websocket", &active_input_tab); PostDog_Update_URL(); // Result Rect - DrawRectangleRec(result_area, Fade(GREEN, 0.1f)); - DrawRectangleRec(result_body, Fade(DARKGREEN, 0.1f)); + DrawRectangleRec(result_area_rect, Fade(GREEN, 0.1f)); + DrawRectangleRec(result_body_rect, Fade(DARKGREEN, 0.1f)); // Create scrollable result body with offset - BeginScissorMode(result_body.x, result_body.y, result_body.width, result_body.height); - Rectangle scrolled_result = result_body; + BeginScissorMode(result_body_rect.x, result_body_rect.y, result_body_rect.width, result_body_rect.height); + Rectangle scrolled_result = result_body_rect; scrolled_result.y += result_body_scroll_offset; scrolled_result.height = MAX_SCROLL_HEIGHT; - GuiTextBoxMulti(scrolled_result, url_result_text, RESULT_BUFFER_LENGTH, false); + GuiTextBoxMulti(scrolled_result, result_text, RESULT_BUFFER_LENGTH, false); EndScissorMode(); if (result_body_scroll_offset < 0) { float scrollbar_height = 10; - float scrollbar_y = result_body.y - (result_body_scroll_offset / MAX_SCROLL_HEIGHT) * (result_body.height - scrollbar_height); - Rectangle scrollbar = { - result_body.x + result_body.width - 5, + float scrollbar_y = result_body_rect.y - (result_body_scroll_offset / MAX_SCROLL_HEIGHT) * (result_body_rect.height - scrollbar_height); + Rectangle scrollbar_rect = { + result_body_rect.x + result_body_rect.width - 5, scrollbar_y, 5, scrollbar_height }; - DrawRectangleRec(scrollbar, Fade(GREEN, 0.5f)); + DrawRectangleRec(scrollbar_rect, Fade(GREEN, 0.5f)); } if (url_input_edit && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) @@ -968,13 +983,13 @@ } else if (input_body_bool && (IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) { - SetClipboardText(url_body_map[active_input_tab]); + SetClipboardText(input_body_array[active_input_tab]); } - else if (InArea(mouse_position, result_body)) + else if (InArea(mouse_position, result_body_rect)) { - DrawRectangleRec(result_body, Fade(GREEN, 0.3f)); + DrawRectangleRec(result_body_rect, Fade(GREEN, 0.3f)); if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyPressed(KEY_C)) - SetClipboardText(url_result_text); + SetClipboardText(result_text); } EndDrawing(); }