Blame demo/src/main.c

3f9996
833ed7
#include <helianthus.h></helianthus.h>
3f9996
28a314
#include "common.h"
59dae5
#include "phisics.h"
59dae5
#include "sprites.h"
b9c036
#include "font.h"
ba9f06
#include "drawing.h"
1d641c
#include "framebuffer.h"
b4b587
#include "benchmark.h"
b4b587
b4b587
b4b587
static int benchmark = FALSE;
981405
a2530e
59dae5
void init() {
28a314
	commonInit();
59dae5
	phisicsInit();
59dae5
	spritesInit();
b9c036
	fontInit();
ba9f06
	drawingInit();
1d641c
	framebufferInit();
b4b587
	benchmarkInit();
3f9996
}
3f9996
3f9996
void draw() {
b4b587
	if (benchmark) {
b4b587
		benchmarkDraw();
b4b587
	} else {
b4b587
		commonDraw();
b4b587
		framebufferDraw();
b4b587
		drawingDraw();
b4b587
		phisicsDraw();
b4b587
		spritesDraw();
b4b587
		fontDraw();
b4b587
		
b4b587
		drawSprites();
b4b587
		saveState();
b4b587
		stroke(colorByName("red"));
b4b587
		strokeWidth(20);
b4b587
		point(mouseX(), mouseY());
b4b587
		restoreState();
b4b587
	}
1d641c
	
b4b587
	if (keyWentDown("p")) {
1d641c
		viewportSave("screenshot.png");
1d641c
		messageBox("screenshot saved to file: screenshot.png");
1d641c
	}
b4b587
	
b4b587
	if (keyWentDown("b"))
b4b587
		benchmark = !benchmark;
3f9996
}
3f9996
3f9996
int main() {
d7d433
	windowSetSize(1024, 512);
d7d433
	windowSetResizable(TRUE);
d7d433
	windowSetVariableFrameRate();
8bc1f1
	
d7d433
	windowSetInit(&init);
d7d433
	windowSetDraw(&draw);
8bc1f1
	
d7d433
	windowRun();
8bc1f1
	
a2530e
	return 0;
3f9996
}