forum-msg-id-131062-edit
Original date:2017-05-21 20:23:30 Edited by: Icy_Viking Subject: Re: Wrapper Help Again
I'd figure I'd have to wrap them like that. I had to wrap some event commands like that. It's a pain, but at least its fairly easy to wrap.
EDIT: Ok so I wrapped it like this.
Wrapper
public constant xirrEKeyCodeKeyEscape = define_c_func(irr,"irr_EKEY_CODE_KEY_ESCAPE",{},C_POINTER) public function irrEKeyCodeKeyEscape() return c_func(xirrEKeyCodeKeyEscape,{}) end function
Example
atom evt evt = irrSEventNew() while irrSEventIsKeyboardInputEvent(evt) do if irrSEventIsKeyboardInputEvent(evt) then atom keyInput = irrSEventGetKeyInput(evt) atom keyCode = irrSKeyInputGetKey(keyInput) if irrEKeyCodeKeyEscape() then irrIrrlichtDeviceClose() end if end if end while
When I try to run the example, the window closes right away. Maybe I have certain vars messed up?
This freezes the program when I try to run it.
atom evt evt = irrSEventNew() while irrSEventIsKeyboardInputEvent(evt) do if irrSEventIsKeyboardInputEvent(evt) then atom keyInput = irrSEventGetKeyInput(evt) atom keyCode = irrSKeyInputGetKey(keyInput) if irrSKeyInputIsPressed(keyInput) = irrEKeyCodeKeyEscape() then irrIrrlichtDeviceClose() end if end if end while
New Test, this is closer to how the C example is, but the Euphoria program still freezes.
include std/machine.e include std/get.e include EuIrr.ew constant TRUE = 1, FALSE = 0 integer EscapePressed procedure handleInput() atom evt evt = irrSEventNew() while irrSEventIsKeyboardInputEvent(evt) do if irrSEventIsKeyboardInputEvent(evt) then atom keyInput = irrSEventGetKeyInput(evt) atom keyCode = irrSKeyInputGetKey(keyInput) if irrEKeyCodeEqual(keyCode,irrEKeyCodeKeyEscape()) then EscapePressed = irrSKeyInputIsPressed(keyInput) end if end if end while if (EscapePressed) then irrIrrlichtDeviceClose() end if irrSEventDelete(evt) end procedure
Not Categorized, Please Help
|
- history, backlinks
- Last modified May 21, 2017 by Icy_Viking