@@ -25,63 +25,65 @@ void Options::DrawOptions() noexcept
25
25
26
26
if (ImGui::CollapsingHeader (" General" ))
27
27
{
28
- DrawOption ( " DisableIntro " , " Disable legal screen and intros" );
29
- DrawOption (" NoCinematicBars" , " Disable cinematic bars" );
30
- DrawOption (" NoMotionBlur" , " Disable motion blur" );
28
+ DrawComboOption ( " IntroSkip " , " Legal screen and intros " , { " Don't skip " , " Skip legal" , " Skip legal and intros" } );
29
+ DrawCheckOption (" NoCinematicBars" , " Disable cinematic bars" );
30
+ DrawCheckOption (" NoMotionBlur" , " Disable motion blur" );
31
31
}
32
32
33
33
if (ImGui::CollapsingHeader (" Camera" ))
34
34
{
35
- DrawOption (" CameraSlowSpeed" , " Slow speed" , 0 .f , 1000 .f );
36
- DrawOption (" CameraNormalSpeed" , " Normal speed" , 0 .f , 1000 .f );
37
- DrawOption (" CameraFastSpeed" , " Fast speed" , 0 .f , 1000 .f );
38
- DrawOption (" CameraRollSpeed" , " Roll speed" , 0 .f , 1 .f );
35
+ DrawSliderOption (" CameraSlowSpeed" , " Slow speed" , 0 .f , 1000 .f );
36
+ DrawSliderOption (" CameraNormalSpeed" , " Normal speed" , 0 .f , 1000 .f );
37
+ DrawSliderOption (" CameraFastSpeed" , " Fast speed" , 0 .f , 1000 .f );
38
+ DrawSliderOption (" CameraRollSpeed" , " Roll speed" , 0 .f , 1 .f );
39
39
}
40
40
41
41
if (ImGui::CollapsingHeader (" Controls" ))
42
42
{
43
- DrawOption (" SkewSpeed" , " Vertical skew speed" , 0 .f , 1000 .f );
43
+ DrawSliderOption (" SkewSpeed" , " Vertical skew speed" , 0 .f , 1000 .f );
44
44
}
45
45
46
46
ImGui::End ();
47
47
}
48
48
49
- void Options::DrawOption (const char * name, const char * description, float min, float max ) const noexcept
49
+ void Options::DrawCheckOption (const char * name, const char * description) const noexcept
50
50
{
51
- // TODO use a map for better performance
52
- for (auto & option : m_options)
51
+ auto option = FindOption (name);
52
+ if (option == nullptr ) return ;
53
+
54
+ if (ImGui::Checkbox (description, (bool *)option->GetValuePtr ()))
53
55
{
54
- if (option->GetName () == name)
55
- {
56
- DrawOption (option, description, min, max);
57
- }
56
+ option->SaveValue ();
58
57
}
59
58
}
60
59
61
- void Options::DrawOption (BaseOption* option , const char * description, float min, float max) const noexcept
60
+ void Options::DrawSliderOption ( const char * name , const char * description, float min, float max) const noexcept
62
61
{
63
- auto type = option->GetType ();
62
+ auto option = FindOption (name);
63
+ if (option == nullptr ) return ;
64
64
65
- if (type == typeid ( bool ). hash_code ( ))
65
+ if (ImGui::SliderFloat (description, ( float *)option-> GetValuePtr (), min, max ))
66
66
{
67
- if (ImGui::Checkbox (description, (bool *)option->GetValuePtr ()))
68
- {
69
- option->SaveValue ();
70
- }
67
+ option->SaveValue ();
71
68
}
69
+ }
70
+
71
+ void Options::DrawComboOption (const char * name, const char * description, std::vector<const char *> items) const noexcept
72
+ {
73
+ auto option = FindOption (name);
74
+ if (option == nullptr ) return ;
75
+
76
+ auto value = (int *)option->GetValuePtr ();
72
77
73
- if (type == typeid ( float ). hash_code ( ))
78
+ if (ImGui::Combo (description, value, items. data (), items. size () ))
74
79
{
75
- if (ImGui::SliderFloat (description, (float *)option->GetValuePtr (), min, max))
76
- {
77
- option->SaveValue ();
78
- }
80
+ option->SaveValue ();
79
81
}
80
82
}
81
83
82
- void Options::Show ( ) noexcept
84
+ void Options::SetVisible ( bool visible ) noexcept
83
85
{
84
- m_show = true ;
86
+ m_show = visible ;
85
87
}
86
88
87
89
void Options::AddOption (BaseOption* option)
@@ -90,4 +92,18 @@ void Options::AddOption(BaseOption* option)
90
92
91
93
// Load the value from the registry
92
94
option->LoadValue ();
95
+ }
96
+
97
+ BaseOption* Options::FindOption (const char * name) const noexcept
98
+ {
99
+ // TODO use a map for better performance
100
+ for (auto & option : m_options)
101
+ {
102
+ if (option->GetName () == name)
103
+ {
104
+ return option;
105
+ }
106
+ }
107
+
108
+ return nullptr ;
93
109
}
0 commit comments