haven't gotten anything to run yet, working on first prototype for game
here is the code
#include <stdio.h>
#include <stdlib.h>
#include "pd_api.h"static int update(void* userdata);
static LCDFont* Font = NULL;
PlaydateAPI* playdate = NULL;int update(void* userdata);
void drawMenu();
void drawGame();int eventHandler(PlaydateAPI* playdate, PDSystemEvent event, uint32_t arg) {
switch (event) {
case kEventInit:
//C init code
Font = playdate->graphics->loadFont("font.pft", NULL);
playdate->system->setUpdateCallback(update, playdate);
break;
case kEventInitLua:
// lua = bad
break;
case kEventKeyPressed:
//scoobydoo shit right here
break;
case kEventKeyReleased:
//
break;
case kEventLock:
//lock event
break;
case kEventUnlock:
//unlock event
break;
case kEventPause:
//pause event
break;
case kEventResume:
//resume event
break;
case kEventTerminate:
//arnold event
break;
case kEventLowPower:
//sleep event
break;
default: // do i need this?break; } return 0;
}
int update(void* userdata) {
PlaydateAPI* playdate = userdata; switch (currentGameState) { case MENU: drawMenu(); break; case GAME: drawGame(); //woweee break; } return 1;
}
void drawMenu() {
playdate->graphics->clear(kColorWhite);...
so the issue im having is that when i go to clear the screen the playdateAPI* is still set to NULL?
the update function should have already set the pointer to "userdata" from the hardware before clear gets called?
this will be my first project in c in many years, thank you for your understanding.