Use const whenever possible.

This commit is contained in:
Dean Herbert
2017-03-23 13:52:38 +09:00
parent 54e1b24fe9
commit 681ed38941
15 changed files with 69 additions and 32 deletions

View File

@ -89,13 +89,13 @@ namespace osu.Game.Graphics.Backgrounds
protected virtual Triangle CreateTriangle()
{
float stdDev = 0.16f;
float mean = 0.5f;
const float std_dev = 0.16f;
const float mean = 0.5f;
float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats
float u2 = 1 - RNG.NextSingle();
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1)
var scale = Math.Max(triangleScale * (mean + stdDev * randStdNormal), 0.1f); //random normal(mean,stdDev^2)
var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2)
const float size = 100;

View File

@ -88,10 +88,10 @@ namespace osu.Game.Graphics.Cursor
Invalidate(Invalidation.DrawNode, shallPropagate: false);
int fadeClockResetThreshold = 1000000;
const int fade_clock_reset_threshold = 1000000;
time = (float)(Time.Current - timeOffset) / 500f;
if (time > fadeClockResetThreshold)
if (time > fade_clock_reset_threshold)
resetTime();
}

View File

@ -171,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface
IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic);
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
double startTime = Time.Current + offset;
// basic pulse
@ -200,7 +200,7 @@ namespace osu.Game.Graphics.UserInterface
int duration = 0; //(int)(Game.Audio.BeatLength);
if (duration == 0) duration = pulse_length * 2;
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
double startTime = Time.Current + offset;
// slow pulse