Does anyone have a code snippet or sample of how I would capture a keypress or mouse event using irrlicht in C#?
Thank you,
~Rob
C# events ?
Hope this Helps
Code: Select all
public class BaseRun : IEventReceiver {
[STAThread]
static void Main() {
BaseRun Game = new BaseRun();
Game.Run();
}
public BaseRun() {
}
public void Setup(Irrlicht.IrrlichtDevice device) {
device.ResizeAble = true;
device.WindowCaption = "Your App Name";
device.EventReceiver = this;
}
public void Run(){
Irrlicht.IrrlichtDevice device = new IrrlichtDevice(DriverType.OPENGL);
Setup( device );
while(device.Run()){
// Do your Main Code Loop Here
}
}
public bool OnEvent(Irrlicht.Event e) {
switch( e.Type ) {
case Irrlicht.EventType.KeyInput :
// Do Whatever for the Keyboard
break;
case Irrlicht.EventType.MouseInput :
// Do Whatever for the Mouse
break;
default:
//
break;
}
return true;
}
}