Minor fixes
This commit is contained in:
parent
756f5b5eb8
commit
3da2a7a7c2
5 changed files with 16 additions and 6 deletions
|
|
@ -42,6 +42,9 @@ void setDisplayContrast(uint8_t value);
|
||||||
// Clear buffer and wasIntersection bit
|
// Clear buffer and wasIntersection bit
|
||||||
void startIntersectionTest();
|
void startIntersectionTest();
|
||||||
|
|
||||||
|
// Make the display go to / return from sleep
|
||||||
|
void turnDisplayOnOff(bool shouldBeOn);
|
||||||
|
|
||||||
// Return wasIntersection bit
|
// Return wasIntersection bit
|
||||||
bool endIntersectionTest();
|
bool endIntersectionTest();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,11 @@
|
||||||
#define REPEAT_CODE 1
|
#define REPEAT_CODE 1
|
||||||
|
|
||||||
typedef void (*OnCommandReceived)(uint8_t);
|
typedef void (*OnCommandReceived)(uint8_t);
|
||||||
|
typedef void (*OnReceiveStarted)();
|
||||||
|
|
||||||
// Initialize infra and call onCommandReceived with every received byte
|
// Initialize infra and call onCommandReceived with every received byte
|
||||||
// Call onCommandReceived with the argument REPEAT_CODE if a repeat code
|
// Call onCommandReceived with the argument REPEAT_CODE if a repeat code
|
||||||
// has been received.
|
// has been received.
|
||||||
void initializeInfra(OnCommandReceived onCommandReceived);
|
void initializeInfra(OnCommandReceived onCommandReceived, OnReceiveStarted onReceiveStarted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
// FrameFunction gets previousFrameTime (in milliseconds) as argument
|
// FrameFunction gets previousFrameTime (in milliseconds) as argument
|
||||||
typedef bool (*FrameFunction)(uint8_t);
|
typedef bool (*FrameFunction)(uint8_t);
|
||||||
|
|
||||||
|
// Shut down the machine
|
||||||
|
void powerOff();
|
||||||
|
|
||||||
// Call function every frameLengthInMilliseconds while it returns true
|
// Call function every frameLengthInMilliseconds while it returns true
|
||||||
void startFrameLoop(FrameFunction function, uint8_t frameLengthInMilliseconds);
|
void startFrameLoop(FrameFunction function, uint8_t frameLengthInMilliseconds);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,9 +62,9 @@ void handleOn() {
|
||||||
|
|
||||||
|
|
||||||
static bool frameFunction(uint8_t previousFrameTime) {
|
static bool frameFunction(uint8_t previousFrameTime) {
|
||||||
if (state.isSleeping) {
|
/*if (state.isSleeping) {
|
||||||
powerOff();
|
powerOff();
|
||||||
} else {
|
} else {*/
|
||||||
disableWritingEEPROM();
|
disableWritingEEPROM();
|
||||||
tickObjects(previousFrameTime);
|
tickObjects(previousFrameTime);
|
||||||
handleCommands();
|
handleCommands();
|
||||||
|
|
@ -74,7 +74,7 @@ static bool frameFunction(uint8_t previousFrameTime) {
|
||||||
enableWritingEEPROM();
|
enableWritingEEPROM();
|
||||||
saveGame();
|
saveGame();
|
||||||
return handleDeathAnimation();
|
return handleDeathAnimation();
|
||||||
}
|
//}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ Action getPossibleActionFromSpaceship(Object* astronaut) {
|
||||||
return noAction;
|
return noAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tick(Object* spaceship, uint8_t previousFrameTime) {
|
void tick(Object* spaceship, __attribute__((unused)) uint8_t previousFrameTime) {
|
||||||
flickerState = !flickerState;
|
flickerState = !flickerState;
|
||||||
if (spaceship->as.spaceship.healthLoss >= MAX_HEALTH) {
|
if (spaceship->as.spaceship.healthLoss >= MAX_HEALTH) {
|
||||||
spaceship->as.spaceship.healthLoss++;
|
spaceship->as.spaceship.healthLoss++;
|
||||||
|
|
@ -191,7 +191,10 @@ static inline void drawExhaust(Rectangle compositingWindow) {
|
||||||
|
|
||||||
static inline void drawGlitches() {
|
static inline void drawGlitches() {
|
||||||
for (uint8_t i = 0; i < spaceshipObject->as.spaceship.healthLoss - MAX_HEALTH; i++) {
|
for (uint8_t i = 0; i < spaceshipObject->as.spaceship.healthLoss - MAX_HEALTH; i++) {
|
||||||
Rectangle r = translateRectangle((Rectangle){(Vec2){getRandomNumber() % SPACESHIP_SIZE.x, getRandomNumber() % SPACESHIP_SIZE.y}, (Vec2){8, 8}}, spaceshipObject->position);
|
Rectangle r = translateRectangle(
|
||||||
|
(Rectangle){(Vec2){getRandomNumber() % SPACESHIP_SIZE.x, getRandomNumber() % SPACESHIP_SIZE.y}, (Vec2){8, 8}},
|
||||||
|
spaceshipObject->position
|
||||||
|
);
|
||||||
if (areIntersecting(r, WINDOW)) {
|
if (areIntersecting(r, WINDOW)) {
|
||||||
drawFilledRectangle(r, 0xFF, 0x00);
|
drawFilledRectangle(r, 0xFF, 0x00);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue