Tanner Babcock

Spectrum / main.c

		#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include "graphics.h"
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
PSP_MODULE_INFO("Spectrum", 0, 1, 1);

int h, s, v;
int r, g, b;
SceCtrlData pad;

int main() {
	initGraphics();
	h = 0, s = 255, v = 255;
	while (1) {
		clearScreen(RGB(0, 0, 0));
		sceCtrlReadBufferPositive(&pad, 1);
		hsv2rgb(&r, &g, &b, h, s, v);
		if (h < 358)
			h++;
		else
			h = 0;
		fillScreenRect(RGB(r, g, b), 0, 0, 480, 272);
		if (pad.Buttons & PSP_CTRL_CIRCLE)
			break;
		sceDisplayWaitVblankStart();
		flipScreen();
	}
	sceKernelExitGame();
	return 0;
}