Skip to content

Commit aa997c3

Browse files
committed
misc
- Refactor `GridRenderer` to support toggles with "options" buttons. - Refactor `AddBoolCommand` and `AddLoopedCommand` methods in the `Tab` class. - Fix missing title bar colors in the `Theme` struct.
1 parent 1e483fd commit aa997c3

18 files changed

Lines changed: 1028 additions & 995 deletions

File tree

SSV2/includes/classes/gta/fVector3.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ local __base_fields__ <const> = {
1313
z = 0x8
1414
}
1515

16+
---@param ptr pointer
17+
local function ptr_to_vec3(ptr)
18+
return vec3:new(
19+
ptr:add(0x0):get_float(),
20+
ptr:add(0x4):get_float(),
21+
ptr:add(0x8):get_float()
22+
)
23+
end
24+
1625
--------------------------------------
1726
-- Class: fVector3
1827
--------------------------------------
@@ -26,7 +35,7 @@ local __base_fields__ <const> = {
2635
---@field public x float
2736
---@field public y float
2837
---@field public z float
29-
---@field public new fun(ptr: pointer): fVector3 -- static
38+
---@field public new fun(ptr: pointer): fVector3 -- static func
3039
---@field public as_vec3 fun(self: fVector3): vec3 -- method
3140
---@overload fun(ptr: pointer): fVector3
3241
local fVector3 <const> = setmetatable({}, {
@@ -46,13 +55,7 @@ function fVector3:__index(key)
4655
end
4756

4857
if (key == "as_vec3") then
49-
return function()
50-
return vec3:new(
51-
ptr:add(0x0):get_float(),
52-
ptr:add(0x4):get_float(),
53-
ptr:add(0x8):get_float()
54-
)
55-
end
58+
return ptr_to_vec3(ptr)
5659
end
5760

5861
---@diagnostic disable-next-line: param-type-mismatch

SSV2/includes/data/theme_library.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ local ThemeLibrary <const> = {
1818
PopupBg = vec4:new(0.03, 0.03, 0.04, 0.94),
1919
Border = vec4:new(0.24, 0.18, 0.18, 0.85),
2020

21+
TitleBg = vec4:new(0.03, 0.03, 0.04, 0.94),
22+
TitleBgActive = vec4:new(0.03, 0.03, 0.04, 0.94),
23+
TitleBgCollapsed = vec4:new(0.03, 0.03, 0.04, 0.94),
24+
2125
ScrollbarBg = vec4:new(0.11, 0.12, 0.13, 0.94),
2226
ScrollbarGrab = vec4:new(0.20, 0.22, 0.25, 0.80),
2327
ScrollbarGrabHovered = vec4:new(0.27, 0.30, 0.34, 0.90),
@@ -77,6 +81,10 @@ local ThemeLibrary <const> = {
7781
PopupBg = vec4:new(0.05, 0.06, 0.07, 0.96),
7882
Border = vec4:new(0.20, 0.22, 0.25, 0.90),
7983

84+
TitleBg = vec4:new(0.05, 0.06, 0.07, 0.96),
85+
TitleBgActive = vec4:new(0.05, 0.06, 0.07, 0.96),
86+
TitleBgCollapsed = vec4:new(0.05, 0.06, 0.07, 0.96),
87+
8088
ScrollbarBg = vec4:new(0.11, 0.12, 0.13, 0.94),
8189
ScrollbarGrab = vec4:new(0.20, 0.22, 0.25, 0.80),
8290
ScrollbarGrabHovered = vec4:new(0.27, 0.30, 0.34, 0.90),
@@ -136,6 +144,10 @@ local ThemeLibrary <const> = {
136144
PopupBg = vec4:new(0.03, 0.10, 0.12, 1.00),
137145
Border = vec4:new(0.20, 0.22, 0.25, 0.90),
138146

147+
TitleBg = vec4:new(0.03, 0.10, 0.12, 1.00),
148+
TitleBgActive = vec4:new(0.03, 0.10, 0.12, 1.00),
149+
TitleBgCollapsed = vec4:new(0.03, 0.10, 0.12, 1.00),
150+
139151
ScrollbarBg = vec4:new(0.11, 0.12, 0.13, 0.94),
140152
ScrollbarGrab = vec4:new(0.20, 0.22, 0.25, 0.80),
141153
ScrollbarGrabHovered = vec4:new(0.27, 0.30, 0.34, 0.90),
@@ -198,6 +210,10 @@ local ThemeLibrary <const> = {
198210
PopupBg = vec4:new(0.06, 0.05, 0.11, 0.98),
199211
Border = vec4:new(0.75, 0.55, 0.95, 0.55),
200212

213+
TitleBg = vec4:new(0.06, 0.05, 0.11, 0.98),
214+
TitleBgActive = vec4:new(0.06, 0.05, 0.11, 0.98),
215+
TitleBgCollapsed = vec4:new(0.06, 0.05, 0.11, 0.98),
216+
201217
ScrollbarBg = vec4:new(0.10, 0.10, 0.10, 1.00),
202218
ScrollbarGrab = vec4:new(0.50, 0.00, 0.50, 1.00),
203219
ScrollbarGrabHovered = vec4:new(0.50, 0.00, 0.50, 0.95),
@@ -257,6 +273,10 @@ local ThemeLibrary <const> = {
257273
PopupBg = vec4:new(0.06, 0.04, 0.06, 0.90),
258274
Border = vec4:new(1.00, 0.38, 0.33, 1.00),
259275

276+
TitleBg = vec4:new(0.06, 0.04, 0.06, 0.90),
277+
TitleBgActive = vec4:new(0.06, 0.04, 0.06, 0.90),
278+
TitleBgCollapsed = vec4:new(0.06, 0.04, 0.06, 0.90),
279+
260280
ScrollbarBg = vec4:new(0.23, 0.07, 0.09, 1.00),
261281
ScrollbarGrab = vec4:new(0.95, 0.30, 0.28, 0.80),
262282
ScrollbarGrabHovered = vec4:new(0.95, 0.30, 0.28, 0.90),
@@ -316,6 +336,10 @@ local ThemeLibrary <const> = {
316336
PopupBg = vec4:new(0.85, 0.85, 0.85, 0.90),
317337
Border = vec4:new(0.15, 0.15, 0.15, 1.00),
318338

339+
TitleBg = vec4:new(0.85, 0.85, 0.85, 0.90),
340+
TitleBgActive = vec4:new(0.85, 0.85, 0.85, 0.90),
341+
TitleBgCollapsed = vec4:new(0.85, 0.85, 0.85, 0.90),
342+
319343
ScrollbarBg = vec4:new(0.87, 0.87, 0.87, 1.00),
320344
ScrollbarGrab = vec4:new(0.75, 0.78, 0.82, 1.00),
321345
ScrollbarGrabHovered = vec4:new(0.70, 0.73, 0.77, 1.00),
@@ -375,6 +399,10 @@ local ThemeLibrary <const> = {
375399
PopupBg = vec4:new(0.07, 0.06, 0.07, 0.92),
376400
Border = vec4:new(0.96, 0.95, 0.96, 1.00),
377401

402+
TitleBg = vec4:new(0.07, 0.06, 0.07, 0.92),
403+
TitleBgActive = vec4:new(0.07, 0.06, 0.07, 0.92),
404+
TitleBgCollapsed = vec4:new(0.07, 0.06, 0.07, 0.92),
405+
378406
ScrollbarBg = vec4:new(0.09, 0.08, 0.09, 0.95),
379407
ScrollbarGrab = vec4:new(0.22, 0.05, 0.08, 0.82),
380408
ScrollbarGrabHovered = vec4:new(0.30, 0.07, 0.12, 0.92),
@@ -434,6 +462,10 @@ local ThemeLibrary <const> = {
434462
PopupBg = vec4:new(0.96, 0.97, 0.99, 0.95),
435463
Border = vec4:new(0.10, 0.12, 0.15, 0.90),
436464

465+
TitleBg = vec4:new(0.96, 0.97, 0.99, 0.95),
466+
TitleBgActive = vec4:new(0.96, 0.97, 0.99, 0.95),
467+
TitleBgCollapsed = vec4:new(0.96, 0.97, 0.99, 0.95),
468+
437469
ScrollbarBg = vec4:new(0.93, 0.95, 0.98, 1.00),
438470
ScrollbarGrab = vec4:new(0.55, 0.65, 0.85, 1.00),
439471
ScrollbarGrabHovered = vec4:new(0.50, 0.60, 0.80, 1.00),
@@ -493,6 +525,10 @@ local ThemeLibrary <const> = {
493525
PopupBg = vec4:new(0.06, 0.08, 0.07, 0.92),
494526
Border = vec4:new(0.92, 0.95, 0.93, 1.00),
495527

528+
TitleBg = vec4:new(0.06, 0.08, 0.07, 0.92),
529+
TitleBgActive = vec4:new(0.06, 0.08, 0.07, 0.92),
530+
TitleBgCollapsed = vec4:new(0.06, 0.08, 0.07, 0.92),
531+
496532
ScrollbarBg = vec4:new(0.08, 0.10, 0.09, 0.95),
497533
ScrollbarGrab = vec4:new(0.10, 0.20, 0.16, 0.85),
498534
ScrollbarGrabHovered = vec4:new(0.14, 0.28, 0.21, 0.95),
@@ -552,6 +588,10 @@ local ThemeLibrary <const> = {
552588
PopupBg = vec4:new(0.06, 0.06, 0.07, 0.94),
553589
Border = vec4:new(0.92, 0.90, 0.86, 1.00),
554590

591+
TitleBg = vec4:new(0.06, 0.06, 0.07, 0.94),
592+
TitleBgActive = vec4:new(0.06, 0.06, 0.07, 0.94),
593+
TitleBgCollapsed = vec4:new(0.06, 0.06, 0.07, 0.94),
594+
555595
ScrollbarBg = vec4:new(0.08, 0.08, 0.09, 0.96),
556596
ScrollbarGrab = vec4:new(0.16, 0.15, 0.13, 0.85),
557597
ScrollbarGrabHovered = vec4:new(0.22, 0.21, 0.18, 0.95),

SSV2/includes/frontend/self/player_abilities.lua

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
-- * Credit the owner and contributors.
77
-- * Provide a copy of or a link to the original license (GPL-3.0 or later); see LICENSE.md or <https://www.gnu.org/licenses/>.
88

9-
local charName = ""
9+
1010
local PStats <const> = {
1111
{ label = "SELF_ABILITY_STAM", stat_1 = "MPX_STAMINA", stat_2 = "MPX_SCRIPT_INCREASE_STAM", incr_val = 1, func = stats.get_int },
1212
{ label = "SELF_ABILITY_SHOOTING", stat_1 = "MPX_SHOOTING_ABILITY", stat_2 = "MPX_SCRIPT_INCREASE_SHO", incr_val = 1, func = stats.get_int },
@@ -58,16 +58,6 @@ local function DrawAblityControls(label, read_func, read_stat, incr_stat, incr_v
5858
end
5959

6060
return function()
61-
ThreadManager:Run(function()
62-
charName = LocalPlayer:GetCharacterName()
63-
end)
64-
65-
ImGui.SetWindowFontScale(1.17)
66-
local charNameWidth = ImGui.CalcTextSize(charName)
67-
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + (ImGui.GetContentRegionAvail() - charNameWidth) * 0.5)
68-
ImGui.Text(charName)
69-
ImGui.SetWindowFontScale(1.0)
70-
7161
ImGui.PushButtonRepeat(true)
7262
for i, v in ipairs(PStats) do
7363
ImGui.PushID(i)

0 commit comments

Comments
 (0)