void draw_scrollbar (ESContext *esContext, uint16_t page, uint16_t page_max, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t)) { #ifdef CONSOLE_ONLY return; #endif if (page_max > 0) { draw_box_f3(esContext, 1.3, -0.77, 0.002, 1.35, 0.77, 0.002, 255, 255, 255, 128); set_button("down", setup.view_mode, 1.3, -0.77, 1.35, -0.67, callback, -1.0, 0); set_button("down2", setup.view_mode, 1.3, -0.77, 1.35, 0.0, callback, -1.0, 0); draw_box_f3(esContext, 1.3, -0.77, 0.002, 1.35, -0.67, 0.002, 255, 255, 255, 128); draw_box_f3(esContext, 1.3, -0.77, 0.002, 1.35, -0.67, 0.002, 255, 255, 255, 128); draw_rect_f3(esContext, 1.3, -0.77, 0.002, 1.35, -0.67, 0.002, 255, 255, 255, 128); set_button("up", setup.view_mode, 1.3, 0.67, 1.35, 0.77, callback, 1.0, 0); set_button("up2", setup.view_mode, 1.3, 0.0, 1.35, 0.77, callback, 1.0, 0); if (page < 0) { page = 0; } if (page > page_max) { page = page_max; } draw_box_f3(esContext, 1.3, 0.67, 0.002, 1.35, 0.77, 0.002, 255, 255, 255, 128); draw_box_f3(esContext, 1.3, 0.77, 0.002, 1.35, 0.67, 0.002, 255, 255, 255, 128); draw_rect_f3(esContext, 1.3, 0.77, 0.002, 1.35, 0.67, 0.002, 255, 255, 255, 128); draw_box_f3(esContext, 1.3 - 0.01, -0.67 + (1.34) * (float)(page) / (float)(page_max) - 0.02, 0.002, 1.35 + 0.01, -0.67 + (1.34) * (float)(page) / (float)(page_max), 0.002, 255, 255, 255, 200); draw_rect_f3(esContext, 1.3 - 0.01, -0.67 + (1.34) * (float)(page) / (float)(page_max) - 0.02, 0.002, 1.35 + 0.01, -0.67 + (1.34) * (float)(page) / (float)(page_max), 0.002, 100, 100, 100, 128); } }
void draw_spinbox (ESContext *esContext, float x1, float y1, float w, float z, char *name, char *format, float value, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t)) { #ifdef CONSOLE_ONLY return; #endif float x2 = x1 + w; float h = 0.07; float y2 = y1 + h; char tmp_str[1024]; sprintf(tmp_str, format, value); #ifdef SDLGL #ifndef ANDROID draw_box_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 55); draw_rect_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 255); #else draw_box_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 55); draw_rect_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 255); #endif #endif draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 + 0.005, z, x2 - 0.02, y1 + h / 2 + 0.005, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 + 0.005, z, x2 - h / 2, y1 + h / 2 + 0.02, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h / 2, y1 + h / 2 + 0.02, z, x2 - 0.02, y1 + h / 2 + 0.005, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 - 0.005, z, x2 - 0.02, y1 + h / 2 - 0.005, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 - 0.005, z, x2 - h / 2, y1 + h / 2 - 0.02, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h / 2, y1 + h / 2 - 0.02, z, x2 - 0.02, y1 + h / 2 - 0.005, z, 255, 255, 255, 255); draw_text_f3(esContext, x1 + 0.005, y1 + 0.005, z + 0.001, h - 0.01, h - 0.01, FONT_GREEN, tmp_str); set_button(name, setup.view_mode, x1, y1, x2, y2, callback, 0.0, 0); }
uint8_t draw_button (ESContext *esContext, char *name, uint8_t view_mode, char *text, char *font, float x1, float y1, float z1, float x2, float y2, float z2, float fh, uint8_t align_x, uint8_t align_y, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t), float data) { #ifdef CONSOLE_ONLY return 0; #endif uint16_t n = 0; draw_rect_f3(esContext, x1, y1, z1, x2, y2, z1, 128, 128, 128, 32); draw_box_f3c2(esContext, x1, y1, z1, x2, y1 + (y2 - y1) / 3 * 2, z1, 128, 128, 128, 64, 128, 128, 128, 128); draw_box_f3c2(esContext, x1, y1 + (y2 - y1) / 3 * 2, z1, x2, y2, z1, 128, 128, 128, 128, 128, 128, 128, 64); float tx = x1; float ty = y1; if (align_x == ALIGN_CENTER) { tx = x1 + (x2 - x1) / 2 - (strlen(text) * fh * 0.6) / 2; } else if (align_x == ALIGN_RIGHT) { tx = x2 - fh / 4 - (strlen(text) * fh * 0.6); } else if (align_x == ALIGN_LEFT) { tx = x1 + fh / 4; } if (align_y == ALIGN_CENTER) { ty = y1 + (y2 - y1) / 2 - fh / 2; } else if (align_y == ALIGN_TOP) { ty = y1 + fh / 4; } else if (align_y == ALIGN_BOTTOM) { ty = y2 - fh / 4 - fh; } // draw_text_f3(esContext, x1, y1 + (y2 - y1) / 2 - fh / 2, z1, fh, fh, font, text); draw_text_f3(esContext, tx, ty, z1, fh, fh, font, text); if (gui_ov_lock == 1) { return 0; } for (n = 0; n < MAX_BUTTONS; n++) { if (strcmp(Buttons[n].name, name) == 0) { Buttons[n].view_mode = setup.view_mode; Buttons[n].x1 = x1; Buttons[n].y1 = y1; Buttons[n].x2 = x2; Buttons[n].y2 = y2; Buttons[n].data = data; Buttons[n].callback = callback; Buttons[n].type = 0; return 0; } else if (Buttons[n].name[0] == 0) { strncpy(Buttons[n].name, name, 99); Buttons[n].view_mode = setup.view_mode; Buttons[n].x1 = x1; Buttons[n].y1 = y1; Buttons[n].x2 = x2; Buttons[n].y2 = y2; Buttons[n].data = data; Buttons[n].callback = callback; Buttons[n].type = 0; return 1; } } return 2; }
void draw_rect (ESContext *esContext, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { #ifdef CONSOLE_ONLY return; #endif float x1 = (float)x / (float)esContext->width * 2.0 * aspect - 1.0 * aspect; float y1 = (float)y / (float)esContext->height * 2.0 - 1.0; float x2 = x1 + (float)w / (float)esContext->width * 2.0 * aspect; float y2 = y1 + (float)h / (float)esContext->height * 2.0; draw_rect_f3(esContext, x1, y1, 0.0, x2, y2, 0.0, r, g, b, a); }
void draw_buttonbox (ESContext *esContext, char *name, uint8_t view_mode, char *text, float x1, float y1, float w, float z, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t), float data) { #ifdef CONSOLE_ONLY return; #endif float x2 = x1 + w; float h = 0.07; float y2 = y1 + h; #ifdef SDLGL #ifndef ANDROID draw_box_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 55); draw_rect_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 255); #else draw_box_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 55); draw_rect_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 255); #endif #endif draw_text_f3(esContext, x1 + w / 2 - (h - 0.01) * 0.6 * strlen(text) / 2.0 - (h - 0.01) * 0.6 / 3.0, y1 + 0.005, z + 0.001, h - 0.01, h - 0.01, FONT_GREEN, text); set_button(name, setup.view_mode, x1, y1, x2, y2, callback, 0.0, 0); }
void draw_pulldown (ESContext *esContext, float x1, float y1, float w, float z, char *name, EntryList *list, uint8_t open, uint8_t select, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t)) { #ifdef CONSOLE_ONLY return; #endif uint8_t n = 0; float x2 = x1 + w; float h = 0.07; float y2 = y1 + h; char tmp_str[1024]; #ifdef SDLGL #ifndef ANDROID draw_box_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 55); draw_rect_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 255); #else draw_box_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 55); draw_rect_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 255); #endif #endif if (open == 1) { // y1 -= select * h; // y2 -= select * h; while (list[n].name != NULL) { if (n == select) { draw_box_f3(esContext, x1 + 0.01, y1 + n * h, z, x2 - 0.01, y2 + n * h, z + 0.05, 200, 200, 200, 200); } else { draw_box_f3(esContext, x1 + 0.01, y1 + n * h, z, x2 - 0.01, y2 + n * h, z + 0.05, 255, 255, 255, 200); } draw_text_f3(esContext, x1 + 0.001 + 0.005, y1 + n * h + 0.005, z + 0.1, h - 0.01, h - 0.01, FONT_GREEN, list[n].name); sprintf(tmp_str, "%s_%i", name, n); set_button(tmp_str, setup.view_mode, x1 + 0.01, y1 + n * h, x2 + 0.01, y2 + n * h, callback, (float)(n + 1), 0); n++; } gui_ov_lock = 1; } else { draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 - 0.01, z, x2 - 0.02, y1 + h / 2 - 0.01, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h + 0.02, y1 + h / 2 - 0.01, z, x2 - h / 2, y1 + h / 2 + 0.01, z, 255, 255, 255, 255); draw_line_f3(esContext, x2 - h / 2, y1 + h / 2 + 0.01, z, x2 - 0.02, y1 + h / 2 - 0.01, z, 255, 255, 255, 255); draw_text_f3(esContext, x1 + 0.005, y1 + 0.005, z + 0.001, h - 0.01, h - 0.01, FONT_GREEN, list[select].name); sprintf(tmp_str, "%s", name); set_button(tmp_str, setup.view_mode, x1, y1, x2, y2, callback, 0.0, 0); } }
void screen_graph(ESContext *esContext) { uint16_t n = 0; draw_title(esContext, "Graph (Test-Page)"); for (n = 0; n < 10; n++) { graph_data[n][graph_pointer] = rand(); } graph_data[0][graph_pointer] = (uint8_t)(ModelData[ModelActive].gyro_x / 4.0 + 128); graph_data[1][graph_pointer] = (uint8_t)(ModelData[ModelActive].gyro_y / 4.0 + 128); graph_data[2][graph_pointer] = (uint8_t)(ModelData[ModelActive].gyro_z / 4.0 + 128); graph_data[3][graph_pointer] = (uint8_t)(ModelData[ModelActive].acc_x * 128.0 + 128); graph_data[4][graph_pointer] = (uint8_t)(ModelData[ModelActive].acc_y * 128.0 + 128); if (graph_pointer < graph_size) { graph_pointer++; } else { graph_pointer = 0; } for (n = 0; n < 10; n++) { draw_graph_value(esContext, -1.2, 0.8, 1.2, 0.8 + 0.10, 0.001, graph_data[n], graph_size, graph_pointer, n * 25, n * 25, n * 25, 255); draw_graph_value(esContext, -1.2, -0.8 + (float)n * 0.12, 1.2, -0.8 + (float)n * 0.12 + 0.10, 0.001, graph_data[n], graph_size, graph_pointer, 255 - n * 25, n * 25, n * 125, 255); } draw_rect_f3(esContext, -1.2, 0.8, 0.001, 1.2, 0.8 + 0.10, 0.001, 255, 255, 255, 255); }
void draw_window (ESContext *esContext, float x1, float y1, float x2, float y2, float z, char *name, char *title, EntryList *list, uint8_t select, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t)) { #ifdef CONSOLE_ONLY return; #endif uint8_t n = 0; uint8_t m = 0; float tw = 0.6; float step = 0.4; char tmp_str[1024]; while (list[m].name != NULL) { m++; } #ifdef SDLGL #ifndef ANDROID draw_box_rounded_f3(esContext, x1, y1, z, x2, y2, z, 0.04, 55, 55, 255, 100); draw_rect_rounded_f3(esContext, x1, y1, z, x2, y2, z, 0.04, 255, 255, 255, 255); #else draw_box_f3(esContext, x1, y1, z, x2, y2, z, 55, 55, 255, 100); draw_rect_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 255); #endif #endif draw_line_f3(esContext, x1, y1 + 0.08, z, x1 + tw, y1 + 0.08, z, 255, 255, 255, 255); draw_line_f3(esContext, x1 + tw, y1 + 0.08, z, x1 + tw + 0.1, y1, z, 255, 255, 255, 255); draw_text_f3(esContext, x1 + 0.05, y1 + 0.01, z + 0.001, 0.07, 0.07, FONT_PINK, title); while (list[n].name != NULL) { sprintf(tmp_str, "%s%i", name, n); if (n == select) { draw_line_f3(esContext, x1 + tw + step * n, y1 + 0.08, z, x1 + tw + step * n + step, y1 + 0.08, z, 255, 255, 255, 100); } else { draw_line_f3(esContext, x1 + tw + step * n, y1 + 0.08, z, x1 + tw + step * n + step, y1 + 0.08, z, 255, 255, 255, 255); } draw_line_f3(esContext, x1 + tw + step * n + step, y1 + 0.08, z, x1 + tw + step * n + step + 0.1, y1, z, 255, 255, 255, 255); draw_text_f3(esContext, x1 + tw + step * n + 0.07, y1 + 0.02, z + 0.001, 0.06, 0.06, FONT_WHITE, list[n].name); set_button(tmp_str, setup.view_mode, x1 + tw + step * n, y1, x1 + tw + step * n + step, y1 + 0.08, callback, (float)n, 0); n++; } draw_line_f3(esContext, x1 + tw + step * n, y1 + 0.08, z, x2, y1 + 0.08, z, 255, 255, 255, 255); }
void draw_checkbox (ESContext *esContext, float x1, float y1, float z, char *name, uint8_t check, uint8_t (*callback) (char *, float, float, int8_t, float, uint8_t)) { #ifdef CONSOLE_ONLY return; #endif float w = 0.07; float h = 0.07; float x2 = x1 + w; float y2 = y1 + h; #ifdef SDLGL #ifndef ANDROID draw_box_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 55); draw_rect_rounded_f3(esContext, x1, y1, z, x2, y2, z, h / 3, 255, 255, 255, 255); #else draw_box_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 55); draw_rect_f3(esContext, x1, y1, z, x2, y2, z, 255, 255, 255, 255); #endif #endif if (check == 1) { draw_line_f3(esContext, x1 + 0.02, y1 + 0.02, z, x2 - 0.02, y2 - 0.02, z, 255, 255, 255, 255); draw_line_f3(esContext, x1 + 0.02, y2 - 0.02, z, x2 - 0.02, y1 + 0.02, z, 255, 255, 255, 255); } set_button(name, setup.view_mode, x1, y1, x2, y2, callback, 0.0, 0); }
void screen_overview(ESContext *esContext) { #ifndef SDLGL ESMatrix modelview; UserData *userData = esContext->userData; #endif char tmp_str[1024]; uint8_t n = 0; #ifndef SDLGL esMatrixLoadIdentity(&modelview); esMatrixMultiply(&userData->mvpMatrix, &modelview, &userData->perspective); #endif reset_buttons(); int x = 0; int y = 0; for (n = 0; n < VIEW_MODE_LAST; n++) { if (x >= 4) { x = 0; y += 1; } #ifndef WINDOWS #ifndef ANDROID draw_to_buffer(); if (n == VIEW_MODE_HUD) { screen_hud(esContext); } else if (n == VIEW_MODE_TELEMETRY) { screen_telemetry(esContext); } else if (n == VIEW_MODE_MODEL) { screen_model(esContext); } else if (n == VIEW_MODE_RCFLOW) { screen_rcflow(esContext); } else if (n == VIEW_MODE_FMS) { screen_fms(esContext); } else if (n == VIEW_MODE_WPEDIT) { screen_wpedit(esContext); } else if (n == VIEW_MODE_MAP) { screen_map(esContext, lat, lon, zoom); } else if (n == VIEW_MODE_SYSTEM) { screen_system(esContext); #ifndef ANDROID } else if (n == VIEW_MODE_VIDEOLIST) { screen_videolist(esContext); #ifdef USE_TCL } else if (n == VIEW_MODE_TCL) { screen_tcl(esContext); #endif #endif } else if (n == VIEW_MODE_TRACKER) { screen_tracker(esContext); } else if (n == VIEW_MODE_FCMENU) { if (ModelData[ModelActive].teletype == TELETYPE_MULTIWII_21) { screen_mwi_menu(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_BASEFLIGHT) { screen_mwi_menu(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_GPS_NMEA) { screen_graph(esContext); } else if (ModelData[ModelActive].teletype == TELETYPE_OPENPILOT) { screen_openpilot(esContext); } else { screen_mavlink_menu(esContext); } } draw_to_screen(); draw_buffer_to_screen(-1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 1.0); sprintf(tmp_str, "%s", view_names[n]); if (setup.view_mode == n) { draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_GREEN, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); } else { draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); } #else sprintf(tmp_str, "%s", view_names[n]); draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); #endif #else sprintf(tmp_str, "%s", view_names[n]); draw_text_button(esContext, tmp_str, setup.view_mode, tmp_str, FONT_WHITE, -1.422 + 0.35 + x * 0.71, -0.99 + y * 0.66 + 0.3, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)n); #endif reset_buttons(); x++; } x = 0; y = 0; for (n = 0; n < VIEW_MODE_LAST; n++) { if (x >= 4) { x = 0; y += 1; } // draw_rect_f3(esContext, -1.3 + x * 0.5, -0.8 + y * 0.4, 0.002, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, 0.002, 255, 255, 255, 255); // set_button(view_names[n], setup.view_mode, -1.3 + x * 0.5, -0.8 + y * 0.4, -1.3 + x * 0.5 + 0.5, -0.8 + y * 0.4 + 0.4, overview_set, (float)n, 0); draw_rect_f3(esContext, -1.422 + x * 0.71, -0.99 + y * 0.66, 0.002, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, 0.002, 255, 255, 255, 255); set_button(view_names[n], setup.view_mode, -1.422 + x * 0.71, -0.99 + y * 0.66, -1.422 + x * 0.71 + 0.71, -0.99 + y * 0.66 + 0.66, overview_set, (float)n, 0); x++; } draw_text_button(esContext, "Options", setup.view_mode, "Options", FONT_PINK, 1.05, 0.55 + -2 * 0.1, 0.002, 0.08, ALIGN_CENTER, ALIGN_TOP, overview_set, (float)0); n = 0; if (setup.speak == 1) { draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "SPEAK", setup.view_mode, "SPEAK", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } if (logmode == 1) { draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "LOGGING", setup.view_mode, "LOGGING", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } #ifndef OSX if (logplay == 1) { draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "LOGPLAYER", setup.view_mode, "LOGPLAYER", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } #endif if (clientmode != 1 && setup.webport != 0) { if (webserv_is_running() == 1) { draw_text_button(esContext, "WEBSERV", setup.view_mode, "stop Webserver", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } else { draw_text_button(esContext, "WEBSERV", setup.view_mode, "start Webserver", FONT_WHITE, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); } } draw_text_button(esContext, "EXIT", setup.view_mode, "EXIT", FONT_GREEN, 1.05, 0.45 + n++ * 0.1, 0.002, 0.06, ALIGN_CENTER, ALIGN_TOP, option_cmd, 0.0); }
void draw_circleMeter_f3 (ESContext *esContext, float x, float y, float z, float radius, float start1, float start2, float start3, float start4, float value, char *text, char *text2, uint8_t type) { #ifdef CONSOLE_ONLY return; #endif float th = radius / 3.5; float width = radius / 15.0; if (type == 2) { width = 0.015; } float offset1 = start1; float offset2 = start4; start2 = (offset2 - offset1) * start2 / 100.0 + offset1; start3 = (offset2 - offset1) * start3 / 100.0 + offset1; value = (offset2 - offset1) * value / 100.0 + offset1; if (type == 2) { if (setup.contrast == 1) { // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset1, 255, 255, 255, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, offset1, start2, 255, 255, 255, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start2, start3, 255, 255, 0, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start3, offset2, 255, 0, 0, 255); // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset2, 255, 0, 0, 255); draw_circleFilled_f3_part(esContext, x, y, z, 0.0, radius - width, offset1, value, 100, 100, 255, 255); draw_circlePointer_f3(esContext, x, y, z + 0.0001, radius - width, radius / 20.0, value, 255, 255, 255, 255); } else { // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset1, 227, 227, 227, 200); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, offset1, start2, 227, 227, 227, 200); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start2, start3, 255, 255, 0, 200); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start3, offset2, 255, 0, 0, 200); // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset2, 255, 0, 0, 200); draw_circleFilled_f3_part(esContext, x, y, z, 0.0, radius - width, offset1, value, 100, 100, 255, 127); draw_circlePointer_f3(esContext, x, y, z + 0.0001, radius - width, radius / 20.0, value, 255, 255, 255, 255); } } else { if (setup.contrast == 1) { // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset1, 127, 127, 127, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, offset1, start2, 127, 127, 127, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start2, start3, 200, 200, 200, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start3, offset2, 255, 255, 255, 255); // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset2, 10, 200, 10, 255); draw_circlePointer_f3(esContext, x, y, z + 0.0001, radius - width, radius / 20.0, value, 255, 255, 255, 255); } else { // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset1, 200, 10, 10, 255); if (type == 3) { draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, offset1, start2, 10, 220, 10, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start2, start3, 220, 220, 10, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start3, offset2, 220, 10, 10, 255); } else { draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, offset1, start2, 220, 10, 10, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start2, start3, 220, 220, 10, 255); draw_circleFilled_f3_part(esContext, x, y, z, radius, radius - width, start3, offset2, 10, 220, 10, 255); } // draw_circleFilled_f3_part_end(esContext, x, y, z, radius, radius - width, offset2, 10, 200, 10, 255); draw_circlePointer_f3(esContext, x, y, z + 0.0001, radius - width, radius / 20.0, value, 255, 255, 255, 255); } } if (strlen(text) > 0 || strlen(text2) > 0) { if (type == 1) { draw_text_f3(esContext, x + radius - width - strlen(text) * th * 0.6, y + (radius - width) / 2.0, z + 0.001, th, th, FONT_WHITE, text); draw_text_f3(esContext, x + radius - width - strlen(text2) * th * 0.6, y + th + (radius - width) / 2.0, z + 0.001, th, th, FONT_WHITE, text2); } else if (type == 2) { draw_box_f3(esContext, x - radius / 5 * 3, y - th / 2.0, z + 0.0011, x + radius / 5 * 3, y + th * 3.0 / 2.0, z + 0.0011, 0, 0, 0, 127); draw_rect_f3(esContext, x - radius / 5 * 3, y - th / 2.0, z + 0.0015, x + radius / 5 * 3, y + th * 3.0 / 2.0, z + 0.0015, 255, 255, 255, 255); draw_text_f3(esContext, x - strlen(text) * th * 0.6 / 2.0, y - th / 2.0, z + 0.0015, th, th, FONT_WHITE, text); draw_text_f3(esContext, x - strlen(text2) * th * 0.6 / 2.0, y + th / 2.0, z + 0.0015, th, th, FONT_WHITE, text2); } else { draw_text_f3(esContext, x - strlen(text) * th * 0.6 / 2, y + th / 2.0, z + 0.001, th, th, FONT_WHITE, text); draw_text_f3(esContext, x - strlen(text2) * th * 0.6 / 2, y + th / 2.0 + th, z + 0.001, th, th, FONT_WHITE, text2); } } }
void draw_rect_f (ESContext *esContext, float x1, float y1, float x2, float y2, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { #ifdef CONSOLE_ONLY return; #endif draw_rect_f3(esContext, x1, y1, 0.0, x2, y2, 0.0, r, g, b, a); }