Add Nibble frontend
This commit is contained in:
parent
7acfb64317
commit
aab53fc11a
2 changed files with 113 additions and 0 deletions
3
TODO.txt
3
TODO.txt
|
@ -38,6 +38,9 @@ fuck issue trackers :D
|
||||||
|
|
||||||
=========== BUGS =================
|
=========== BUGS =================
|
||||||
|
|
||||||
|
- it seems like on arduinos tiny maps can't be loaded (say "FAILED") even if in
|
||||||
|
theory they should (enough block space to load): try to set the exact same
|
||||||
|
settings on PC and see if the maps load or what
|
||||||
- replay loading BUG! somehow map2 replay was saves with hash 05ef0ab1 instead
|
- replay loading BUG! somehow map2 replay was saves with hash 05ef0ab1 instead
|
||||||
of correct 3c5ba5dd once, WTF, check where hash gets modified
|
of correct 3c5ba5dd once, WTF, check where hash gets modified
|
||||||
|
|
||||||
|
|
110
frontend_nibble/frontend_nibble.ino
Normal file
110
frontend_nibble/frontend_nibble.ino
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/**
|
||||||
|
@file frontend_nibble.ino
|
||||||
|
|
||||||
|
Experimental Licar frontend for Circuitmesss Nibble, unstable and unplayable,
|
||||||
|
but able to load a few of the smallest maps and allow driving a bit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
#include <CircuitOS.h>
|
||||||
|
#include <Nibble.h>
|
||||||
|
|
||||||
|
#define LCR_SETTING_RESOLUTION_X 128
|
||||||
|
#define LCR_SETTING_RESOLUTION_Y 128
|
||||||
|
#define LCR_SETTING_MUSIC 0
|
||||||
|
#define LCR_SETTING_RESOLUTION_SUBDIVIDE 2
|
||||||
|
#define LCR_SETTING_GHOST_MAX_SAMPLES 0
|
||||||
|
#define LCR_LOADING_COMMAND wdt_reset();
|
||||||
|
#define S3L_SORT 0
|
||||||
|
#define LCR_SETTING_MAP_MAX_BLOCKS 400
|
||||||
|
#define LCR_SETTING_MAX_MAP_VERTICES 450
|
||||||
|
#define LCR_SETTING_MAX_MAP_TRIANGLES 600
|
||||||
|
#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
|
||||||
|
|
||||||
|
#define LCR_SETTING_POTATO_GRAPHICS 1
|
||||||
|
|
||||||
|
#define LCR_SETTING_ENABLE_DATA_FILE 0
|
||||||
|
#define LCR_SETTING_ONLY_SMALL_MAPS 1
|
||||||
|
|
||||||
|
#include "game.h"
|
||||||
|
|
||||||
|
Display* display;
|
||||||
|
Sprite* sprite;
|
||||||
|
uint8_t buttons[6];
|
||||||
|
|
||||||
|
void LCR_drawPixel(unsigned long index, uint16_t color)
|
||||||
|
{
|
||||||
|
sprite->drawPixel(index % LCR_SETTING_RESOLUTION_X,index / LCR_SETTING_RESOLUTION_X,color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LCR_sleep(uint16_t timeMs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t LCR_keyPressed(uint8_t key)
|
||||||
|
{
|
||||||
|
return key < 6 ? buttons[key] : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char LCR_getNextDataFileChar(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LCR_appendDataStr(const char *str)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create button callbacks:
|
||||||
|
|
||||||
|
#define cbf(b,n) void b ## _down() { buttons[n] = 255; } void b ## _up() { buttons[n] = 0; }
|
||||||
|
cbf(BTN_UP,0)
|
||||||
|
cbf(BTN_RIGHT,1)
|
||||||
|
cbf(BTN_DOWN,2)
|
||||||
|
cbf(BTN_LEFT,3)
|
||||||
|
cbf(BTN_A,4)
|
||||||
|
cbf(BTN_B,5)
|
||||||
|
#undef cbf
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Nibble.begin();
|
||||||
|
display = Nibble.getDisplay();
|
||||||
|
sprite = display->getBaseSprite();
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 7; ++i)
|
||||||
|
buttons[i] = 0;
|
||||||
|
|
||||||
|
// register button callbacks:
|
||||||
|
|
||||||
|
#define cb(b) \
|
||||||
|
Input::getInstance()->setBtnPressCallback(b,b ## _down); \
|
||||||
|
Input::getInstance()->setBtnReleaseCallback(b,b ## _up);
|
||||||
|
|
||||||
|
cb(BTN_UP)
|
||||||
|
cb(BTN_DOWN)
|
||||||
|
cb(BTN_LEFT)
|
||||||
|
cb(BTN_RIGHT)
|
||||||
|
cb(BTN_A)
|
||||||
|
cb(BTN_B)
|
||||||
|
|
||||||
|
#undef cb
|
||||||
|
|
||||||
|
LCR_gameInit(0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
Input::getInstance()->loop(0);
|
||||||
|
LCR_gameStep(millis());
|
||||||
|
display->commit();
|
||||||
|
}
|
Loading…
Reference in a new issue