irrlicht problems
Posted: Sun Oct 19, 2008 3:09 pm
I am really enjoying this language, and have decided to try to use the .net wrapper for irrlicht with cobra. Everything seems to be working, but for some reason cobra will not let me do this:
it errors with
irrlichtExample.cobra(17): error: Cannot apply PLUS_EQUALS to OnEventDelegate.
Try finding a method that performs this function.
but the equivalent c# works:
here is my entire example program:
Am I missing something?
- Code: Select all
device.onEvent += OnEventDelegate(ref .device_onEvent)
it errors with
irrlichtExample.cobra(17): error: Cannot apply PLUS_EQUALS to OnEventDelegate.
Try finding a method that performs this function.
but the equivalent c# works:
- Code: Select all
$sharp('device.OnEvent += new OnEventDelegate(Device_onEvent);')
here is my entire example program:
- Code: Select all
# .args. -ref:Irrlicht.NET
use IrrlichtNETCP
class Program
shared
var exit as bool = false
def main
device as IrrlichtDevice? = IrrlichtDevice(DriverType.Direct3D9,Dimension2D(800,600),32,false,false,false,false)
if device is nil
return #the device could not be opened
caption = 'this is a test'
device.windowCaption = caption
$sharp('device.OnEvent += new OnEventDelegate(Device_onEvent);')
#device.onEvent += OnEventDelegate(ref .device_onEvent)
#errors with:
#irrlichtExample.cobra(17): error: Cannot apply PLUS_EQUALS to OnEventDelegate.
#Try finding a method that performs this function.
#But it works fine with the c# equivalent???
scene = device.sceneManager
driver = device.videoDriver
lastFPS = -1
while device.run and not .exit
driver.beginScene(true, true, Color.gray)
scene.drawAll
driver.endScene
fps = driver.fps
if lastFPS <> fps
device.windowCaption = caption+' FPS: [fps]'
lastFPS = fps
device.dispose
def device_onEvent(ev as Event) as bool #allows for keypresses/mouse presses
if ev.type==EventType.KeyInputEvent and ev.keyPressedDown and ev.keyCode==KeyCode.Escape
.exit = true
return true
return false
Am I missing something?