What are these functions called and how to implement they?

dog2002 742617000027 at aaathats3as.com
Thu Jan 28 17:10:57 UTC 2021


I saw these functions in some projects. For example: in Dagon 
(https://gecko0307.github.io/dagon/) there are functions like 
onKeyDown. This function doesn't need to call - it checks pressed 
keys every time. Or Update in Unity (game engine). It doesn't 
need to call, but it executes itself every frame.

Okay, maybe it sounds confusing. I just want to understand how to 
implement functions that wait for events and execute code inside 
the function. Something like this:

void onKeyPressed(int key) {
     //the code to be executed if a key has been pressed
}




More information about the Digitalmars-d-learn mailing list