1. Eu Help
- Posted by Icy_Viking Oct 30, 2017
- 1401 views
Trying to get this example to work, but I cannot get the Euphoria version working of my program. When I hit the ESC key, the program does not close.
C Example
#include <cirrlicht/cirrlicht.h> #include <stdio.h> #include <wchar.h> irrISceneNode sphere; IRR_F32 deltaTime; IRR_F32 MOVEMENT_SPEED; IRR_BOOL isWPressed; IRR_BOOL isAPressed; IRR_BOOL isSPressed; IRR_BOOL isDPressed; void handleInpunt() { irrSEvent evt; irrVector3df pos = irrVector3dfNew(0,0,0); irrISceneNodeGetPosition(sphere,pos); evt = irrSEventNew(); while(irrIrrlichtDevicePopEvent(evt)) { if(irrSEventIsKeyboardInputEvent(evt)) { irrSKeyInput keyInput = irrSEventGetKeyInput(evt); irr_EKEY_CODE keyCode = irrSKeyInputGetKey(keyInput); if(irrEKeyCodeEqual(keyCode,irr_EKEY_CODE_KEY_KEY_V()) && irrSKeyInputIsPressed(keyInput)==false) { irrISceneNodeSetVisible(sphere,!irrISceneNodeIsVisible(sphere)); printf("irrISCeneNodeSetVisible\n"); } if(irrEKeyCodeEqual(keyCode,irr_EKEY_CODE_KEY_KEY_W())) isWPressed = irrSKeyInputIsPressed(keyInput); else if(irrEKeyCodeEqual(keyCode,irr_EKEY_CODE_KEY_KEY_S())) isSPressed = irrSKeyInputIsPressed(keyInput); else if(irrEKeyCodeEqual(keyCode,irr_EKEY_CODE_KEY_KEY_A())) isAPressed = irrSKeyInputIsPressed(keyInput); else if(irrEKeyCodeEqual(keyCode,irr_EKEY_CODE_KEY_KEY_D())) isDPressed = irrSKeyInputIsPressed(keyInput); } } if(isWPressed) irrVector3dfSetY(pos,irrVector3dfGetY(pos)+deltaTime*MOVEMENT_SPEED); if(isSPressed) irrVector3dfSetY(pos,irrVector3dfGetY(pos)-deltaTime*MOVEMENT_SPEED); if(isAPressed) irrVector3dfSetX(pos,irrVector3dfGetX(pos)-deltaTime*MOVEMENT_SPEED); if(isDPressed) irrVector3dfSetX(pos,irrVector3dfGetX(pos)+deltaTime*MOVEMENT_SPEED); irrISceneNodeSetPosition(sphere,pos); irrSEventDelete(evt); irrVector3dfDelete(pos); }
Eu Example
include std/machine.e include EuIrr.ew constant TRUE = 1, FALSE = 0 atom deltatime atom dims = irrDimension2duNew(800,600) atom campos = irrVector3dfNew(0,30,-40) atom camat = irrVector3dfNew(0,5,0) atom driver,smgr,gui atom col = irrSColorNew(255,100,100,100) atom Wpressed = 0 atom Apressed = 0 atom Spressed = 0 atom Dpressed = 0 atom Escpressed = 0 procedure handleInput() atom evt = irrSEventNew() while irrIrrlichtDevicePopEvent(evt) do if (irrSEventIsKeyboardInputEvent(evt)) then atom keyInput = irrSEventGetKeyInput(evt) atom keyCode = irrSKeyInputGetKey(keyInput) if (irrEKeyCodeEqual(keyCode,irrEKeyCodeKeyEscape()) and not irrSKeyInputIsPressed(keyInput) = FALSE) then Escpressed = irrSKeyInputIsPressed(keyInput) end if end if end while if Escpressed = TRUE then irrIrrlichtDeviceClose() end if irrSEventDelete(evt) end procedure irrCreateDevice(dims,FALSE,TRUE,FALSE) if irrIrrlichtDeviceWasCreated() = -1 then puts(1,"Failed to create device!\n") abort(0) end if driver = irrIrrlichtDeviceGetVideoDriver() smgr = irrIrrlichtDeviceGetSceneManager() gui = irrIrrlichtDeviceGetGUIEnviroment() irrIrrlichtDeviceSetWindowsCaption("Node") atom cube = irrISceneManagerAddCubeSceneNode(smgr,10) cube = irrIMeshSceneNodeGetSceneNode(cube) irrISceneNodeSetMaterialFlag(cube,irr_video_EMF_LIGHTING(), FALSE) atom driverName = irrIVideoDriverGetName(driver) atom xtimer = irrIrrlichtDeviceGetTimer() atom last = irrITimerGetTime(xtimer) irrISceneManagerAddCameraSceneNode(smgr,irrISceneNodeNull(),campos,camat,TRUE) while irrIrrlichtDeviceRun() do atom now = irrITimerGetTime(xtimer) atom fps deltatime = (now - last) / 1000 last = now fps = irrIVideoDriverGetFPS(driver) --printf(1,"FPS: %d : %d",{driverName,fps}) irrIVideoDriverBeginScene(driver,TRUE,TRUE,col) irrISceneManagerDrawAll(smgr) irrIVideoDriverEndScene(driver) handleInput() end while irrDimension2duDelete(dims) irrSColorDelete(col) irrVector3dfDelete(campos) irrVector3dfDelete(camat) irrIrrlichtDeviceDrop()
2. Re: Eu Help
- Posted by Spock Oct 30, 2017
- 1376 views
Trying to get this example to work, but I cannot get the Euphoria version working of my program. When I hit the ESC key, the program does not close.
..not irrSKeyInputIsPressed(keyInput) = FALSE..
Is that meant to be
(not irrSKeyInputIsPressed(keyInput)) = FALSE
or
not (irrSKeyInputIsPressed(keyInput) = FALSE)
?
Spock
3. Re: Eu Help
- Posted by Icy_Viking Oct 31, 2017
- 1333 views
Trying to get this example to work, but I cannot get the Euphoria version working of my program. When I hit the ESC key, the program does not close.
..not irrSKeyInputIsPressed(keyInput) = FALSE..
Is that meant to be
(not irrSKeyInputIsPressed(keyInput)) = FALSE
or
not (irrSKeyInputIsPressed(keyInput) = FALSE)
?
Spock
I've tried both methods and they don't work. I'm not sure where the wrong code is exactly.
4. Re: Eu Help
- Posted by petelomax Oct 31, 2017
- 1354 views
I downloaded euirr and gave it a try, but it is a debug build and cannot find MSVCP140D.dll, VCRUNTIME140D.dll, or ucrtbased.dll
Further, https://www.microsoft.com/en-us/download/details.aspx?id=48145 does NOT contain the debug build of the first dll, so I reckon that cirrlicht.dll needs rebuilding properly.
Pete
5. Re: Eu Help
- Posted by Icy_Viking Nov 01, 2017
- 1329 views
I downloaded euirr and gave it a try, but it is a debug build and cannot find MSVCP140D.dll, VCRUNTIME140D.dll, or ucrtbased.dll
Further, https://www.microsoft.com/en-us/download/details.aspx?id=48145 does NOT contain the debug build of the first dll, so I reckon that cirrlicht.dll needs rebuilding properly.
Pete
I've rebuilt it with release DLLs, instead of the debug DLLs I had originally built it with. Here is the file: http://www.rapideuphoria.com/uploads/euirr.zip
6. Re: Eu Help
- Posted by petelomax Nov 01, 2017
- 1292 views
I've rebuilt it with release DLLs, instead of the debug DLLs I had originally built it with. Here is the file: http://www.rapideuphoria.com/uploads/euirr.zip
Much better, that seems to work fine, at least on the two original demos.
My initial findings are that
while irrIrrlichtDevicePopEvent(evt) do
produces a never-ending stream of events, with the loop never exiting, and
if (irrSEventIsKeyboardInputEvent(evt)) then
says that every single one of them is a keyboard event, even when none such has occurred.
Is there any documentation at all? I was not expecting this: https://www.google.co.uk/search?q=irrIrrlichtDevicePopEvent
And neither was I expecting this: https://github.com/digiorgi/cirrlicht
Pete
7. Re: Eu Help
- Posted by Icy_Viking Nov 01, 2017
- 1293 views
I've rebuilt it with release DLLs, instead of the debug DLLs I had originally built it with. Here is the file: http://www.rapideuphoria.com/uploads/euirr.zip
Much better, that seems to work fine, at least on the two original demos.
My initial findings are that
while irrIrrlichtDevicePopEvent(evt) do
produces a never-ending stream of events, with the loop never exiting, and
if (irrSEventIsKeyboardInputEvent(evt)) then
says that every single one of them is a keyboard event, even when none such has occurred.
Is there any documentation at all? I was not expecting this: https://www.google.co.uk/search?q=irrIrrlichtDevicePopEvent
And neither was I expecting this: https://github.com/digiorgi/cirrlicht
Pete
Yes the original github page is gone. However I still have the source code.
C Code
/** * Test if there is a new event waiting to be processed * \param[in] device The irrIrrlichtDevice * \param[out] event A valid irrSEvent pointer where the return data will be stored * \retval true if the event parameter has been modified with a new event. * \retval false if there is no more events pending. */ CIRR_API IRR_BOOL irrIrrlichtDevicePopEvent(irrSEvent out_event); #pragma once #include <cirrlicht/export.h> CIRR_DEFINE(irr_EKEY_CODE,irr::EKEY_CODE*); #ifndef CIRR_KEY_CODE #define CIRR_KEY_CODE(x) CIRR_API irr_EKEY_CODE irr_EKEY_CODE_KEY_ ## x (); #endif CIRR_KEY_CODE(LBUTTON) CIRR_KEY_CODE(RBUTTON) CIRR_KEY_CODE(CANCEL) CIRR_KEY_CODE(MBUTTON) CIRR_KEY_CODE(XBUTTON1) CIRR_KEY_CODE(XBUTTON2)// Windows 2000/XP: X2 mouse button CIRR_KEY_CODE(BACK) // BACKSPACE key CIRR_KEY_CODE(TAB) // TAB key CIRR_KEY_CODE(CLEAR)// CLEAR key CIRR_KEY_CODE(RETURN)// ENTER key CIRR_KEY_CODE(SHIFT)// SHIFT key CIRR_KEY_CODE(CONTROL)// CTRL key CIRR_KEY_CODE(MENU) // ALT key CIRR_KEY_CODE(PAUSE)// PAUSE key CIRR_KEY_CODE(CAPITAL)// CAPS LOCK key CIRR_KEY_CODE(KANA)// IME Kana mode CIRR_KEY_CODE(HANGUEL)// IME Hanguel mode (maintained for compatibility use KEY_HANGUL) CIRR_KEY_CODE(HANGUL)// IME Hangul mode CIRR_KEY_CODE(JUNJA)// IME Junja mode CIRR_KEY_CODE(FINAL)// IME final mode CIRR_KEY_CODE(HANJA)// IME Hanja mode CIRR_KEY_CODE(KANJI)// IME Kanji mode CIRR_KEY_CODE(ESCAPE)// ESC key CIRR_KEY_CODE(CONVERT)// IME convert CIRR_KEY_CODE(NONCONVERT)// IME nonconvert CIRR_KEY_CODE(ACCEPT)// IME accept CIRR_KEY_CODE(MODECHANGE)// IME mode change request CIRR_KEY_CODE(SPACE)// SPACEBAR CIRR_KEY_CODE(PRIOR)// PAGE UP key CIRR_KEY_CODE(NEXT)// PAGE DOWN key CIRR_KEY_CODE(END)// END key CIRR_KEY_CODE(HOME)// HOME key CIRR_KEY_CODE(LEFT)// LEFT ARROW key CIRR_KEY_CODE(UP)// UP ARROW key CIRR_KEY_CODE(RIGHT)// RIGHT ARROW key CIRR_KEY_CODE(DOWN)// DOWN ARROW key CIRR_KEY_CODE(SELECT)// SELECT key CIRR_KEY_CODE(PRINT)// PRINT key CIRR_KEY_CODE(EXECUT)// EXECUTE key CIRR_KEY_CODE(SNAPSHOT)// PRINT SCREEN key CIRR_KEY_CODE(INSERT)// INS key CIRR_KEY_CODE(DELETE)// DEL key CIRR_KEY_CODE(HELP)// HELP key CIRR_KEY_CODE(KEY_0)// 0 key CIRR_KEY_CODE(KEY_1)// 1 key CIRR_KEY_CODE(KEY_2)// 2 key CIRR_KEY_CODE(KEY_3)// 3 key CIRR_KEY_CODE(KEY_4)// 4 key CIRR_KEY_CODE(KEY_5)// 5 key CIRR_KEY_CODE(KEY_6) // 6 key CIRR_KEY_CODE(KEY_7)// 7 key CIRR_KEY_CODE(KEY_8)// 8 key CIRR_KEY_CODE(KEY_9)// 9 key CIRR_KEY_CODE(KEY_A) // A key CIRR_KEY_CODE(KEY_B)// B key CIRR_KEY_CODE(KEY_C)// C key CIRR_KEY_CODE(KEY_D)// D key CIRR_KEY_CODE(KEY_E)// E key CIRR_KEY_CODE(KEY_F)// F key CIRR_KEY_CODE(KEY_G)// G key CIRR_KEY_CODE(KEY_H)// H key CIRR_KEY_CODE(KEY_I)// I key CIRR_KEY_CODE(KEY_J)// J key CIRR_KEY_CODE(KEY_K)// K key CIRR_KEY_CODE(KEY_L)// L key CIRR_KEY_CODE(KEY_M)// M key CIRR_KEY_CODE(KEY_N)// N key CIRR_KEY_CODE(KEY_O)// O key CIRR_KEY_CODE(KEY_P)// P key CIRR_KEY_CODE(KEY_Q)// Q key CIRR_KEY_CODE(KEY_R)// R key CIRR_KEY_CODE(KEY_S)// S key CIRR_KEY_CODE(KEY_T)// T key CIRR_KEY_CODE(KEY_U)// U key CIRR_KEY_CODE(KEY_V)// V key CIRR_KEY_CODE(KEY_W)// W key CIRR_KEY_CODE(KEY_X)// X key CIRR_KEY_CODE(KEY_Y)// Y key CIRR_KEY_CODE(KEY_Z)// Z key CIRR_KEY_CODE(LWIN)// Left Windows key (Microsoft® Natural® keyboard) CIRR_KEY_CODE(RWIN) // Right Windows key (Natural keyboard) CIRR_KEY_CODE(APPS)// Applications key (Natural keyboard) CIRR_KEY_CODE(SLEEP)// Computer Sleep key CIRR_KEY_CODE(NUMPAD0)// Numeric keypad 0 key CIRR_KEY_CODE(NUMPAD1)// Numeric keypad 1 key CIRR_KEY_CODE(NUMPAD2)// Numeric keypad 2 key CIRR_KEY_CODE(NUMPAD3) // Numeric keypad 3 key CIRR_KEY_CODE(NUMPAD4)// Numeric keypad 4 key CIRR_KEY_CODE(NUMPAD5)// Numeric keypad 5 key CIRR_KEY_CODE(NUMPAD6)// Numeric keypad 6 key CIRR_KEY_CODE(NUMPAD7)// Numeric keypad 7 key CIRR_KEY_CODE(NUMPAD8)// Numeric keypad 8 key CIRR_KEY_CODE(NUMPAD9)// Numeric keypad 9 key CIRR_KEY_CODE(MULTIPLY)// Multiply key CIRR_KEY_CODE(ADD)// Add key CIRR_KEY_CODE(SEPARATOR)// Separator key CIRR_KEY_CODE(SUBTRACT)// Subtract key CIRR_KEY_CODE(DECIMAL)// Decimal key CIRR_KEY_CODE(DIVIDE)// Divide key CIRR_KEY_CODE(F1)// F1 key CIRR_KEY_CODE(F2)// F2 key CIRR_KEY_CODE(F3)// F3 key CIRR_KEY_CODE(F4)// F4 key CIRR_KEY_CODE(F5)// F5 key CIRR_KEY_CODE(F6)// F6 key CIRR_KEY_CODE(F7)// F7 key CIRR_KEY_CODE(F8)// F8 key CIRR_KEY_CODE(F9)// F9 key CIRR_KEY_CODE(F10)// F10 key CIRR_KEY_CODE(F11)// F11 key CIRR_KEY_CODE(F12)// F12 key CIRR_KEY_CODE(F13)// F13 key CIRR_KEY_CODE(F14)// F14 key CIRR_KEY_CODE(F15)// F15 key CIRR_KEY_CODE(F16)// F16 key CIRR_KEY_CODE(F17)// F17 key CIRR_KEY_CODE(F18)// F18 key CIRR_KEY_CODE(F19)// F19 key CIRR_KEY_CODE(F20)// F20 key CIRR_KEY_CODE(F21)// F21 key CIRR_KEY_CODE(F22) // F22 key CIRR_KEY_CODE(F23) // F23 key CIRR_KEY_CODE(F24)// F24 key CIRR_KEY_CODE(NUMLOCK)// NUM LOCK key CIRR_KEY_CODE(SCROLL) // SCROLL LOCK key CIRR_KEY_CODE(LSHIFT)// Left SHIFT key CIRR_KEY_CODE(RSHIFT)// Right SHIFT key CIRR_KEY_CODE(LCONTROL)// Left CONTROL key CIRR_KEY_CODE(RCONTROL)// Right CONTROL key CIRR_KEY_CODE(LMENU)// Left MENU key CIRR_KEY_CODE(RMENU)// Right MENU key CIRR_KEY_CODE(OEM_1) // for US ";:" CIRR_KEY_CODE(PLUS) // Plus Key "+" CIRR_KEY_CODE(COMMA) // Comma Key "," CIRR_KEY_CODE(MINUS) // Minus Key "-" CIRR_KEY_CODE(PERIOD) // Period Key "." CIRR_KEY_CODE(OEM_2) // for US "/?" CIRR_KEY_CODE(OEM_3) // for US "`~" CIRR_KEY_CODE(OEM_4) // for US "[{" CIRR_KEY_CODE(OEM_5) // for US "\|" CIRR_KEY_CODE(OEM_6) // for US "]}" CIRR_KEY_CODE(OEM_7) // for US "'"" CIRR_KEY_CODE(OEM_8) // None CIRR_KEY_CODE(OEM_AX) // for Japan "AX" CIRR_KEY_CODE(OEM_102) // "<>" or "\|" CIRR_KEY_CODE(ATTN) // Attn key CIRR_KEY_CODE(CRSEL) // CrSel key CIRR_KEY_CODE(EXSEL) // ExSel key CIRR_KEY_CODE(EREOF) // Erase EOF key CIRR_KEY_CODE(PLAY) // Play key CIRR_KEY_CODE(ZOOM) // Zoom key CIRR_KEY_CODE(PA1) // PA1 key CIRR_KEY_CODE(OEM_CLEAR) // Clear key CIRR_KEY_CODE(KEY_CODES_COUNT)// this is not a key, but the amount of keycodes there are. CIRR_API IRR_BOOL irrEKeyCodeEqual(irr_EKEY_CODE, irr_EKEY_CODE); #undef CIRR_CIRR_KEY_CODE CIRR_DEFINE(irrSEvent,irr::SEvent*); CIRR_DEFINE(irrSKeyInput,irr::SEvent::SKeyInput*); CIRR_DEFINE(irrSGUIEvent,irr::SEvent::SGUIEvent*); CIRR_DEFINE(irr_EGUI_EVENT_TYPE, irr::gui::EGUI_EVENT_TYPE*); CIRR_API irr_EKEY_CODE irrSKeyInputGetKey(irrSKeyInput); CIRR_API IRR_BOOL irrSKeyInputIsPressed(irrSKeyInput); CIRR_API irrSKeyInput irrSEventGetKeyInput(irrSEvent); CIRR_API irrSEvent irrSEventNew(); CIRR_API void irrSEventDelete(irrSEvent); CIRR_API IRR_BOOL irrSEventIsKeyboardInputEvent(irrSEvent);
This is probably more then enough, but this C code should help.