While I was in university, I remember one of my textbooks having specific jargon to distinguish these two different API paradigms but, for the life of me, I can't remember which book it was in and Google has been no help.
APIs like Win32, Xlib, and SDL, where you sit at the top of the call stack and have to write your own main loop and take responsibility for pulling system events off the queue using a construct like
GetMessage
,XNextEvent
, orSDL_PollEvent
.(A design which requires more skill, but grants maximal control for writing game engines or resource-constrained applications that need to run on the 80286 CPUs that Win32's Win16 ancestor was designed for.)
APIs like those of Qt, GTK, wxWidgets, Fltk, Swing, Tk, etc. where you perform some initialization, hook up event handlers, and the framework provides the event loop for you, either by spawning a background thread or by requiring you to transfer control to the framework explicitly. (eg.
QApplication.exec()
,gtk_main()
,IMPLEMENT_APP(wxAppSubclass)
,Fl::run()
, etc.)
Does anyone know which two terms I'm struggling to remember?
Bear in mind that it wasn't immediate mode vs. retained mode. It's possible to have a retained-mode application where you still have to pump the event loop yourself, or an immediate-mode application where you do your drawing in a callback dispatched from a platform-provided main loop.