356
edits
Changes
→Processing Events
= Processing Events =
In [https://en.wikipedia.org/wiki/Event-driven_programming Event-driven programming] the readmain main loop of a program
takes care of fetch, process and/or dispatch incoming events, the following code is an example of a minimal one.
switch( ev.opcode )
{
// <script stop > commandfrom console
//
case SevEmergExit:
}
// push button activate
//
case SevDinActive:
{
if( ev.p0 == 0 ) { dCursor( 0, 10 ); dPrintf("Button Pressed"); { } // push button deactivate // case SevDinInactive: { if( ev.p0 == 0 ) { dCursor( 0, 10 ); dPrintf("Button Released"); {
}
}