MiataDrive: fix title menu auto-starting (boot grace + click guard)
This commit is contained in:
@@ -928,11 +928,12 @@ void setup() {
|
|||||||
if (emuAutoplay) autoPlay = true;
|
if (emuAutoplay) autoPlay = true;
|
||||||
#endif
|
#endif
|
||||||
drawTitle();
|
drawTitle();
|
||||||
|
stateT0 = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
if (now < 800) { resetTrackball(); delay(1); return; }
|
if (now < 1500) { resetTrackball(); delay(1); return; }
|
||||||
if ((int32_t)(now - nextFrame) < 0) { delay(1); return; }
|
if ((int32_t)(now - nextFrame) < 0) { delay(1); return; }
|
||||||
float dt = (nextFrame == 0) ? 0.033f : (float)(now - (nextFrame - FRAME_MS)) / 1000.0f;
|
float dt = (nextFrame == 0) ? 0.033f : (float)(now - (nextFrame - FRAME_MS)) / 1000.0f;
|
||||||
if (dt < 0.004f) dt = 0.004f;
|
if (dt < 0.004f) dt = 0.004f;
|
||||||
@@ -942,7 +943,7 @@ void loop() {
|
|||||||
int pxX, pxY; uint32_t clicks;
|
int pxX, pxY; uint32_t clicks;
|
||||||
applyTrackball(pxX, pxY, clicks);
|
applyTrackball(pxX, pxY, clicks);
|
||||||
|
|
||||||
if (clicks) {
|
if (clicks && (int32_t)(now - stateT0) > 1500) {
|
||||||
if (gameState == ST_TITLE) startGame();
|
if (gameState == ST_TITLE) startGame();
|
||||||
else if (gameState == ST_GAMEOVER || gameState == ST_WIN) { gameState = ST_TITLE; stateT0 = millis(); }
|
else if (gameState == ST_GAMEOVER || gameState == ST_WIN) { gameState = ST_TITLE; stateT0 = millis(); }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user