C# events ?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

C# events ?

Post by Guest »

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
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

They're not integrated yet.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Dude

Post by Dude »

Same thing with vb.net?
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

.NET is unified and it's available now with Irrlicht 0.8 I think.
Fingers
Posts: 38
Joined: Thu Feb 10, 2005 10:17 am
Location: South Africa

Post by Fingers »

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;
		}
	}
Post Reply