/** Creates an empty SoundPointer * @return Created orxSOUNDPOINTER / orxNULL */ orxSOUNDPOINTER *orxFASTCALL orxSoundPointer_Create() { orxSOUNDPOINTER *pstResult; /* Checks */ orxASSERT(sstSoundPointer.u32Flags & orxSOUNDPOINTER_KU32_STATIC_FLAG_READY); /* Creates SoundPointer */ pstResult = orxSOUNDPOINTER(orxStructure_Create(orxSTRUCTURE_ID_SOUNDPOINTER)); /* Created? */ if(pstResult != orxNULL) { /* Clears last added sound index */ pstResult->u32LastAddedIndex = orxU32_UNDEFINED; /* Inits flags */ orxStructure_SetFlags(pstResult, orxSOUNDPOINTER_KU32_FLAG_ENABLED, orxSOUNDPOINTER_KU32_MASK_ALL); /* Increases counter */ orxStructure_IncreaseCounter(pstResult); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_SOUND, "Failed to create Sound Pointer structure."); } /* Done! */ return pstResult; }
/** Creates an empty FXPointer * @return Created orxFXPOINTER / orxNULL */ orxFXPOINTER *orxFASTCALL orxFXPointer_Create() { orxFXPOINTER *pstResult; /* Checks */ orxASSERT(sstFXPointer.u32Flags & orxFXPOINTER_KU32_STATIC_FLAG_READY); /* Creates FXPointer */ pstResult = orxFXPOINTER(orxStructure_Create(orxSTRUCTURE_ID_FXPOINTER)); /* Created? */ if(pstResult != orxNULL) { /* Inits flags */ orxStructure_SetFlags(pstResult, orxFXPOINTER_KU32_FLAG_ENABLED, orxFXPOINTER_KU32_MASK_ALL); /* Increases counter */ orxStructure_IncreaseCounter(pstResult); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_OBJECT, "Failed to create FX pointer structure."); } /* Done! */ return pstResult; }
/** Creates an empty TimeLine * @return Created orxTIMELINE / orxNULL */ orxTIMELINE *orxFASTCALL orxTimeLine_Create() { orxTIMELINE *pstResult; /* Checks */ orxASSERT(sstTimeLine.u32Flags & orxTIMELINE_KU32_STATIC_FLAG_READY); /* Creates TimeLine */ pstResult = orxTIMELINE(orxStructure_Create(orxSTRUCTURE_ID_TIMELINE)); /* Created? */ if(pstResult != orxNULL) { /* Inits flags */ orxStructure_SetFlags(pstResult, orxTIMELINE_KU32_FLAG_ENABLED, orxTIMELINE_KU32_MASK_ALL); /* Increases counter */ orxStructure_IncreaseCounter(pstResult); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_OBJECT, "Failed to create TimeLine structure."); } /* Done! */ return pstResult; }
/** Creates an empty text * @return orxTEXT / orxNULL */ orxTEXT *orxFASTCALL orxText_Create() { orxTEXT *pstResult; /* Checks */ orxASSERT(sstText.u32Flags & orxTEXT_KU32_STATIC_FLAG_READY); /* Creates text */ pstResult = orxTEXT(orxStructure_Create(orxSTRUCTURE_ID_TEXT)); /* Created? */ if(pstResult != orxNULL) { /* Inits it */ pstResult->zString = orxNULL; pstResult->pstFont = orxNULL; /* Inits flags */ orxStructure_SetFlags(pstResult, orxTEXT_KU32_FLAG_NONE, orxTEXT_KU32_MASK_ALL); /* Increases counter */ orxStructure_IncreaseCounter(pstResult); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_DISPLAY, "Failed to create structure for text."); } /* Done! */ return pstResult; }
/** Creates an empty graphic * @return Created orxGRAPHIC / orxNULL */ orxGRAPHIC *orxFASTCALL orxGraphic_Create() { orxGRAPHIC *pstGraphic; /* Checks */ orxASSERT(sstGraphic.u32Flags & orxGRAPHIC_KU32_STATIC_FLAG_READY); /* Creates graphic */ pstGraphic = orxGRAPHIC(orxStructure_Create(orxSTRUCTURE_ID_GRAPHIC)); /* Valid? */ if(pstGraphic != orxNULL) { /* Inits flags */ orxStructure_SetFlags(pstGraphic, orxGRAPHIC_KU32_FLAG_NONE, orxGRAPHIC_KU32_MASK_ALL); /* Clears its color */ orxGraphic_ClearColor(pstGraphic); /* Sets its repeat value to default */ orxGraphic_SetRepeat(pstGraphic, orxFLOAT_1, orxFLOAT_1); /* Increases counter */ orxStructure_IncreaseCounter(pstGraphic); } /* Done! */ return pstGraphic; }
/** Creates a clock * @param[in] _fTickSize Tick size for the clock (in seconds) * @param[in] _eType Type of the clock * @return orxCLOCK / orxNULL */ orxCLOCK *orxFASTCALL orxClock_Create(orxFLOAT _fTickSize, orxCLOCK_TYPE _eType) { orxCLOCK *pstClock; /* Checks */ orxASSERT(sstClock.u32Flags & orxCLOCK_KU32_STATIC_FLAG_READY); orxASSERT(_fTickSize >= orxFLOAT_0); /* Creates clock */ pstClock = orxCLOCK(orxStructure_Create(orxSTRUCTURE_ID_CLOCK)); /* Valid? */ if(pstClock != orxNULL) { /* Creates function bank */ pstClock->pstFunctionBank = orxBank_Create(orxCLOCK_KU32_FUNCTION_BANK_SIZE, sizeof(orxCLOCK_FUNCTION_STORAGE), orxBANK_KU32_FLAG_NONE, orxMEMORY_TYPE_MAIN); /* Valid? */ if(pstClock->pstFunctionBank != orxNULL) { /* Inits clock */ pstClock->stClockInfo.fTickSize = _fTickSize; pstClock->stClockInfo.eType = _eType; pstClock->stClockInfo.eModType = orxCLOCK_MOD_TYPE_NONE; orxStructure_SetFlags(pstClock, orxCLOCK_KU32_FLAG_NONE, orxCLOCK_KU32_MASK_ALL); /* Increases counter */ orxStructure_IncreaseCounter(pstClock); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_CLOCK, "Couldn't create clock function storage."); /* Deletes clock */ orxStructure_Delete(pstClock); /* Not allocated */ pstClock = orxNULL; } } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_CLOCK, "Couldn't allocate bank for clock."); } /* Done! */ return pstClock; }
/** Creates a camera * @param[in] _u32Flags Camera flags (2D / ...) * @return Created orxCAMERA / orxNULL */ orxCAMERA *orxFASTCALL orxCamera_Create(orxU32 _u32Flags) { orxCAMERA *pstCamera = orxNULL; orxFRAME *pstFrame; /* Checks */ orxASSERT(sstCamera.u32Flags & orxCAMERA_KU32_STATIC_FLAG_READY); orxASSERT((_u32Flags & orxCAMERA_KU32_MASK_USER_ALL) == _u32Flags); /* Creates camera */ pstCamera = orxCAMERA(orxStructure_Create(orxSTRUCTURE_ID_CAMERA)); /* Valid? */ if(pstCamera != orxNULL) { /* Creates frame */ pstFrame = orxFrame_Create(orxFRAME_KU32_FLAG_NONE); /* Valid? */ if(pstFrame != orxNULL) { /* 2D? */ if(orxFLAG_TEST(_u32Flags, orxCAMERA_KU32_FLAG_2D)) { /* Stores frame */ pstCamera->pstFrame = pstFrame; /* Increases its reference counter */ orxStructure_IncreaseCounter(pstFrame); /* Updates flags */ orxStructure_SetFlags(pstCamera, orxCAMERA_KU32_FLAG_2D, orxCAMERA_KU32_FLAG_NONE); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_RENDER, "Camera currently only supports 2d."); /* Fress partially allocated camera */ orxFrame_Delete(pstFrame); orxStructure_Delete(pstCamera); /* Updates result */ pstCamera = orxNULL; } } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_RENDER, "Failed to create camera's frame."); /* Fress partially allocated camera */ orxStructure_Delete(pstCamera); /* Updates result */ pstCamera = orxNULL; } } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_RENDER, "Failed to create camera."); } /* Done! */ return pstCamera; }