Licar/frontend_ringo/frontend_ringo.ino

93 lines
2.1 KiB
Arduino
Raw Normal View History

2025-06-18 02:40:59 +02:00
/**
@file frontend_ringo.ino
Experimental Licar frontend for Circuitmess Ringo (MAKERphone).
*/
#include <Arduino.h>
#include <MAKERphone.h>
#include <utility/soundLib/MPWavLib.h>
#define LCR_SETTING_RESOLUTION_X LCDWIDTH
#define LCR_SETTING_RESOLUTION_Y LCDHEIGHT
#define LCR_SETTING_RESOLUTION_SUBDIVIDE 2
#define LCR_SETTING_MUSIC 0
#define LCR_SETTING_GHOST_MAX_SAMPLES 0
2025-06-18 23:09:01 +02:00
#define LCR_SETTING_MAP_MAX_BLOCKS 1024
2025-06-18 03:53:35 +02:00
#define LCR_SETTING_MAX_MAP_VERTICES 1024
2025-06-18 16:57:52 +02:00
#define LCR_SETTING_MAX_MAP_TRIANGLES 1550
2025-06-18 02:40:59 +02:00
#define LCR_SETTING_REPLAY_MAX_SIZE 0
#define LCR_SETTING_CAR_SHADOW 0
#define LCR_SETTING_PARTICLES 0
#define LCR_SETTING_LOG_LEVEL 0
#define LCR_SETTING_LOD_DISTANCE 100
#define LCR_SETTING_CAR_ANIMATION_SUBDIVIDE 0
#define LCR_SETTING_FPS 25
2025-06-18 03:53:35 +02:00
#define LCR_SETTING_TEXTURE_SUBSAMPLE 4
2025-06-18 02:40:59 +02:00
#define LCR_SETTING_ENABLE_DATA_FILE 0
#define LCR_SETTING_ONLY_SMALL_MAPS 1
2025-06-18 16:57:52 +02:00
#define LCR_SETTING_SKY_SIZE 1
2025-06-18 03:53:35 +02:00
#define S3L_PERSPECTIVE_CORRECTION 0
2025-06-18 02:40:59 +02:00
#include "game.h"
MAKERphone mp;
void LCR_drawPixel(unsigned long index, uint16_t color)
{
mp.display.drawPixel(index % LCDWIDTH,index / LCDWIDTH,color);
}
void LCR_sleep(uint16_t timeMs)
{
}
uint8_t arrows;
uint8_t LCR_keyPressed(uint8_t key)
{
switch (key)
{
#define b(button) (mp.buttons.timeHeld(button) > 0)
2025-06-18 03:53:35 +02:00
case LCR_KEY_UP: return (arrows & 0x04) | b(BTN_2); break;
case LCR_KEY_DOWN: return (arrows & 0x08) | b(BTN_8) | b(BTN_5); break;
case LCR_KEY_RIGHT: return (arrows & 0x01) | b(BTN_6); break;
case LCR_KEY_LEFT: return (arrows & 0x02) | b(BTN_4); break;
case LCR_KEY_A: return b(BTN_A) | b(BTN_HASHTAG); break;
case LCR_KEY_B: return b(BTN_B) | b(BTN_ASTERISK); break;
2025-06-18 02:40:59 +02:00
default: return 0; break;
#undef b
}
}
char LCR_getNextDataFileChar(void)
{
return 0;
}
void LCR_appendDataStr(const char *str)
{
return;
}
void setup()
{
mp.begin();
LCR_gameInit(0,0);
}
void loop()
{
arrows = 0x00 |
((mp.buttons.getJoystickX() < 200)) << 0 |
((mp.buttons.getJoystickX() > 900)) << 1 |
((mp.buttons.getJoystickY() < 200)) << 2 |
((mp.buttons.getJoystickY() > 900)) << 3;
LCR_gameStep(millis());
mp.update();
}