there are two types of events : one that uses 'EventHandlers' like EngVar.on_mouse_left, an example for this is shown in one of my previous posts ! the other type only allows one method to be called, for example the Panel.event_ property :
Code:
// the method to be called when the panel is clicked
static void PanelEvent(IntPtr p)
{
// get the clicked panel
PANEL thisPanel =
PANEL.createFromPointer(p);
// change the color of the clicked panel
thisPanel.bmap.bmap_fill(new Color(200, 0, 0), 50);
}
// the main method called by the scheduler
private static IEnumerable<ScheduleMethod> MyMainMethod()
{
// create a red panel and make it visible...
PANEL p =
PANEL.pan_create(null, 24);
p.SHOW = true;
p.size_x = 100;
p.size_y = 100;
p.pos_x = 300;
p.pos_y = 300;
p.bmap =
BMAP.bmap_createblack(100, 100, 32);
p.bmap.bmap_fill(new Color(0, 0, 255), 50);
// assign the method to be called when the panel is clicked..
p.event_ =
PanelEvent;
// use the mouse !!
EngVar.mouse_mode = 4;
}
// the entry point of the program
static void Main(string[] args)
{
// load an empty level
EngFun.engine_open(null, null);
EngFun.level_load(null);
// start the scheduler
Scheduler.StartScheduler(MyMainMethod);
}