@@ -13,21 +13,23 @@ public AnalogInputDisplay()
1313
1414 public override void Render ( )
1515 {
16+ AnalogInputDisplayModuleSettings settings = AnalogInputDisplayModule . Settings ;
17+ if ( ! settings . Enabled ) return ;
18+
1619 Player player = Scene . Tracker . GetEntity < Player > ( ) ;
1720 Level level = SceneAs < Level > ( ) ;
1821 if ( level == null ) return ;
1922 if ( player == null ) return ;
2023
21- AnalogInputDisplayModuleSettings settings = AnalogInputDisplayModule . Settings ;
2224 float radius = settings . Radius * 5f ;
2325 Vector2 pos = level . WorldToScreen ( player . Center ) ;
2426
2527 GamePadState gamepad = GamePad . GetState ( 0 , GamePadDeadZone . None ) ;
2628 if ( gamepad . ThumbSticks . Left . Length ( ) > settings . MinDisplayThreshold )
2729 {
2830 Vector2 thumbstick = new Vector2 ( gamepad . ThumbSticks . Left . X , - gamepad . ThumbSticks . Left . Y ) ;
29- drawIndicator ( pos , thumbstick , settings . IndicatorLength , radius , Color . Red , settings . InputThickness ) ;
30- drawIndicator ( pos , Input . LastAim , settings . IndicatorLength , radius , Color . White , settings . ActualDirectionThickness ) ;
31+ drawIndicator ( pos , thumbstick , radius , settings . InputIndicator ) ;
32+ drawIndicator ( pos , Input . LastAim , radius , settings . DashIndicator ) ;
3133 }
3234 }
3335
@@ -37,10 +39,10 @@ private static Vector2 translateVec(Vector2 initial, float angleRad, float dista
3739 return initial + offset ;
3840 }
3941
40- private void drawIndicator ( Vector2 origin , Vector2 direction , float length , float radius , Color color , float thickness = 1 )
42+ private void drawIndicator ( Vector2 origin , Vector2 direction , float radius , AnalogInputDisplayModuleSettings . Indicator indicator )
4143 {
42- Vector2 start = translateVec ( origin , direction . Angle ( ) , radius - length ) ;
44+ Vector2 start = translateVec ( origin , direction . Angle ( ) , radius - indicator . Length ) ;
4345 Vector2 end = translateVec ( origin , direction . Angle ( ) , radius ) ;
44- Draw . Line ( start , end , color , thickness ) ;
46+ Draw . Line ( start , end , indicator . GetXNAColor ( ) , indicator . Thickness ) ;
4547 }
4648}
0 commit comments