Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Anarch port to the ODROID-GO
#pragma GCC optimize ("O3")
#define SFG_FPS 20
#define SFG_SCREEN_RESOLUTION_X 80
#define SFG_SCREEN_RESOLUTION_Y 60
#define SFG_RESOLUTION_SCALEDOWN 1
#define SFG_CAN_EXIT 0
#include "anarch/game.h"
#include <odroid_go.h>
void SFG_setPixel(uint16_t x, uint16_t y, uint8_t colorIndex)
{
GO.lcd.fillRect(x * 4, y * 4, 4, 4, paletteRGB565[colorIndex]);
}
void SFG_sleepMs(uint16_t timeMs)
{
delayMicroseconds(timeMs * 1000);
}
int8_t SFG_keyPressed(uint8_t key)
{
switch (key)
{
case SFG_KEY_UP:
return GO.JOY_Y.isAxisPressed() == 2;
case SFG_KEY_RIGHT:
return GO.JOY_X.isAxisPressed() == 1;
case SFG_KEY_DOWN:
return GO.JOY_Y.isAxisPressed() == 1;
case SFG_KEY_LEFT:
return GO.JOY_X.isAxisPressed() == 2;
case SFG_KEY_A:
return GO.BtnA.isPressed() == 1;
case SFG_KEY_B:
return GO.BtnB.isPressed() == 1;
case SFG_KEY_C:
return GO.BtnStart.isPressed() == 1;
default:
return 0;
}
}
void SFG_processEvent(uint8_t event, uint8_t value)
{
//
}
void SFG_getMouseOffset(int16_t *x, int16_t *y)
{
//
}
void SFG_setMusic(uint8_t value)
{
//
}
void SFG_save(uint8_t data[SFG_SAVE_SIZE])
{
//
}
uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE])
{
return 0;
}
void SFG_playSound(uint8_t soundIndex, uint8_t volume)
{
//
}
uint32_t SFG_getTimeMs()
{
return millis();
}
void setup()
{
GO.begin();
SFG_init();
}
void loop()
{
while (true)
{
GO.BtnA.read();
GO.BtnB.read();
GO.BtnStart.read();
GO.JOY_Y.readAxis();
GO.JOY_X.readAxis();
SFG_mainLoopBody();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment