Initial commit: DayZ memory C++ port with DMA backend and overlay
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include "includes.h"
|
||||
|
||||
enum fade_direction : int
|
||||
{
|
||||
vertically,
|
||||
horizontally,
|
||||
diagonally,
|
||||
diagonally_reversed,
|
||||
};
|
||||
|
||||
class c_draw
|
||||
{
|
||||
public:
|
||||
ImU32 get_clr(const ImVec4& col, float alpha = 1.f);
|
||||
|
||||
ImU32 w_get_clr(style_col idx, float alpha = 1.f);
|
||||
|
||||
void text(ImDrawList* draw_list, const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.f, const ImVec4* cpu_fine_clip_rect = 0);
|
||||
|
||||
void text_clipped(ImDrawList* draw_list, ImFont* font, const ImVec2& pos_min, const ImVec2& pos_max, ImU32 color, const char* text, const char* text_display_end = NULL, const ImVec2* text_size_if_known = NULL, const ImVec2& align = ImVec2(0.f, 0.f), const ImRect* clip_rect = NULL);
|
||||
|
||||
void radial_gradient(ImDrawList* draw_list, const ImVec2& center, float radius, ImU32 col_in, ImU32 col_out);
|
||||
|
||||
void set_linear_color_alpha(ImDrawList* draw_list, int vert_start_idx, int vert_end_idx, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
|
||||
|
||||
void line(ImDrawList* draw_list, const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f);
|
||||
|
||||
void rect(ImDrawList* draw_list, const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, draw_flags flags = 0, float thickness = 1.0f);
|
||||
|
||||
void rect_filled(ImDrawList* draw_list, const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, draw_flags flags = 0);
|
||||
|
||||
void rect_filled_multi_color(ImDrawList* draw, const ImVec2& p_min, const ImVec2& p_max, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left, float rounding = 0.f, draw_flags flags = 0);
|
||||
|
||||
void fade_rect_filled(ImDrawList* draw, const ImVec2& pos_min, const ImVec2& pos_max, ImU32 col_one, ImU32 col_two, fade_direction direction, float rounding = 0.f, draw_flags flags = 0);
|
||||
|
||||
void shadow_rect(ImDrawList* draw_list, const ImVec2& obj_min, const ImVec2& obj_max, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, draw_flags flags = 0, float obj_rounding = 0.0f);
|
||||
|
||||
void circle(ImDrawList* draw_list, const ImVec2& center, float radius, ImU32 col, int num_segments = 0, float thickness = 1.0f);
|
||||
|
||||
void circle_filled(ImDrawList* draw_list, const ImVec2& center, float radius, ImU32 col, int num_segments = 0);
|
||||
|
||||
void shadow_circle(ImDrawList* draw_list, const ImVec2& obj_center, float obj_radius, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, draw_flags flags = 0, int obj_num_segments = 12);
|
||||
|
||||
void triangle(ImDrawList* draw_list, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness = 1.f);
|
||||
|
||||
void triangle_filled(ImDrawList* draw_list, const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col);
|
||||
|
||||
void image(ImDrawList* draw_list, ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min = ImVec2(0, 0), const ImVec2& uv_max = ImVec2(1, 1), ImU32 col = IM_COL32_WHITE);
|
||||
|
||||
void image_rounded(ImDrawList* draw_list, ImTextureID user_texture_id, const ImVec2& p_min, const ImVec2& p_max, const ImVec2& uv_min = ImVec2(0, 0), const ImVec2& uv_max = ImVec2(1, 1), ImU32 col = IM_COL32_WHITE, float rounding = 1.f, draw_flags flags = 0);
|
||||
|
||||
void shadow_convex_poly(ImDrawList* draw_list, const ImVec2* points, int points_count, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, draw_flags flags = 0);
|
||||
|
||||
void shadow_ngon(ImDrawList* draw_list, const ImVec2& obj_center, float obj_radius, ImU32 shadow_col, float shadow_thickness, const ImVec2& shadow_offset, draw_flags flags, int obj_num_segments);
|
||||
|
||||
void rotate_start(ImDrawList* draw_list);
|
||||
|
||||
void rotate_end(ImDrawList* draw_list, float rad, ImVec2 center = ImVec2(0, 0));
|
||||
|
||||
void push_clip_rect(ImDrawList* draw_list, const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false);
|
||||
|
||||
void pop_clip_rect(ImDrawList* draw_list);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<c_draw> draw = std::make_unique<c_draw>();
|
||||
+477
@@ -0,0 +1,477 @@
|
||||
#pragma once
|
||||
|
||||
typedef int style_var;
|
||||
typedef int style_col;
|
||||
typedef int window_flags;
|
||||
typedef int child_flags;
|
||||
typedef int gui_cond;
|
||||
typedef int draw_flags;
|
||||
typedef int mouse_button;
|
||||
|
||||
using c_text = std::string;
|
||||
using c_vec4 = ImVec4;
|
||||
using c_col = ImColor;
|
||||
using c_vec2 = ImVec2;
|
||||
using c_multi_string = std::vector<std::string>;
|
||||
using c_multi_bool = std::vector<bool>;
|
||||
using c_window = ImGuiWindow;
|
||||
using c_id = ImGuiID;
|
||||
using c_rect = ImRect;
|
||||
using c_draw_list = ImDrawList;
|
||||
|
||||
enum style_var_
|
||||
{
|
||||
style_var_alpha,
|
||||
style_var_disabled_alpha,
|
||||
style_var_window_padding,
|
||||
style_var_window_rounding,
|
||||
style_var_window_border_size,
|
||||
style_var_window_min_size,
|
||||
style_var_window_title_align,
|
||||
style_var_child_rounding,
|
||||
style_var_child_border_size,
|
||||
style_var_popup_rounding,
|
||||
style_var_popup_border_size,
|
||||
style_var_frame_padding,
|
||||
style_var_frame_rounding,
|
||||
style_var_frame_border_size,
|
||||
style_var_item_spacing,
|
||||
style_var_item_inner_spacing,
|
||||
style_var_indent_spacing,
|
||||
style_var_cell_padding,
|
||||
style_var_scrollbar_size,
|
||||
style_var_scrollbar_rounding,
|
||||
style_var_grab_min_size,
|
||||
style_var_grab_rounding,
|
||||
style_var_tab_rounding,
|
||||
style_var_tab_border_size,
|
||||
style_var_tab_bar_border_size,
|
||||
style_var_tab_bar_overline_size,
|
||||
style_var_table_angled_headers_angle,
|
||||
style_var_table_angled_headers_text_align,
|
||||
style_var_button_text_align,
|
||||
style_var_selectable_text_align,
|
||||
style_var_separator_text_border_size,
|
||||
style_var_separator_text_align,
|
||||
style_var_separator_text_padding,
|
||||
style_var_window_shadow_size,
|
||||
style_var_window_shadow_offset,
|
||||
style_var_scrollbar_border_padding,
|
||||
style_var_scrollbar_content_padding,
|
||||
style_var_count
|
||||
};
|
||||
|
||||
enum style_col_
|
||||
{
|
||||
style_col_text,
|
||||
style_col_text_disabled,
|
||||
style_col_window_bg,
|
||||
style_col_child_bg,
|
||||
style_col_popup_bg,
|
||||
style_col_border,
|
||||
style_col_border_shadow,
|
||||
style_col_frame_bg,
|
||||
style_col_frame_bg_hovered,
|
||||
style_col_frame_bg_active,
|
||||
style_col_title_bg,
|
||||
style_col_title_bg_active,
|
||||
style_col_title_bg_collapsed,
|
||||
style_col_menu_bar_bg,
|
||||
style_col_scrollbar_bg,
|
||||
style_col_scrollbar_grab,
|
||||
style_col_scrollbar_grab_hovered,
|
||||
style_col_scrollbar_grab_active,
|
||||
style_col_check_mark,
|
||||
style_col_slider_grab,
|
||||
style_col_slider_grab_active,
|
||||
style_col_button,
|
||||
style_col_button_hovered,
|
||||
style_col_button_active,
|
||||
style_col_header,
|
||||
style_col_header_hovered,
|
||||
style_col_header_active,
|
||||
style_col_separator,
|
||||
style_col_separator_hovered,
|
||||
style_col_separator_active,
|
||||
style_col_resize_grip,
|
||||
style_col_resize_grip_hovered,
|
||||
style_col_resize_grip_active,
|
||||
style_col_tab_hovered,
|
||||
style_col_tab,
|
||||
style_col_tab_selected,
|
||||
style_col_tab_selected_overline,
|
||||
style_col_tab_dimmed,
|
||||
style_col_tab_dimmed_selected,
|
||||
style_col_tab_dimmed_selected_overline,
|
||||
style_col_plot_lines,
|
||||
style_col_plot_lines_hovered,
|
||||
style_col_plot_histogram,
|
||||
style_col_plot_histogram_hovered,
|
||||
style_col_table_header_bg,
|
||||
style_col_table_border_strong,
|
||||
style_col_table_border_light,
|
||||
style_col_table_row_bg,
|
||||
style_col_table_row_bg_alt,
|
||||
style_col_text_link,
|
||||
style_col_text_selected_bg,
|
||||
style_col_drag_drop_target,
|
||||
style_col_nav_highlight,
|
||||
style_col_nav_windowing_highlight,
|
||||
style_col_nav_windowing_dim_bg,
|
||||
style_col_modal_window_dim_bg,
|
||||
style_col_window_shadow,
|
||||
style_col_count,
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
style_col_tab_active = style_col_tab_selected,
|
||||
style_col_tab_unfocused = style_col_tab_dimmed,
|
||||
style_col_tab_unfocused_active = style_col_tab_dimmed_selected,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum window_flags_
|
||||
{
|
||||
window_flags_none = 0,
|
||||
window_flags_no_title_bar = 1 << 0,
|
||||
window_flags_no_resize = 1 << 1,
|
||||
window_flags_no_move = 1 << 2,
|
||||
window_flags_no_scrollbar = 1 << 3,
|
||||
window_flags_no_scroll_with_mouse = 1 << 4,
|
||||
window_flags_no_collapse = 1 << 5,
|
||||
window_flags_always_auto_resize = 1 << 6,
|
||||
window_flags_no_background = 1 << 7,
|
||||
window_flags_no_saved_settings = 1 << 8,
|
||||
window_flags_no_mouse_inputs = 1 << 9,
|
||||
window_flags_menu_bar = 1 << 10,
|
||||
window_flags_horizontal_scrollbar = 1 << 11,
|
||||
window_flags_no_focus_on_appearing = 1 << 12,
|
||||
window_flags_no_bring_to_front_on_focus = 1 << 13,
|
||||
window_flags_always_vertical_scrollbar = 1 << 14,
|
||||
window_flags_always_horizontal_scrollbar = 1 << 15,
|
||||
window_flags_no_nav_inputs = 1 << 16,
|
||||
window_flags_no_nav_focus = 1 << 17,
|
||||
window_flags_unsaved_document = 1 << 18,
|
||||
window_flags_no_nav = window_flags_no_nav_inputs | window_flags_no_nav_focus,
|
||||
window_flags_no_decoration = window_flags_no_title_bar | window_flags_no_resize | window_flags_no_scrollbar | window_flags_no_collapse,
|
||||
window_flags_no_inputs = window_flags_no_mouse_inputs | window_flags_no_nav_inputs | window_flags_no_nav_focus,
|
||||
|
||||
window_flags_child_window = 1 << 24,
|
||||
window_flags_tooltip = 1 << 25,
|
||||
window_flags_popup = 1 << 26,
|
||||
window_flags_modal = 1 << 27,
|
||||
window_flags_child_menu = 1 << 28,
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
window_flags_always_use_window_padding = 1 << 30,
|
||||
window_flags_nav_flattened = 1 << 31,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum child_flags_
|
||||
{
|
||||
child_flags_none = 0,
|
||||
child_flags_borders = 1 << 0,
|
||||
child_flags_always_use_window_padding = 1 << 1,
|
||||
child_flags_resize_x = 1 << 2,
|
||||
child_flags_resize_y = 1 << 3,
|
||||
child_flags_auto_resize_x = 1 << 4,
|
||||
child_flags_auto_resize_y = 1 << 5,
|
||||
child_flags_always_auto_resize = 1 << 6,
|
||||
child_flags_frame_style = 1 << 7,
|
||||
child_flags_nav_flattened = 1 << 8,
|
||||
|
||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
child_flags_border = child_flags_borders,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum gui_cond_
|
||||
{
|
||||
gui_cond_none = 0,
|
||||
gui_cond_always = 1 << 0,
|
||||
gui_cond_once = 1 << 1,
|
||||
gui_cond_first_use_ever = 1 << 2,
|
||||
gui_cond_appearing = 1 << 3,
|
||||
};
|
||||
|
||||
enum draw_flags_
|
||||
{
|
||||
draw_flags_none = 0,
|
||||
draw_flags_closed = 1 << 0,
|
||||
draw_flags_round_corners_top_left = 1 << 4,
|
||||
draw_flags_round_corners_top_right = 1 << 5,
|
||||
draw_flags_round_corners_bottom_left = 1 << 6,
|
||||
draw_flags_round_corners_bottom_right = 1 << 7,
|
||||
draw_flags_round_corners_none = 1 << 8,
|
||||
draw_flags_round_corners_top = draw_flags_round_corners_top_left | draw_flags_round_corners_top_right,
|
||||
draw_flags_round_corners_bottom = draw_flags_round_corners_bottom_left | draw_flags_round_corners_bottom_right,
|
||||
draw_flags_round_corners_left = draw_flags_round_corners_bottom_left | draw_flags_round_corners_top_left,
|
||||
draw_flags_round_corners_right = draw_flags_round_corners_bottom_right | draw_flags_round_corners_top_right,
|
||||
draw_flags_round_corners_all = draw_flags_round_corners_top_left | draw_flags_round_corners_top_right | draw_flags_round_corners_bottom_left | draw_flags_round_corners_bottom_right,
|
||||
draw_flags_round_corners_default = draw_flags_round_corners_all,
|
||||
draw_flags_round_corners_mask = draw_flags_round_corners_all | draw_flags_round_corners_none,
|
||||
draw_flags_shadow_cut_out_shape_background = 1 << 9
|
||||
};
|
||||
|
||||
enum mouse_button_
|
||||
{
|
||||
mouse_button_left = 0,
|
||||
mouse_button_right = 1,
|
||||
mouse_button_middle = 2,
|
||||
mouse_button_count = 5
|
||||
};
|
||||
|
||||
struct data_var_info
|
||||
{
|
||||
ImU32 count;
|
||||
ImU32 offset;
|
||||
void* get_var_ptr(void* parent) const { return (void*)((unsigned char*)parent + offset); }
|
||||
};
|
||||
|
||||
struct gui_style
|
||||
{
|
||||
float alpha;
|
||||
float disabled_alpha;
|
||||
ImVec2 window_padding;
|
||||
float window_rounding;
|
||||
float window_border_size;
|
||||
ImVec2 window_min_size;
|
||||
ImVec2 window_title_align;
|
||||
ImGuiDir window_menu_button_position;
|
||||
float child_rounding;
|
||||
float child_border_size;
|
||||
float popup_rounding;
|
||||
float popup_border_size;
|
||||
ImVec2 frame_padding;
|
||||
float frame_rounding;
|
||||
float frame_border_size;
|
||||
ImVec2 item_spacing;
|
||||
ImVec2 item_inner_spacing;
|
||||
ImVec2 cell_padding;
|
||||
ImVec2 touch_extra_padding;
|
||||
float indent_spacing;
|
||||
float columns_min_spacing;
|
||||
float scrollbar_size;
|
||||
float scrollbar_rounding;
|
||||
float grab_min_size;
|
||||
float grab_rounding;
|
||||
float log_slider_deadzone;
|
||||
float tab_rounding;
|
||||
float tab_border_size;
|
||||
float tab_min_width_for_close_button;
|
||||
float tab_bar_border_size;
|
||||
float tab_bar_overline_size;
|
||||
float table_angled_headers_angle;
|
||||
ImVec2 table_angled_headers_text_align;
|
||||
ImGuiDir color_button_position;
|
||||
ImVec2 button_text_align;
|
||||
ImVec2 selectable_text_align;
|
||||
float separator_text_border_size;
|
||||
ImVec2 separator_text_align;
|
||||
ImVec2 separator_text_padding;
|
||||
float window_shadow_size;
|
||||
ImVec2 window_shadow_offset;
|
||||
ImVec2 scrollbar_border_padding;
|
||||
float scrollbar_content_padding;
|
||||
ImVec2 display_window_padding;
|
||||
ImVec2 display_safe_area_padding;
|
||||
float mouse_cursor_scale;
|
||||
bool anti_aliased_lines;
|
||||
bool anti_aliased_lines_use_tex;
|
||||
bool anti_aliased_fill;
|
||||
float curve_tessellation_tol;
|
||||
float circle_tessellation_max_error;
|
||||
ImVec4 colors[ImGuiCol_COUNT];
|
||||
|
||||
float hover_stationary_delay;
|
||||
float hover_delay_short;
|
||||
float hover_delay_normal;
|
||||
ImGuiHoveredFlags hover_flags_for_tooltip_mouse;
|
||||
ImGuiHoveredFlags hover_flags_for_tooltip_nav;
|
||||
|
||||
gui_style();
|
||||
};
|
||||
|
||||
inline gui_style::gui_style()
|
||||
{
|
||||
alpha = 1.0f;
|
||||
disabled_alpha = 0.60f;
|
||||
window_padding = ImVec2(8, 8);
|
||||
window_rounding = 0.0f;
|
||||
window_border_size = 1.0f;
|
||||
window_min_size = ImVec2(32, 32);
|
||||
window_title_align = ImVec2(0.0f, 0.5f);
|
||||
window_menu_button_position = ImGuiDir_Left;
|
||||
child_rounding = 0.0f;
|
||||
child_border_size = 1.0f;
|
||||
popup_rounding = 0.0f;
|
||||
popup_border_size = 1.0f;
|
||||
frame_padding = ImVec2(4, 3);
|
||||
frame_rounding = 0.0f;
|
||||
frame_border_size = 0.0f;
|
||||
item_spacing = ImVec2(8, 4);
|
||||
item_inner_spacing = ImVec2(4, 4);
|
||||
cell_padding = ImVec2(4, 2);
|
||||
touch_extra_padding = ImVec2(0, 0);
|
||||
indent_spacing = 21.0f;
|
||||
columns_min_spacing = 6.0f;
|
||||
scrollbar_size = 14.0f;
|
||||
scrollbar_rounding = 9.0f;
|
||||
grab_min_size = 12.0f;
|
||||
grab_rounding = 0.0f;
|
||||
log_slider_deadzone = 4.0f;
|
||||
tab_rounding = 4.0f;
|
||||
tab_border_size = 0.0f;
|
||||
tab_min_width_for_close_button = 0.0f;
|
||||
tab_bar_border_size = 1.0f;
|
||||
tab_bar_overline_size = 2.0f;
|
||||
table_angled_headers_angle = 35.0f * (IM_PI / 180.0f);
|
||||
table_angled_headers_text_align = ImVec2(0.5f, 0.0f);
|
||||
color_button_position = ImGuiDir_Right;
|
||||
button_text_align = ImVec2(0.5f, 0.5f);
|
||||
selectable_text_align = ImVec2(0.0f, 0.0f);
|
||||
separator_text_border_size = 3.0f;
|
||||
separator_text_align = ImVec2(0.0f, 0.5f);
|
||||
separator_text_padding = ImVec2(20.0f, 3.0f);
|
||||
window_shadow_size = 100.0f;
|
||||
window_shadow_offset = ImVec2(0, 0);
|
||||
scrollbar_border_padding = ImVec2(6, 6);
|
||||
scrollbar_content_padding = 6;
|
||||
display_window_padding = ImVec2(19, 19);
|
||||
display_safe_area_padding = ImVec2(3, 3);
|
||||
mouse_cursor_scale = 1.0f;
|
||||
anti_aliased_lines = true;
|
||||
anti_aliased_lines_use_tex = true;
|
||||
anti_aliased_fill = true;
|
||||
curve_tessellation_tol = 1.25f;
|
||||
circle_tessellation_max_error = 0.30f;
|
||||
hover_stationary_delay = 0.15f;
|
||||
hover_delay_short = 0.15f;
|
||||
hover_delay_normal = 0.40f;
|
||||
hover_flags_for_tooltip_mouse = ImGuiHoveredFlags_Stationary | ImGuiHoveredFlags_DelayShort | ImGuiHoveredFlags_AllowWhenDisabled;
|
||||
hover_flags_for_tooltip_nav = ImGuiHoveredFlags_NoSharedDelay | ImGuiHoveredFlags_DelayNormal | ImGuiHoveredFlags_AllowWhenDisabled;
|
||||
|
||||
colors[style_col_text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
colors[style_col_text_disabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
colors[style_col_window_bg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);
|
||||
colors[style_col_child_bg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[style_col_popup_bg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
|
||||
colors[style_col_border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
|
||||
colors[style_col_border_shadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[style_col_frame_bg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);
|
||||
colors[style_col_frame_bg_hovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
||||
colors[style_col_frame_bg_active] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||
colors[style_col_title_bg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
||||
colors[style_col_title_bg_active] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);
|
||||
colors[style_col_title_bg_collapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
|
||||
colors[style_col_menu_bar_bg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
||||
colors[style_col_scrollbar_bg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);
|
||||
colors[style_col_scrollbar_grab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);
|
||||
colors[style_col_scrollbar_grab_hovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||
colors[style_col_scrollbar_grab_active] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);
|
||||
colors[style_col_check_mark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[style_col_slider_grab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);
|
||||
colors[style_col_slider_grab_active] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[style_col_button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
||||
colors[style_col_button_hovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[style_col_button_active] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
||||
colors[style_col_header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
|
||||
colors[style_col_header_hovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
||||
colors[style_col_header_active] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[style_col_separator] = colors[style_col_border];
|
||||
colors[style_col_separator_hovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
|
||||
colors[style_col_separator_active] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
|
||||
colors[style_col_resize_grip] = ImVec4(0.26f, 0.59f, 0.98f, 0.20f);
|
||||
colors[style_col_resize_grip_hovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||
colors[style_col_resize_grip_active] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||
colors[style_col_tab_hovered] = colors[style_col_header_hovered];
|
||||
colors[style_col_tab] = ImLerp(colors[style_col_header], colors[style_col_title_bg_active], 0.80f);
|
||||
colors[style_col_tab_selected] = ImLerp(colors[style_col_header_active], colors[style_col_title_bg_active], 0.60f);
|
||||
colors[style_col_tab_selected_overline] = colors[style_col_header_active];
|
||||
colors[style_col_tab_dimmed] = ImLerp(colors[style_col_tab], colors[style_col_title_bg], 0.80f);
|
||||
colors[style_col_tab_dimmed_selected] = ImLerp(colors[style_col_tab_selected], colors[style_col_title_bg], 0.40f);
|
||||
colors[style_col_tab_dimmed_selected_overline] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
colors[style_col_plot_lines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||
colors[style_col_plot_lines_hovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||
colors[style_col_plot_histogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||
colors[style_col_plot_histogram_hovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
||||
colors[style_col_table_header_bg] = ImVec4(0.19f, 0.19f, 0.20f, 1.00f);
|
||||
colors[style_col_table_border_strong] = ImVec4(0.31f, 0.31f, 0.35f, 1.00f);
|
||||
colors[style_col_table_border_light] = ImVec4(0.23f, 0.23f, 0.25f, 1.00f);
|
||||
colors[style_col_table_row_bg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[style_col_table_row_bg_alt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
|
||||
colors[style_col_text_link] = colors[style_col_header_active];
|
||||
colors[style_col_text_selected_bg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||
colors[style_col_drag_drop_target] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
||||
colors[style_col_nav_highlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||
colors[style_col_nav_windowing_highlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||
colors[style_col_nav_windowing_dim_bg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
|
||||
colors[style_col_modal_window_dim_bg] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||
colors[style_col_window_shadow] = ImVec4(0.08f, 0.08f, 0.08f, 0.35f);
|
||||
|
||||
}
|
||||
|
||||
static const data_var_info style_var_info[] =
|
||||
{
|
||||
{ 1, (ImU32)offsetof(gui_style, alpha) },
|
||||
{ 1, (ImU32)offsetof(gui_style, disabled_alpha) },
|
||||
{ 2, (ImU32)offsetof(gui_style, window_padding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, window_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, window_border_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, window_min_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, window_title_align) },
|
||||
{ 1, (ImU32)offsetof(gui_style, child_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, child_border_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, popup_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, popup_border_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, frame_padding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, frame_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, frame_border_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, item_spacing) },
|
||||
{ 2, (ImU32)offsetof(gui_style, item_inner_spacing) },
|
||||
{ 1, (ImU32)offsetof(gui_style, indent_spacing) },
|
||||
{ 2, (ImU32)offsetof(gui_style, cell_padding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, scrollbar_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, scrollbar_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, grab_min_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, grab_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, tab_rounding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, tab_border_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, tab_bar_border_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, tab_bar_overline_size) },
|
||||
{ 1, (ImU32)offsetof(gui_style, table_angled_headers_angle) },
|
||||
{ 2, (ImU32)offsetof(gui_style, table_angled_headers_text_align) },
|
||||
{ 2, (ImU32)offsetof(gui_style, button_text_align) },
|
||||
{ 2, (ImU32)offsetof(gui_style, selectable_text_align) },
|
||||
{ 1, (ImU32)offsetof(gui_style, separator_text_border_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, separator_text_align) },
|
||||
{ 2, (ImU32)offsetof(gui_style, separator_text_padding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, window_shadow_size) },
|
||||
{ 2, (ImU32)offsetof(gui_style, window_shadow_offset) },
|
||||
{ 2, (ImU32)offsetof(gui_style, scrollbar_border_padding) },
|
||||
{ 1, (ImU32)offsetof(gui_style, scrollbar_content_padding) },
|
||||
};
|
||||
|
||||
struct gui_style_mod
|
||||
{
|
||||
style_var var_idx;
|
||||
union { int backup_int[2]; float backup_float[2]; };
|
||||
gui_style_mod(style_var idx, int v) { var_idx = idx; backup_int[0] = v; }
|
||||
gui_style_mod(style_var idx, float v) { var_idx = idx; backup_float[0] = v; }
|
||||
gui_style_mod(style_var idx, ImVec2 v) { var_idx = idx; backup_float[0] = v.x; backup_float[1] = v.y; }
|
||||
};
|
||||
|
||||
struct gui_color_mod
|
||||
{
|
||||
style_col col;
|
||||
ImVec4 backup_value;
|
||||
};
|
||||
|
||||
inline std::vector<gui_style_mod> style_var_stack;
|
||||
inline std::vector<gui_color_mod> style_col_stack;
|
||||
|
||||
inline const data_var_info* get_style_var_info(style_var idx)
|
||||
{
|
||||
return &style_var_info[idx];
|
||||
}
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "includes.h"
|
||||
|
||||
// DayZ overlay integration: resolved relative to the executable's working
|
||||
// directory. CMake copies framework/data/uicons next to the built binary.
|
||||
inline constexpr const char* flaticon_uicons_regular_rounded_path = "data\\uicons\\uicons-regular-rounded.ttf";
|
||||
|
||||
class c_font
|
||||
{
|
||||
public:
|
||||
void update();
|
||||
|
||||
ImFont* get(const std::vector<unsigned char>& font_data, float size);
|
||||
ImFont* get_file(const std::string& file_path, float size, bool private_glyphs = false);
|
||||
|
||||
private:
|
||||
struct font_data
|
||||
{
|
||||
std::vector<unsigned char> data;
|
||||
std::string file_path;
|
||||
const void* source;
|
||||
float size;
|
||||
ImFont* font;
|
||||
bool file;
|
||||
bool private_glyphs;
|
||||
};
|
||||
|
||||
void add(const std::vector<unsigned char>& font_data, float size);
|
||||
void add_file(const std::string& file_path, float size, bool private_glyphs);
|
||||
|
||||
std::vector<font_data> data;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<c_font> font = std::make_unique<c_font>();
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
#pragma once
|
||||
#include "includes.h"
|
||||
#include <unordered_map>
|
||||
#include "widgets.h"
|
||||
#include "../headers/functions.h"
|
||||
|
||||
using namespace ImGui;
|
||||
|
||||
#define s_(...) scale_impl(__VA_ARGS__, var->gui.dpi)
|
||||
|
||||
inline ImVec2 scale_impl(const ImVec2& vec, float dpi) {
|
||||
return ImVec2(roundf(vec.x * dpi), roundf(vec.y * dpi));
|
||||
}
|
||||
|
||||
inline ImVec2 scale_impl(float x, float y, float dpi) {
|
||||
return ImVec2(roundf(x * dpi), roundf(y * dpi));
|
||||
}
|
||||
|
||||
inline float scale_impl(float var, float dpi) {
|
||||
return roundf(var * dpi);
|
||||
}
|
||||
|
||||
enum positions
|
||||
{
|
||||
pos_all,
|
||||
pos_x,
|
||||
pos_y
|
||||
};
|
||||
|
||||
enum easing_type
|
||||
{
|
||||
static_easing,
|
||||
dynamic_easing
|
||||
};
|
||||
|
||||
class c_gui
|
||||
{
|
||||
public:
|
||||
std::unordered_map<ImGuiID, void*> m_anim_states;
|
||||
|
||||
template <typename T>
|
||||
T* anim_container(ImGuiID id)
|
||||
{
|
||||
auto it = m_anim_states.find(id);
|
||||
if (it != m_anim_states.end())
|
||||
return static_cast<T*>(it->second);
|
||||
|
||||
T* new_state = new T();
|
||||
m_anim_states[id] = new_state;
|
||||
return new_state;
|
||||
}
|
||||
|
||||
float fixed_speed(float speed) { return speed / ImGui::GetIO().Framerate; }
|
||||
|
||||
template<typename T>
|
||||
T easing(T& value, T val, float speed, int type, bool dynamic_round = false)
|
||||
{
|
||||
if (type == static_easing)
|
||||
{
|
||||
if constexpr (std::is_same<T, ImVec4>::value)
|
||||
{
|
||||
return { 1.f, 1.f, 1.f, 1.f };
|
||||
}
|
||||
else
|
||||
{
|
||||
T step = fixed_speed(speed);
|
||||
|
||||
if (value < val)
|
||||
{
|
||||
value += step;
|
||||
if (value > val) value = val;
|
||||
}
|
||||
else if (value > val)
|
||||
{
|
||||
value -= step;
|
||||
if (value < val) value = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == dynamic_easing)
|
||||
{
|
||||
if constexpr (std::is_same<T, ImVec4>::value)
|
||||
{
|
||||
value = ImLerp(value, val, fixed_speed(speed));
|
||||
}
|
||||
else
|
||||
value = ImLerp(value, val + (dynamic_round ? 0.5f : 0.f), fixed_speed(speed));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool begin(std::string_view name, bool* p_open = nullptr, window_flags flags = window_flags_none);
|
||||
|
||||
void end();
|
||||
|
||||
void push_color(style_col idx, ImU32 col);
|
||||
|
||||
void pop_color(int count = 1);
|
||||
|
||||
void push_var(style_var idx, float val);
|
||||
|
||||
void push_var(style_var idx, const ImVec2& val);
|
||||
|
||||
void pop_var(int count = 1);
|
||||
|
||||
void push_font(ImFont* font);
|
||||
|
||||
void pop_font();
|
||||
|
||||
void set_pos(const ImVec2& pos, int type);
|
||||
|
||||
void set_pos(float pos, int type);
|
||||
|
||||
ImVec2 get_pos();
|
||||
|
||||
void set_screen_pos(const ImVec2& pos, int type);
|
||||
|
||||
void set_screen_pos(float pos, int type);
|
||||
|
||||
ImVec2 get_screen_pos();
|
||||
|
||||
void begin_group();
|
||||
|
||||
void end_group();
|
||||
|
||||
void begin_content(std::string_view id, const ImVec2& size, const ImVec2& padding = ImVec2(0, 0), const ImVec2& spacing = ImVec2(0, 0), window_flags window_flags__ = 0, child_flags child_flags__ = 0);
|
||||
|
||||
void end_content();
|
||||
|
||||
void sameline(float offset_from_start_x = 0.f, float spacing_w = -1.f);
|
||||
|
||||
void dummy(const ImVec2& size);
|
||||
|
||||
bool begin_def_child(std::string_view name, const ImVec2& size_arg = ImVec2(0, 0), child_flags child_flags = 0, window_flags window_flags = 0);
|
||||
|
||||
void end_def_child();
|
||||
|
||||
void set_next_window_pos(const ImVec2& pos, gui_cond cond = 0, const ImVec2& pivot = ImVec2(0, 0));
|
||||
|
||||
void set_next_window_size(const ImVec2& size, gui_cond cond = 0);
|
||||
|
||||
ImVec2 text_size(ImFont* font, const char* text, const char* text_end = nullptr, bool hide_text_after_double_hash = false, float wrap_width = -1.f);
|
||||
|
||||
ImVec2 window_size();
|
||||
|
||||
float window_width();
|
||||
|
||||
float window_height();
|
||||
|
||||
ImDrawList* window_drawlist();
|
||||
|
||||
ImDrawList* foreground_drawlist();
|
||||
|
||||
ImDrawList* background_drawlist();
|
||||
|
||||
ImVec2 window_pos();
|
||||
|
||||
ImGuiWindow* get_window();
|
||||
|
||||
void push_id(const char* str_id);
|
||||
|
||||
void push_id(const char* str_id_begin, const char* str_id_end);
|
||||
|
||||
void push_id(const void* ptr_id);
|
||||
|
||||
void push_id(int int_id);
|
||||
|
||||
void pop_id();
|
||||
|
||||
ImGuiID get_id(const char* str, const char* str_end);
|
||||
|
||||
ImGuiID get_id(const void* ptr);
|
||||
|
||||
ImGuiID get_id(int n);
|
||||
|
||||
ImVec2 content_avail();
|
||||
|
||||
ImVec2 content_max();
|
||||
|
||||
void item_size(const ImVec2& size, float text_baseline_y = -1.f);
|
||||
|
||||
void item_size(const ImRect& bb, float text_baseline_y = -1.f);
|
||||
|
||||
bool item_add(const ImRect& bb, ImGuiID id, const ImRect* nav_bb_arg = NULL, ImGuiItemFlags extra_flags = 0);
|
||||
|
||||
bool is_window_hovered(ImGuiHoveredFlags flags);
|
||||
|
||||
bool is_window_focused(ImGuiFocusedFlags flags);
|
||||
|
||||
void set_window_focus();
|
||||
|
||||
void set_window_focus(const char* name);
|
||||
|
||||
bool is_rect_visible(const ImVec2& size);
|
||||
|
||||
bool is_rect_visible(const ImRect& rect);
|
||||
|
||||
ImVec2 adjust_window_pos(const ImVec2& rect, const ImVec2& window_size);
|
||||
|
||||
bool button_behavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||
|
||||
bool invisible_button(const char* str_id, const ImVec2& size_arg, mouse_button flags = 0);
|
||||
|
||||
ImVec4 u32_to_float4(ImU32 in);
|
||||
|
||||
ImU32 float4_to_u32(const ImVec4& in);
|
||||
|
||||
void rgb_to_hsv(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
||||
|
||||
void hsv_to_rgb(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
||||
|
||||
bool item_hoverable(const ImRect& bb, ImGuiID id, ImGuiItemFlags item_flags = 0);
|
||||
|
||||
bool is_item_hovered(ImGuiHoveredFlags flags);
|
||||
|
||||
bool is_item_active();
|
||||
|
||||
bool is_item_clicked(mouse_button mouse_button);
|
||||
|
||||
bool mouse_down(mouse_button button);
|
||||
|
||||
bool mouse_clicked(mouse_button button, bool repeat = false);
|
||||
|
||||
bool mouse_released(mouse_button button);
|
||||
|
||||
bool mouse_double_clicked(mouse_button button);
|
||||
|
||||
const char* text_end(const char* text);
|
||||
|
||||
template<typename T>
|
||||
const char* get_fmt(char* text, T* value, std::string_view fmt)
|
||||
{
|
||||
ImFormatString(text, IM_ARRAYSIZE(text), fmt.data(), *value);
|
||||
return text + strlen(text);
|
||||
}
|
||||
|
||||
bool is_window_cond(ImGuiWindow* window, const std::vector<std::string>& names);
|
||||
|
||||
ImVec2 mouse_pos();
|
||||
|
||||
void set_style();
|
||||
|
||||
void draw_decorations();
|
||||
|
||||
void initialize();
|
||||
|
||||
void render();
|
||||
|
||||
ImRect get_item_rect();
|
||||
};
|
||||
|
||||
inline std::unique_ptr<c_gui> gui = std::make_unique<c_gui>();
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_internal.h"
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "flags.h"
|
||||
#include "../settings/colors.h"
|
||||
#include "../settings/elements.h"
|
||||
#include "../settings/variables.h"
|
||||
#include "fonts.h"
|
||||
#include "draw.h"
|
||||
#include "functions.h"
|
||||
#include "../data/fonts.h"
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
#include "includes.h"
|
||||
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
|
||||
struct custom_slider_t
|
||||
{
|
||||
bool held;
|
||||
c_rect rect;
|
||||
c_rect active;
|
||||
c_vec2 circle_pos;
|
||||
};
|
||||
|
||||
enum title_status_icon
|
||||
{
|
||||
title_status_none = 0,
|
||||
title_status_danger,
|
||||
title_status_warning,
|
||||
title_status_safe
|
||||
};
|
||||
|
||||
enum keybind_mode
|
||||
{
|
||||
keybind_mode_hold = 0,
|
||||
keybind_mode_toggle,
|
||||
keybind_mode_always
|
||||
};
|
||||
|
||||
struct keybind_t
|
||||
{
|
||||
int key = ImGuiKey_None;
|
||||
bool ctrl = false;
|
||||
bool shift = false;
|
||||
bool alt = false;
|
||||
bool super = false;
|
||||
int mode = keybind_mode_hold;
|
||||
bool capturing = false;
|
||||
};
|
||||
|
||||
class c_widgets
|
||||
{
|
||||
public:
|
||||
bool tab_button(std::string name, std::string icon, int tab);
|
||||
bool sub_tab_button(std::string name, std::string icon, int tab, float width = 0.f);
|
||||
void brand_header(std::string name, std::string subtitle);
|
||||
bool profile_dropdown(std::string name, std::string status);
|
||||
bool primary_button(std::string name, std::string icon = "");
|
||||
bool action_button(std::string name, std::string icon = "");
|
||||
bool card_button(std::string name, std::string description, std::string button_text = "Run");
|
||||
bool category_button(std::string name, std::string description, bool* callback);
|
||||
bool child(std::string name);
|
||||
void end_child();
|
||||
bool checkbox(std::string name, std::string description, bool* callback, title_status_icon status = title_status_none);
|
||||
bool keybind(std::string name, std::string description, keybind_t* bind);
|
||||
bool dropdown(std::string name, std::string description, int* callback, std::vector<std::string> variants);
|
||||
bool slider(std::string name, std::string description, float* callback, float vmin, float vmax, std::string format = "%.1f");
|
||||
custom_slider_t custom_slider(std::string name, float* callback, float vmin, float vmax, float width);
|
||||
bool color_picker(std::string name, c_vec4* color);
|
||||
bool text_field(std::string name, char* buf, int buf_size, bool password = false, std::string icon = "");
|
||||
bool search_field(std::string name, char* buf, int buf_size, const c_vec2& size);
|
||||
};
|
||||
|
||||
inline std::unique_ptr<c_widgets> widgets = std::make_unique<c_widgets>();
|
||||
|
||||
enum notify_type
|
||||
{
|
||||
success = 0,
|
||||
warning = 1,
|
||||
error = 2
|
||||
};
|
||||
|
||||
struct notify_state
|
||||
{
|
||||
int notify_id;
|
||||
std::string title;
|
||||
std::string text;
|
||||
notify_type type{ success };
|
||||
|
||||
ImVec2 window_size{ 0, 0 };
|
||||
float notify_alpha{ 0 };
|
||||
bool active_notify{ true };
|
||||
float notify_timer{ 0 };
|
||||
float notify_pos{ 0 };
|
||||
float notify_slide{ 28 };
|
||||
};
|
||||
|
||||
class c_notify
|
||||
{
|
||||
public:
|
||||
void setup_notify();
|
||||
|
||||
void add_notify(std::string title, std::string text, notify_type type);
|
||||
|
||||
private:
|
||||
ImVec2 render_notify(float notify_alpha, float notify_percentage, float notify_pos, float notify_slide, const std::string& title, const std::string& text, notify_type type);
|
||||
|
||||
float notify_time{ 2.65f };
|
||||
int notify_count{ 0 };
|
||||
|
||||
float notify_spacing{ 8 };
|
||||
ImVec2 notify_padding{ 16, 16 };
|
||||
|
||||
std::vector<notify_state> notifications;
|
||||
|
||||
};
|
||||
|
||||
inline std::unique_ptr<c_notify> notify = std::make_unique<c_notify>();
|
||||
Reference in New Issue
Block a user