mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-25 12:58:06 -08:00
Add use_d2d_if_available option
This commit is contained in:
@@ -98,7 +98,7 @@ function env_creature.update(REcreature, creature)
|
||||
end
|
||||
|
||||
function env_creature.draw(creature, position_on_screen, opacity_scale)
|
||||
if d2d ~= nil then
|
||||
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||
local text_width, text_height = drawing.font:measure(creature.name);
|
||||
position_on_screen.x = position_on_screen.x - text_width / 2;
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ function screen.update_window_size()
|
||||
local width;
|
||||
local height;
|
||||
|
||||
if d2d ~= nil then
|
||||
if d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available then
|
||||
width, height = d2d.surface_size();
|
||||
else
|
||||
width, height = screen.get_game_window_size();
|
||||
|
||||
@@ -33,11 +33,11 @@ function config.init()
|
||||
prioritize_large_monsters = false
|
||||
},
|
||||
|
||||
module_visibility = {
|
||||
in_lobby = {
|
||||
endemic_life_UI = false
|
||||
},
|
||||
renderer = {
|
||||
use_d2d_if_available = true
|
||||
},
|
||||
|
||||
module_visibility = {
|
||||
in_training_area = {
|
||||
large_monster_dynamic_UI = true,
|
||||
large_monster_static_UI = true,
|
||||
|
||||
@@ -172,6 +172,9 @@ language.default_language = {
|
||||
bold = "Bold",
|
||||
italic = "Italic",
|
||||
|
||||
renderer = "Renderer",
|
||||
use_d2d_if_available = "Use Direct2D if available",
|
||||
|
||||
enabled = "Enabled",
|
||||
settings = "Settings",
|
||||
dynamic_positioning = "Dynamic Positioning",
|
||||
@@ -422,7 +425,7 @@ language.default_language = {
|
||||
lowest_health_percentage = "Lowest Health Percentage",
|
||||
highest_health_percentage = "Highest Health Percentage",
|
||||
|
||||
reframework_outdated = "Installed REFramework version is outdated. Please, update. Otherwise, MHR Overlay won't work correctly."
|
||||
reframework_outdated = "Installed REFramework version is outdated. Please, update. Otherwise, MHR Overlay won't work correctly.",
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -760,16 +760,17 @@ function customization_menu.draw_global_settings()
|
||||
imgui.tree_pop();
|
||||
end
|
||||
|
||||
if imgui.tree_node(language.current_language.customization_menu.renderer) then
|
||||
changed, cached_config.renderer.use_d2d_if_available =
|
||||
imgui.checkbox(language.current_language.customization_menu.use_d2d_if_available,
|
||||
cached_config.renderer.use_d2d_if_available);
|
||||
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
imgui.tree_pop();
|
||||
end
|
||||
|
||||
if imgui.tree_node(language.current_language.customization_menu.module_visibility_based_on_game_state) then
|
||||
if imgui.tree_node(language.current_language.customization_menu.in_lobby) then
|
||||
|
||||
changed, cached_config.module_visibility.in_lobby.endemic_life_UI = imgui.checkbox(
|
||||
language.current_language.customization_menu.endemic_life_UI,
|
||||
cached_config.module_visibility.in_lobby.endemic_life_UI);
|
||||
|
||||
config_changed = config_changed or changed;
|
||||
imgui.tree_pop();
|
||||
end
|
||||
|
||||
if imgui.tree_node(language.current_language.customization_menu.in_training_area) then
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ function drawing.argb_to_color(alpha, red, green, blue)
|
||||
end
|
||||
|
||||
function drawing.limit_text_size(text, size_limit)
|
||||
if d2d == nil or size_limit <= 0 then
|
||||
if d2d == nil or not config.current_config.global_settings.renderer.use_d2d_if_available or size_limit <= 0 then
|
||||
return text;
|
||||
end
|
||||
|
||||
@@ -98,6 +98,8 @@ function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
local position_x = position.x + label.offset.x;
|
||||
local position_y = position.y + label.offset.y;
|
||||
|
||||
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
|
||||
|
||||
if label.shadow.visibility then
|
||||
local new_shadow_color = label.shadow.color;
|
||||
|
||||
@@ -105,7 +107,7 @@ function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
new_shadow_color = drawing.scale_color_opacity(new_shadow_color, opacity_scale);
|
||||
end
|
||||
|
||||
if d2d ~= nil then
|
||||
if use_d2d then
|
||||
d2d.text(drawing.font, text, position_x + label.shadow.offset.x, position_y + label.shadow.offset.y, new_shadow_color);
|
||||
else
|
||||
new_shadow_color = drawing.argb_color_to_abgr_color(new_shadow_color);
|
||||
@@ -118,7 +120,7 @@ function drawing.draw_label(label, position, opacity_scale, ...)
|
||||
new_color = drawing.scale_color_opacity(new_color, opacity_scale);
|
||||
end
|
||||
|
||||
if d2d ~= nil then
|
||||
if use_d2d then
|
||||
d2d.text(drawing.font, text, position_x, position_y, new_color);
|
||||
else
|
||||
new_color = drawing.argb_color_to_abgr_color(new_color);
|
||||
@@ -230,7 +232,7 @@ function drawing.draw_bar(bar, position, opacity_scale, percentage)
|
||||
outline_color = drawing.scale_color_opacity(outline_color, opacity_scale);
|
||||
end
|
||||
|
||||
local use_d2d = d2d ~= nil;
|
||||
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
|
||||
|
||||
-- outline
|
||||
if outline_thickness ~= 0 then
|
||||
@@ -281,7 +283,9 @@ function drawing.draw_capture_line(health_UI, position, opacity_scale, percentag
|
||||
color = drawing.scale_color_opacity(color, opacity_scale);
|
||||
end
|
||||
|
||||
if d2d ~= nil then
|
||||
local use_d2d = d2d ~= nil and config.current_config.global_settings.renderer.use_d2d_if_available;
|
||||
|
||||
if use_d2d then
|
||||
d2d.fill_rect(position_x, position_y, health_UI.bar.capture_line.size.width, health_UI.bar.capture_line.size.height,
|
||||
color);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user