Blob Blame Raw

#include <helianthus.h>

#include "common.h"
#include "phisics.h"
#include "sprites.h"
#include "font.h"
#include "drawing.h"
#include "framebuffer.h"
#include "benchmark.h"


static int benchmark = FALSE;


void init() {
	commonInit();
	phisicsInit();
	spritesInit();
	fontInit();
	drawingInit();
	framebufferInit();
	benchmarkInit();
}

void draw() {
	if (benchmark) {
		benchmarkDraw();
	} else {
		commonDraw();
		framebufferDraw();
		drawingDraw();
		phisicsDraw();
		spritesDraw();
		fontDraw();
		
		drawSprites();
		saveState();
		stroke(colorByName("red"));
		strokeWidth(20);
		point(mouseX(), mouseY());
		restoreState();
	}
	
	if (keyWentDown("p")) {
		viewportSave("screenshot.png");
		messageBox("screenshot saved to file: screenshot.png");
	}
	
	if (keyWentDown("b"))
		benchmark = !benchmark;
}

int main() {
	windowSetSize(1024, 512);
	windowSetResizable(TRUE);
	windowSetVariableFrameRate();
	
	windowSetInit(&init);
	windowSetDraw(&draw);
	
	windowRun();
	
	return 0;
}