frame buffer use problems using ili93xx and teensy

hi guys

ok so im working on adding some gaming aspects to sumotoys ili93xx library. ive managed to get the teensy and the display to print out a bitmap. which it does all fast and stuff. no problem there but i have an update function that is supposed to update the screen buffer, the screen, the buttons and everything else.

if i enable the update function in sketch i get a black screen with no bitmap and then it resets itself is every five seconds. i think its a problem in the update command itself see here

	void Display::clear(void) {
		memset(_displayBuffer, 0, TFT_ILI93XX_TFTWIDTH * TFT_ILI93XX_TFTHEIGHT / 8);
		cursorY = cursorX = 0;

boolean Display::update() {
	if (((nextFrameMillis - millis()) > timePerFrame) && frameEndMicros) { //if time to render a new frame is reached and the frame end has ran once
		nextFrameMillis = millis() + timePerFrame;

		frameEndMicros = 0;
		frameStartMicros = micros();

		//backlight.update(); //DUHJOKER

		return true;

	else {
		if (!frameEndMicros) { //runs once at the end of the frame
							   //			sound.updateTrack();
							   //			sound.updatePattern();
							   //			sound.updateNote();

			update(); //send the buffer to the screen
			if (!Display::persistence)
				Display::clear(); //clear the buffer

			frameEndMicros = micros(); //measure the frame's end time
			frameDurationMicros = frameEndMicros - frameStartMicros;

			//            display.setTextColor(BLACK);
			//            display.setCursor(0, 40);
			//            display.print(frameDurationMicros / timePerFrame);
			//            display.print(" ");
			//            display.print(2048 - freeRam());

			//            display.setCursor(0, 32);
			//            display.print("CPU:");
			//            display.print(frameDurationMicros / timePerFrame);
			//            display.println("/1000");
			//            display.print("RAM:");
			//            display.print(2048 - freeRam());
			//            display.println("/2048");
		return false;

void Display::setFrameRate(uint8_t fps) {
	timePerFrame = 1000 / fps;
	//	sound.prescaler = fps / 20;
	//	sound.prescaler = max(1, sound.prescaler);

//void Display::pickRandomSeed() {
//	randomSeed(~battery.voltage * ~micros() * ~micros() + backlight.ambientLight + micros());

uint8_t Display::getCpuLoad() {
	return(frameDurationMicros / (10 * timePerFrame));

uint16_t Display::getFreeRam() {
	extern int __heap_start, *__brkval;
	int v;
	return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int)__brkval);

and here are the other stuff…

	boolean update();
	uint8_t startMenuTimer;
	uint32_t frameCount;
	uint8_t getCpuLoad();
	uint16_t getFreeRam();
	uint16_t frameDurationMicros;
	uint32_t frameStartMicros, frameEndMicros;
	uint8_t* getBuffer();

	int8_t cursorX, cursorY;
	boolean persistence; //disable clean() at each frame if true
	boolean settingsAvailable();
	void readSettings();

	void setFrameRate(uint8_t fps);
	void clear(void);
	void pickRandomSeed();


if you look at the update function every thing uses display. but for some reason i keep having to change them to Display::. now that works and it compiles i really don't think that's how it should be done. (304 KB)