Wrapper Help Again

new topic     » topic index » view thread      » older message » newer message

Hello,

I am having some trouble wrapping the key codes for my Irrlicht wrapper.

C Code in Header File

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_API IRR_BOOL irrEKeyCodeEqual(irr_EKEY_CODE, irr_EKEY_CODE); 
 
#undef CIRR_CIRR_KEY_CODE 

C Code example

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"); 
      } 

Eu Wrapper Code

public constant xirrSEventGetKeyInput = define_c_func(irr,"irrSEventGetKeyInput",{C_POINTER},C_POINTER) 
 
public function irrSEventGetKeyInput(atom evt) 
 
 return c_func(xirrSEventGetKeyInput,{evt}) 
	 
end function 
 
public constant xirrSKeyInputGetKey = define_c_func(irr,"irrSKeyInputGetKey",{C_POINTER},C_POINTER) 
 
public function irrSKeyInputGetKey(atom evt) 
 
 return c_func(xirrSKeyInputGetKey,{evt}) 
	 
end function 
 
public constant xirrSKeyInputIsPressed = define_c_func(irr,"irrSKeyInputIsPressed",{C_POINTER},C_BOOL) 
 
public function irrSKeyInputIsPressed(atom evt) 
 
 return c_func(xirrSKeyInputIsPressed,{evt}) 
	 
end function 
 
public constant xirrSGUIEventGetCaller = define_c_func(irr,"irrSGUIEventGetCaller",{C_POINTER},C_POINTER) 
 
public function irrSGUIEventGetCaller(atom evt) 
 
 return c_func(xirrSGUIEventGetCaller,{evt}) 
	 
end function 
 
public constant xirrSGUIEventGetElement = define_c_func(irr,"irrSGUIEventGetElement",{C_POINTER},C_POINTER) 
 
public function irrSGUIEventGetElement(atom evt) 
 
 return c_func(xirrSGUIEventGetElement,{evt}) 
	 
end function 
 
public constant xirrSGUIEventGetEventType = define_c_func(irr,"irrSGUIEventGetEventType",{C_POINTER},C_POINTER) 
 
public function irrSGUIEventGetEventType(atom evt) 
 
 return c_func(xirrSGUIEventGetEventType,{evt}) 
	 
end function 
 
public constant xirrSGUIEventIsEventType = define_c_func(irr,"irrSGUIEventIsEventType",{C_POINTER,C_POINTER},C_BOOL) 
 
public function irrSGUIEventIsEventType(atom evt,atom xtype) 
 
 return c_func(xirrSGUIEventIsEventType,{evt,xtype}) 
	 
end function 
 
--Irr Key Code 
 
public constant xirrEKeyCodeEqual = define_c_func(irr,"irrEKeyCodeEqual",{C_POINTER,C_POINTER},C_BOOL) 
 
public function irrEKeyCodeEqual(atom code,atom code2) 
 
 return c_func(xirrEKeyCodeEqual,{code,code2}) 
	 
end function 

Eu Example

	evt = irrSEventNew() 
	 
	while irrIrrlichtDevicePopEvent(evt) do 
		if irrSEventIsKeyboardInputEvent(evt) then 
			atom keyIn = irrSEventGetKeyInput(evt) 
			atom keyCode = irrSKeyInputGetKey(keyIn) 
		end if	 
	end while 

I'm not sure how I'd wrap the EKEY Codes in Irrlicht. The codes are exported in the DLL as irr_EKEY_CODE_KEY_ESCAPE and so on. I'd assume you'd have to wrap them as any other function, but I'm not entirely sure as how to go about it. Most other libraries have their keycodes as ENUMS, but not Irrlicht. Any help is appericated.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu