/*
 * run.c
 *
 *  Created on: Dec 24, 2009
 *      Author: ÓHerman van der MeulenÓ
 */

#include "run.h"

void run()
{
	touchPosition touchXY;

	placing = 0;

	while (1)
	{
		// just keep scanning the touch input, react accordingly
		scanKeys();

		int held = keysHeld();

		if (held & (KEY_A | KEY_L | KEY_R))
		{
			if (placing == 0)
				placing = 1;
		}
		else
		{
			if (placing == 1)
				placing = 0;
		}

		if (held & KEY_TOUCH)
		{
			touchRead(&touchXY);
			setNewPosition(&touchXY);
			changePenStatus(1);
		}
		else
			changePenStatus(0);
		swiWaitForVBlank();
	}
}
