mirror of
https://github.com/Rezmason/matrix.git
synced 2026-04-22 23:59:31 -07:00
Reducing the number of fade variants when the effect is running quicker, to gain some more CPU.
This commit is contained in:
@@ -128,12 +128,15 @@ static void init(void)
|
|||||||
static int update(void* ud)
|
static int update(void* ud)
|
||||||
{
|
{
|
||||||
float delta;
|
float delta;
|
||||||
|
int currentFadeSkip = 1;
|
||||||
|
|
||||||
if (sys->isCrankDocked()) {
|
if (sys->isCrankDocked()) {
|
||||||
speed += 0.07f;
|
speed += 0.07f;
|
||||||
if (speed > maxSpeed) {
|
if (speed > maxSpeed) {
|
||||||
speed = maxSpeed;
|
speed = maxSpeed;
|
||||||
}
|
}
|
||||||
delta = sys->getElapsedTime() * speed;
|
delta = sys->getElapsedTime() * speed;
|
||||||
|
currentFadeSkip = 6;
|
||||||
} else {
|
} else {
|
||||||
speed -= 0.07f;
|
speed -= 0.07f;
|
||||||
if (speed < minSpeed) {
|
if (speed < minSpeed) {
|
||||||
@@ -144,6 +147,8 @@ static int update(void* ud)
|
|||||||
sys->resetElapsedTime();
|
sys->resetElapsedTime();
|
||||||
time += delta;
|
time += delta;
|
||||||
|
|
||||||
|
int currentNumFades = numFades / currentFadeSkip;
|
||||||
|
|
||||||
PDButtons currentButtons;
|
PDButtons currentButtons;
|
||||||
sys->getButtonState(¤tButtons, NULL, NULL);
|
sys->getButtonState(¤tButtons, NULL, NULL);
|
||||||
int addPDGlyphs = currentButtons & kButtonA && currentButtons & kButtonB;
|
int addPDGlyphs = currentButtons & kButtonA && currentButtons & kButtonB;
|
||||||
@@ -160,7 +165,8 @@ static int update(void* ud)
|
|||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
int fadeIndex = brightness * numFades;
|
int fadeIndex = brightness * currentNumFades;
|
||||||
|
fadeIndex *= currentFadeSkip;
|
||||||
if (fadeIndex < 0) fadeIndex = 0;
|
if (fadeIndex < 0) fadeIndex = 0;
|
||||||
if (fadeIndex >= numFades - 1) fadeIndex = numFades - 1;
|
if (fadeIndex >= numFades - 1) fadeIndex = numFades - 1;
|
||||||
if (cell->fadeIndex != fadeIndex) {
|
if (cell->fadeIndex != fadeIndex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user