For that reason, you ??™ ll start with a hefty example and then break it down piece by piece.
import nme.Manager;
import nme.Timer;
import nme.Point;
import nme.TTF;
class Simple
{
static var mainObject : Simple;
var running : Bool;
static function main()
{
mainObject = new Simple();
}
public function new()
{
var mng = new Manager( 200, 200, ???Simple Application???, false, ???ico.gif??? );
var fps : Float;
var prevTime : Float = 0.0;
var curTime : Float;
running = true;
while (running)
{
mng.events();
switch mng.getEventType()
{
case et_keydown:
processKeys( mng.lastKey(), true );
case et_quit:
running = false;
default:
}
(continued)
Part III: Extending the Possibilities
534
curTime = Timer.getCurrent();
fps = 1000.00 / (curTime - prevTime);
prevTime = curTime;
mng.clear( 0x000000 );
TTF.draw( Std.string( fps ), ???ARIAL.TTF???, 12, new Point( 15, 15 ), 0xFFFFFF,
0x000000, 100 );
mng.flip();
}
mng.close();
}
public function processKeys( key, pressed : Bool )
{
switch key
{
case 27:
running = false;
default:
neko.
Pages:
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994