#include "_Global.h"

class Main extends _Main
{
	var g:_Graphics;

	var rand:_Random;

	var x:Number;
	var y:Number;

	function start():Boolean
	{
		g = getGraphics();

		rand = new _Random();

		x = 120 + rand.next( 120 );
		y = 120 + rand.next( 120 );
		repaint();	// 手動で paint 指示

		return false;	// タイマーによる paint 呼び出しを行わない
	}

	function paint():Void
	{
		g.lock();
		g.setColor( g.getColorOfRGB( 127, 127, 127 ) );
		g.fillRect( 0, 0, 240, 240 );
		g.setColor( g.getColorOfRGB( 255, 0, 0 ) );
		g.setFont( _FONT_TINY );
		g.drawString( "Hello World !!", x, y );
		g.unlock();
	}

	function processEvent( type:Number, param:Number ):Void
	{
		if( type == _KEY_PRESSED_EVENT )
		{
			x = 120 + rand.next( 120 );
			y = 120 + rand.next( 120 );
			repaint();	// 手動で paint 指示
		}
	}
}
