var time, delay, fillbar, shotsfired, dt = {alpha: 0};
var screen_size = Render.GetScreenSize()
UI.AddSliderInt('X offset [DT indicator]', 0, Render.GetScreenSize()[0]);
UI.AddSliderInt('Y offset [DT indicator]', 0, Render.GetScreenSize()[1]);
UI.AddSliderInt('X offset [Text]', 0, Render.GetScreenSize()[0]);
UI.AddSliderInt('Y offset [Text]', 0, Render.GetScreenSize()[1]);
offset_ind = [UI.GetValue("X offset [DT indicator]"), UI.GetValue("Y offset [DT indicator]")];
if(!offset_ind[0] && !offset_ind[1]) { UI.SetValue('X offset [DT indicator]', screen_size[0] - 246); UI.SetValue('Y offset [DT indicator]', 5) }
offset_text = [UI.GetValue("X offset [Text]"), UI.GetValue("Y offset [Text]")];
if(!offset_text[0] && !offset_text[1]) { UI.SetValue('X offset [Text]', 15); UI.SetValue('Y offset [Text]', screen_size[1] /1.25) }
rel_start = void 0
const math = {
clamp(val, min, max) { return Math.min(Math.max(val, min), max) },
lerp(start, end, t) { return start * (1 - t) + end * t },
}
//Draw
function dt_indicator() {
const anim_factor = [(1 / .15) * Globals.Frametime()]
const isDoubletap = UI.IsHotkeyActive("Rage", "GENERAL", "Exploits", "Doubletap")
if(isDoubletap) {
dt.alpha = math.clamp(dt.alpha + anim_factor[0], 0, 1)
}
if(!isDoubletap) {
dt.alpha = math.clamp(dt.alpha - anim_factor[0], 0, 1)
}
const font = Render.AddFont("Verdana", 7, 500);
const big_font = Render.AddFont("Verdana", 16 * dt.alpha, 100);
const text = "DT [v2.0.9 beta] | tickbase(0): 0 | state: 0"
if(Exploit.GetCharge() > 0.5) {
text = "DT [v2.0.9 beta] | tickbase (1): " + Math.round(16 * Exploit.GetCharge()) + " | state: " + Math.round(2 * Exploit.GetCharge())
}
const gap = 10
const w = Render.TextSizeCustom(text, font)[0] + gap
const h = Render.TextSizeCustom(text, font)[1] + gap
offset_ind = [UI.GetValue("X offset [DT indicator]"), UI.GetValue("Y offset [DT indicator]")]
offset_text = [UI.GetValue("X offset [Text]"), UI.GetValue("Y offset [Text]")]
offset_ind[0] -= w
offset_ind[0] += 243
if(dt.alpha !=0) {
Render.FilledRect(offset_ind[0], offset_ind[1], w, h, [15, 15, 15, 255 * dt.alpha]);
Render.FilledRect(offset_ind[0], offset_ind[1] -1 + h - h * Exploit.GetCharge(), 2, 2+ h * Exploit.GetCharge(), [255 * Exploit.GetCharge(), 50, 60, 255 * dt.alpha]);
Render.StringCustom(offset_ind[0] + gap/2, offset_ind[1] + h/5, 0, text, [255, 255, 255, 255 * dt.alpha], font)
Render.StringCustom(offset_text[0] + 16 - 15*dt.alpha, offset_text[1] + 16 - 15*dt.alpha, 0, "DT", [0, 0, 0, 255 * dt.alpha], big_font)
Render.StringCustom(offset_text[0] + 15 - 15*dt.alpha, offset_text[1] + 15 - 15*dt.alpha, 0, "DT", [255, 255 * Exploit.GetCharge(), 255 * Exploit.GetCharge(), 255 * dt.alpha], big_font)
}
const drag_indicator = function() {
var cursor, rel;
if(!(UI.IsMenuOpen() && Input.IsKeyPressed(0x01))) { return rel_start = void 0 }
cursor = Input.GetCursorPosition();
rel = [cursor[0] - offset_ind[0], cursor[1] - offset_ind[1]];
if(!rel_start && (rel[0] < 0 || rel[0] > w || rel[1] < 0 || rel[1] > h)) { return }
if(!rel_start) { rel_start = rel }
offset_ind = [cursor[0] - rel_start[0], cursor[1] - rel_start[1]];
UI.SetValue("X offset [DT indicator]", offset_ind[0]);
return UI.SetValue("Y offset [DT indicator]", offset_ind[1]);
}
const drag_text = function() {
var cursor2, rel2;
if(!(UI.IsMenuOpen() && Input.IsKeyPressed(0x01))) { return rel_start2 = void 0 }
cursor2 = Input.GetCursorPosition();
rel2 = [cursor2[0] - offset_text[0], cursor2[1] - offset_text[1]];
if(!rel_start2 && (rel2[0] < 0 || rel2[0] > Render.TextSizeCustom("DT", big_font)[0] || rel2[1] < 0 || rel2[1] > Render.TextSizeCustom("DT", big_font)[1])) { return }
if(!rel_start2) { rel_start2 = rel2 }
offset_text = [cursor2[0] - rel_start2[0], cursor2[1] - rel_start2[1]];
UI.SetValue("X offset [Text]", offset_text[0]);
return UI.SetValue("Y offset [Text]", offset_text[1]);
}
drag_indicator();
drag_text();
}
Global.RegisterCallback("Draw", "dt_indicator");