6 years ago
Apologies if this is already answered elsewhere - just starting to learn my way around the new forums/docs/etc.; is there a way to support both platforms easily with the same codebase, e.g. an `#ifdef GB_META` or something that you can wrap around META-specific code blocks etc.? In general, how compatible are the new and old API? Thanks! :)
NEW 6 years ago
Update: here's my dirty hack for now:
```
#ifdef GB_META
#include <Gamebuino-Meta.h>
// this is a silly way to get quick META compatibility for now
#define LCDWIDTH gb.display.width()
#define LCDHEIGHT gb.display.height()
#define BTN_UP BUTTON_UP
#define BTN_DOWN BUTTON_DOWN
#define BTN_A BUTTON_A
#define BTN_C BUTTON_MENU
#else
#include <Gamebuino.h>
Gamebuino gb;
#endif
```
Plus
```
#ifdef GB_META
// META requires explicit clear at beginning of loop
gb.display.clear();
#endif
```
and:
```
#ifndef GB_META
// CLASSIC only
// remember to use F() for strings in order to save RAM!
gb.titleScreen(F("Obsidian"));
#endif
```
:)
NEW 6 years ago
Your idea is to make prog compatible for both and that, no it's not aleady a subject on the forum but its a good idea. Else the existing subject is how to convert a game from classic to META (other way don't exist yet on forum); https://gamebuino.com/fr/creations/port-games-from-classic-to-meta
ishotjr
6 years ago
Thanks, I was not aware of that thread; this appears to be pretty much exactly what I ended up hacking in above! :)
https://github.com/Gamebuino/Gamebuino-Compat/blob/master/src/Gamebuino-Compat.h#L52
NEW 6 years ago
Thanks, I was not aware of that thread; this appears to be pretty much exactly what I ended up hacking in above! :)
https://github.com/Gamebuino/Gamebuino-Compat/blob/master/src/Gamebuino-Compat.h#L52