The big difference between GUI libraries and
NME are that the entered loop is one of your own creations. Most GUI libraries can afford to hide the
inner workings of an event loop behind a simple function call. This is because, once the loop is entered,
it is quite uncommon for new controls to be created or for existing controls to change properties, with the
exception of a change in value. In complete contradiction, a game or multimedia application is expected
to change an awful lot between loop iterations, especially with regard to the rendering of graphics. By
facilitating your own loop, you can choose exactly what code is run with each iteration enabling
complete control over all aspects of your application. Then, each time an iteration draws to an end, you
execute a number of functions provided by NME that will handle the physical update onscreen.
(continued)
Chapter 19: Multimedia with Neko
535
So, how does this work? Well, first, take a look at the initializing function. In NME, this functionality is
assigned to the constructor of the Manager class, so all you have to do is to instantiate it:
var width : Int = 300;
var height : Int = 200;
var title : String = ???My Window Title???;
var fullscreen : Bool = false;
var icon : String = ???wndIcon.
Pages:
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996