Re: Orx Wrapper Hurdles

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

Thanks Greg, this has made it much more clear.

Here's what I have so far. Note that orxASSERT is not wrapped yet, orxDefaultEventHandler and orxEventPayloadSize are structs, so I haven't got around to wrapping/converting to them to Eu code yet. I guess I could release what I have wrapped so far and EuOrx can be a Euphoria community project kinda similar to how Win32lib was. Not sure how many would be interested in helping though.

--Memory Zero is an inline functions 
public procedure orxMemory_Zero(atom d,atom size) 
 
 d = 0 
 size = allocate_data(1000) 
	 
end procedure 
 
--Orx inline Functions converted to Eu 
 
integer sbStopByEvent = orxFALSE 
 
public procedure orx_Execute(atom _u32NbParams,sequence _azParams,sequence _zInit,sequence _zRun,sequence _zExit,integer _fnInit=routine_id(_zInit),integer _fnRun=routine_id(_zRun),integer _fnExit=routine_id(_zExit)) 
 
 orxDebug_Init() 
  
 --orxASSERT not wrapped yet 
  
 orxModule_Register(orxMODULE_ID_MAIN,"MAIN",routine_id("orx_MainSetup"),_fnInit,_fnExit) 
  
 if orxParam_SetArgs(_u32NbParams, _azParams) != orxSTATUS_FAILURE then 
 	 
	if orxModule_Init(orxMODULE_ID_MAIN) != orxSTATUS_FAILURE then 
		atom stPayload = allocate_data(1000) 
		integer eClockStatus,eMainStatus 
		integer bStop = orxFALSE 
		atom u32FrameCount 
		 
		orxEvent_AddHandler(orxEVENT_TYPE_SYSTEM, 1) 
		orxEvent_SetHandlerIDFlags(1,orxEVENT_TYPE_SYSTEM,orxNULL,orxEVENT_GET_FLAG=orxSYSTEM_EVENT_CLOSE, orxEVENT_KU32_MASK_ID_ALL) 
		 
        orxMemory_Zero(stPayload,allocate_data(1000)) 
         
 		while bStop = orxFALSE do 
 		 
 			orxEvent_Send(orxEVENT_TYPE_SYSTEM+orxSYSTEM_EVENT_GAME_LOOP_START+orxNULL+orxNULL+stPayload) 
 			 
			eMainStatus = call_func(_fnRun,{}) 
			eClockStatus = orxClock_Update() 
			 
			orxEvent_Send(orxEVENT_TYPE_SYSTEM+orxSYSTEM_EVENT_GAME_LOOP_STOP+orxNULL+orxNULL+stPayload) 
			 
			u32FrameCount = peek4u(stPayload + 1) 
			poke4(stPayload + orxEVENT_TYPE_SYSTEM,u32FrameCount + 1) 
			bStop = ((sbStopByEvent != orxFALSE) or (eMainStatus = orxSTATUS_FAILURE) or (eClockStatus = orxSTATUS_FAILURE)) 
 		end while 
 		 
       orxEvent_RemoveHandler(orxEVENT_TYPE_SYSTEM,1) 
        
		orxModule_Exit(orxMODULE_ID_MAIN) 
		 
		free(stPayload) 
	end if 
 
 end if 
  
  orxDebug_Exit() 
	 
end procedure 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu