/** Init function */ orxSTATUS orxFASTCALL Init() { orxINPUT_TYPE eType; orxENUM eID; orxINPUT_MODE eMode; const orxSTRING zInputNextConfig; const orxSTRING zInputPreviousConfig; /* Gets binding names */ orxInput_GetBinding("NextConfig", 0, &eType, &eID, &eMode); zInputNextConfig = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("PreviousConfig", 0, &eType, &eID, &eMode); zInputPreviousConfig = orxInput_GetBindingName(eType, eID, eMode); /* Displays a small hint in console */ orxLOG("\n- '%s' will switch to the next config settings" "\n- '%s' will switch to the previous config settings" "\n* Config files are used with inheritance to provide all the combinations" "\n* All the tests use the same minimalist code (creating 1 object & 1 viewport)", zInputNextConfig, zInputPreviousConfig); /* Loads default configuration */ return LoadConfig(); }
void orxFASTCALL orxDisplay_SDL_DeleteText(orxDISPLAY_TEXT *_pstText) { /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstText != orxNULL); /* Not yet implemented */ orxLOG("Not yet implemented!"); }
orxHANDLE orxFASTCALL orxDisplay_SDL_CreateShader(const orxSTRING _zCode, const orxLINKLIST *_pstParamList) { orxHANDLE hResult = orxHANDLE_UNDEFINED; /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return hResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_RenderShader(orxHANDLE _hShader) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return eResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetShaderBitmap(orxHANDLE _hShader, const orxSTRING _zParam, orxBITMAP *_pstValue) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return eResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetShaderVector(orxHANDLE _hShader, const orxSTRING _zParam, const orxVECTOR *_pvValue) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return eResult; }
orxHANDLE orxFASTCALL orxDisplay_SDL_GetApplicationInput() { orxHANDLE hResult = orxHANDLE_UNDEFINED; /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return hResult; }
static orxSTATUS orxFASTCALL Run() { orxSTATUS eResult = orxSTATUS_SUCCESS; orxVECTOR vMousePos, vGravity; /* Updates generator's status */ orxObject_Enable(spstGenerator, orxInput_IsActive("Spawn")); /* Gets mouse position in world space */ if(orxRender_GetWorldPosition(orxMouse_GetPosition(&vMousePos), orxNULL, &vMousePos)) { orxVECTOR vGeneratorPos; /* Gets generator position */ orxObject_GetPosition(spstGenerator, &vGeneratorPos); /* Keeps generator's Z coord */ vMousePos.fZ = vGeneratorPos.fZ; /* Updates generator's position */ orxObject_SetPosition(spstGenerator, &vMousePos); } /* Gets gravity vector from input */ orxVector_Set(&vGravity, orxInput_GetValue("GravityX"), -orxInput_GetValue("GravityY"), orxFLOAT_0); /* Significant enough? */ if(orxVector_GetSquareSize(&vGravity) > orx2F(0.5f)) { static orxVECTOR svSmoothedGravity = { orx2F(0.0f), orx2F(-1.0f), orx2F(0.0f) }; /* Gets smoothed gravity from new value (low-pass filter) */ orxVector_Lerp(&svSmoothedGravity, &svSmoothedGravity, &vGravity, orx2F(0.05f)); /* Updates camera rotation */ orxCamera_SetRotation(orxViewport_GetCamera(spstViewport), orxMATH_KF_PI_BY_2 + orxVector_FromCartesianToSpherical(&vGravity, &svSmoothedGravity)->fTheta); } // Is quit action active? if(orxInput_IsActive("Quit")) { // Logs orxLOG("Quit action triggered, exiting!"); // Sets return value to orxSTATUS_FAILURE, meaning we want to exit eResult = orxSTATUS_FAILURE; } return eResult; }
orxDISPLAY_VIDEO_MODE *orxFASTCALL orxDisplay_SDL_GetVideoMode(orxU32 _u32Index, orxDISPLAY_VIDEO_MODE *_pstVideoMode) { orxDISPLAY_VIDEO_MODE *pstResult = orxNULL; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return pstResult; }
orxU32 orxFASTCALL orxDisplay_SDL_GetVideoModeCounter() { orxU32 u32Result = 0; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return u32Result; }
orxBOOL orxFASTCALL orxDisplay_SDL_IsFullScreen() { orxBOOL bResult = orxFALSE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return bResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetFullScreen(orxBOOL _bFullScreen) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return eResult; }
orxBOOL orxFASTCALL orxDisplay_SDL_IsVideoModeAvailable(const orxDISPLAY_VIDEO_MODE *_pstVideoMode) { orxBOOL bResult = orxFALSE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return bResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetVideoMode(const orxDISPLAY_VIDEO_MODE *_pstVideoMode) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not implemented yet!"); /* Done! */ return eResult; }
orxDISPLAY_TEXT *orxFASTCALL orxDisplay_SDL_CreateText() { orxDISPLAY_TEXT *pstResult = orxNULL; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return pstResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetTextString(orxDISPLAY_TEXT *_pstText, const orxSTRING _zString) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstText != orxNULL); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return eResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_SetBitmapColor(orxBITMAP *_pstBitmap, orxRGBA _stColor) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT((_pstBitmap != orxNULL) && (_pstBitmap != (orxBITMAP *)sstDisplay.pstScreen)); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return eResult; }
orxSTRING orxFASTCALL orxDisplay_SDL_GetTextFont(const orxDISPLAY_TEXT *_pstText) { orxSTRING zResult = orxNULL; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstText != orxNULL); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return zResult; }
orxRGBA orxFASTCALL orxDisplay_SDL_GetBitmapColor(const orxBITMAP *_pstBitmap) { orxRGBA stResult = 0; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT((_pstBitmap != orxNULL) && (_pstBitmap != (orxBITMAP *)sstDisplay.pstScreen)); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return stResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_TransformText(orxBITMAP *_pstDst, const orxDISPLAY_TEXT *_pstText, const orxDISPLAY_TRANSFORM *_pstTransform, orxRGBA _stColor, orxDISPLAY_BLEND_MODE _eBlendMode) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstDst != orxNULL); orxASSERT(_pstText != orxNULL); orxASSERT(_pstTransform != orxNULL); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return eResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_GetTextSize(const orxDISPLAY_TEXT *_pstText, orxFLOAT *_pfWidth, orxFLOAT *_pfHeight) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstText != orxNULL); orxASSERT(_pfWidth != orxNULL); orxASSERT(_pfHeight != orxNULL); /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return eResult; }
orxSTATUS orxFASTCALL orxDisplay_SDL_PrintString(const orxBITMAP *_pstBitmap, const orxSTRING _zString, const orxDISPLAY_TRANSFORM *_pstTransform, orxRGBA _stColor) { orxSTATUS eResult = orxSTATUS_FAILURE; /* Checks */ orxASSERT((sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY) == orxDISPLAY_KU32_STATIC_FLAG_READY); orxASSERT(_pstBitmap != orxNULL); orxASSERT(_pstTransform != orxNULL); /* TODO : * Write the string onto screen, using char per char pixel writing */ /* Not yet implemented */ orxLOG("Not yet implemented!"); /* Done! */ return eResult; }
/** Inits the tutorial */ orxSTATUS orxFASTCALL Init() { orxCLOCK *pstClock; orxINPUT_TYPE eType; orxENUM eID; orxINPUT_MODE eMode; const orxSTRING zInputCameraLeft; const orxSTRING zInputCameraRight; const orxSTRING zInputCameraUp; const orxSTRING zInputCameraDown; const orxSTRING zInputCameraRotateLeft; const orxSTRING zInputCameraRotateRight; const orxSTRING zInputCameraZoomIn; const orxSTRING zInputCameraZoomOut; const orxSTRING zInputViewportLeft; const orxSTRING zInputViewportRight; const orxSTRING zInputViewportUp; const orxSTRING zInputViewportDown; const orxSTRING zInputViewportScaleUp; const orxSTRING zInputViewportScaleDown; /* Gets input binding names */ orxInput_GetBinding("CameraLeft", 0, &eType, &eID, &eMode); zInputCameraLeft = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraRight", 0, &eType, &eID, &eMode); zInputCameraRight = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraUp", 0, &eType, &eID, &eMode); zInputCameraUp = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraDown", 0, &eType, &eID, &eMode); zInputCameraDown = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraRotateLeft", 0, &eType, &eID, &eMode); zInputCameraRotateLeft = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraRotateRight", 0, &eType, &eID, &eMode); zInputCameraRotateRight = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraZoomIn", 0, &eType, &eID, &eMode); zInputCameraZoomIn = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("CameraZoomOut", 0, &eType, &eID, &eMode); zInputCameraZoomOut = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportLeft", 0, &eType, &eID, &eMode); zInputViewportLeft = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportRight", 0, &eType, &eID, &eMode); zInputViewportRight = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportUp", 0, &eType, &eID, &eMode); zInputViewportUp = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportDown", 0, &eType, &eID, &eMode); zInputViewportDown = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportScaleUp", 0, &eType, &eID, &eMode); zInputViewportScaleUp = orxInput_GetBindingName(eType, eID, eMode); orxInput_GetBinding("ViewportScaleDown", 0, &eType, &eID, &eMode); zInputViewportScaleDown = orxInput_GetBindingName(eType, eID, eMode); /* Displays a small hint in console */ orxLOG("\n* Worskpaces 1 & 4 display camera 1 content" "\n* Workspace 2 displays camera 2 (by default it's twice as close as the other cameras)" "\n* Workspace 3 displays camera 3" "\n- Soldier will be positioned (in the world) so as to be always displayed under the mouse" "\n- '%s', '%s', '%s' & '%s' control camera 1 positioning" "\n- '%s' & '%s' control camera 1 rotation" "\n- '%s' & '%s' control camera 1 zoom" "\n- '%s', '%s', '%s' & '%s' control viewport 1 positioning" "\n- '%s' & '%s' control viewport 1 size", zInputCameraUp, zInputCameraLeft, zInputCameraDown, zInputCameraRight, zInputCameraRotateLeft, zInputCameraRotateRight, zInputCameraZoomIn, zInputCameraZoomOut, zInputViewportUp, zInputViewportLeft, zInputViewportDown, zInputViewportRight, zInputViewportScaleUp, zInputViewportScaleDown); /* Creates all viewports */ orxViewport_CreateFromConfig("Viewport4"); orxViewport_CreateFromConfig("Viewport3"); orxViewport_CreateFromConfig("Viewport2"); pstViewport = orxViewport_CreateFromConfig("Viewport1"); /* Creates objects */ orxObject_CreateFromConfig("Box"); pstSoldier = orxObject_CreateFromConfig("Soldier"); /* Gets the main clock */ pstClock = orxClock_FindFirst(orx2F(-1.0f), orxCLOCK_TYPE_CORE); /* Registers our update callback */ orxClock_Register(pstClock, Update, orxNULL, orxMODULE_ID_MAIN, orxCLOCK_PRIORITY_NORMAL); /* Done! */ return orxSTATUS_SUCCESS; }
/** Bounce event handler * @param[in] _pstEvent Sent event * @return orxSTATUS_SUCCESS if handled / orxSTATUS_FAILURE otherwise */ static orxSTATUS orxFASTCALL orxBounce_EventHandler(const orxEVENT *_pstEvent) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Profiles */ orxPROFILER_PUSH_MARKER("Bounce_EventHandler"); /* Checks */ orxASSERT((_pstEvent->eType == orxEVENT_TYPE_PHYSICS) || (_pstEvent->eType == orxEVENT_TYPE_INPUT) || (_pstEvent->eType == orxEVENT_TYPE_SHADER) || (_pstEvent->eType == orxEVENT_TYPE_SOUND) || (_pstEvent->eType == orxEVENT_TYPE_DISPLAY) || (_pstEvent->eType == orxEVENT_TYPE_TIMELINE) || (_pstEvent->eType == orxEVENT_TYPE_RENDER)); /* Depending on event type */ switch(_pstEvent->eType) { /* Input */ case orxEVENT_TYPE_INPUT: { /* Not a set selection and console not enabled? */ if((_pstEvent->eID != orxINPUT_EVENT_SELECT_SET) && (orxConsole_IsEnabled() == orxFALSE)) { orxINPUT_EVENT_PAYLOAD *pstPayload; /* Gets event payload */ pstPayload = (orxINPUT_EVENT_PAYLOAD *)_pstEvent->pstPayload; /* Has a multi-input info? */ if(pstPayload->aeType[1] != orxINPUT_TYPE_NONE) { /* Logs info */ orxLOG("[%s::%s] is %s (%s/v=%g + %s/v=%g)", pstPayload->zSetName, pstPayload->zInputName, (_pstEvent->eID == orxINPUT_EVENT_ON) ? "ON " : "OFF", orxInput_GetBindingName(pstPayload->aeType[0], pstPayload->aeID[0], pstPayload->aeMode[0]), pstPayload->afValue[0], orxInput_GetBindingName(pstPayload->aeType[1], pstPayload->aeID[1], pstPayload->aeMode[1]), pstPayload->afValue[1]); } else { /* Logs info */ orxLOG("[%s::%s] is %s (%s/v=%g)", pstPayload->zSetName, pstPayload->zInputName, (_pstEvent->eID == orxINPUT_EVENT_ON) ? "ON " : "OFF", orxInput_GetBindingName(pstPayload->aeType[0], pstPayload->aeID[0], pstPayload->aeMode[0]), pstPayload->afValue[0]); } } break; } /* Physics */ case orxEVENT_TYPE_PHYSICS: { /* Colliding? */ if(_pstEvent->eID == orxPHYSICS_EVENT_CONTACT_ADD) { /* Adds bump FX on both objects */ orxObject_AddUniqueFX(orxOBJECT(_pstEvent->hSender), "Bump"); orxObject_AddUniqueFX(orxOBJECT(_pstEvent->hRecipient), "Bump"); } break; } /* Shader */ case orxEVENT_TYPE_SHADER: { orxSHADER_EVENT_PAYLOAD *pstPayload; /* Profiles */ orxPROFILER_PUSH_MARKER("Bounce_EventHandler_Shader"); /* Checks */ orxASSERT(_pstEvent->eID == orxSHADER_EVENT_SET_PARAM); /* Gets its payload */ pstPayload = (orxSHADER_EVENT_PAYLOAD *)_pstEvent->pstPayload; /* Enabled? */ if(!orxString_Compare(pstPayload->zParamName, "enabled")) { /* Updates its value */ pstPayload->fValue = (sbShaderEnabled != orxFALSE) ? orxFLOAT_1 : orxFLOAT_0; } /* Phase? */ else if(!orxString_Compare(pstPayload->zParamName, "phase")) { /* Updates its value */ pstPayload->fValue = sfShaderPhase; } else if(!orxString_Compare(pstPayload->zParamName, "color")) { orxVector_Copy(&pstPayload->vValue, &svColor); } /* Frequency? */ else if(!orxString_Compare(pstPayload->zParamName, "frequency")) { /* Updates its value */ pstPayload->fValue = sfShaderFrequency; } /* Amplitude? */ else if(!orxString_Compare(pstPayload->zParamName, "amplitude")) { /* Updates its value */ pstPayload->fValue = sfShaderAmplitude; } /* Profiles */ orxPROFILER_POP_MARKER(); break; } /* Sound */ case orxEVENT_TYPE_SOUND: { /* Recording packet? */ if(_pstEvent->eID == orxSOUND_EVENT_RECORDING_PACKET) { orxSOUND_EVENT_PAYLOAD *pstPayload; /* Gets event payload */ pstPayload = (orxSOUND_EVENT_PAYLOAD *)_pstEvent->pstPayload; /* Is recording input active? */ if(orxInput_IsActive("Record") != orxFALSE) { orxU32 i; /* For all samples */ for(i = 0; i < pstPayload->stStream.stPacket.u32SampleNumber / 2; i++) { /* Shorten the packets by half */ pstPayload->stStream.stPacket.as16SampleList[i] = pstPayload->stStream.stPacket.as16SampleList[i * 2]; } /* Updates sample number */ pstPayload->stStream.stPacket.u32SampleNumber = pstPayload->stStream.stPacket.u32SampleNumber / 2; /* Asks for writing it */ pstPayload->stStream.stPacket.bDiscard = orxFALSE; } else { /* Asks for not writing it */ pstPayload->stStream.stPacket.bDiscard = orxTRUE; } } break; } /* Display */ case orxEVENT_TYPE_DISPLAY: { /* New video mode? */ if(_pstEvent->eID == orxDISPLAY_EVENT_SET_VIDEO_MODE) { orxDISPLAY_EVENT_PAYLOAD *pstPayload; orxCHAR acBuffer[1024]; /* Gets payload */ pstPayload = (orxDISPLAY_EVENT_PAYLOAD *)_pstEvent->pstPayload; /* Updates title string */ orxConfig_PushSection("Bounce"); orxString_NPrint(acBuffer, sizeof(acBuffer) - 1, "%s (%dx%d)", orxConfig_GetString("Title"), pstPayload->stVideoMode.u32Width, pstPayload->stVideoMode.u32Height); acBuffer[sizeof(acBuffer) - 1] = orxCHAR_NULL; orxConfig_PopSection(); /* Updates display module config content */ orxConfig_PushSection(orxDISPLAY_KZ_CONFIG_SECTION); orxConfig_SetString(orxDISPLAY_KZ_CONFIG_TITLE, acBuffer); orxConfig_PopSection(); /* Updates window */ orxDisplay_SetVideoMode(orxNULL); } break; } /* TimeLine */ case orxEVENT_TYPE_TIMELINE: { /* New event triggered? */ if(_pstEvent->eID == orxTIMELINE_EVENT_TRIGGER) { orxTIMELINE_EVENT_PAYLOAD *pstPayload; /* Gets event payload */ pstPayload = (orxTIMELINE_EVENT_PAYLOAD *)_pstEvent->pstPayload; /* Logs info */ orxLOG("[%s::%s::%s] has been triggered", orxObject_GetName(orxOBJECT(_pstEvent->hSender)), pstPayload->zTrackName, pstPayload->zEvent); } break; } /* Render */ case orxEVENT_TYPE_RENDER: { /* Object start? */ if(_pstEvent->eID == orxRENDER_EVENT_OBJECT_START) { /* Is walls? */ if(orxOBJECT(_pstEvent->hSender) == spstWalls) { /* Pushes config section */ orxConfig_PushSection("Bounce"); /* Should display trail */ if(orxConfig_GetBool("DisplayTrail")) { /* Draws trail */ orxBounce_DisplayTrail(orxTexture_GetBitmap(orxTEXTURE(orxGraphic_GetData(orxOBJECT_GET_STRUCTURE(orxOBJECT(_pstEvent->hSender), GRAPHIC))))); } /* Pops config section */ orxConfig_PopSection(); /* Updates result */ eResult = orxSTATUS_FAILURE; } } break; } default: { break; } } /* Profiles */ orxPROFILER_POP_MARKER(); /* Done! */ return eResult; }
void orxFASTCALL orxDisplay_SDL_DeleteShader(orxHANDLE _hShader) { /* Not yet implemented */ orxLOG("Not implemented yet!"); }
orxSTATUS orxFASTCALL orxDisplay_SDL_Init() { orxSTATUS eResult; /* Was not already initialized? */ if(!(sstDisplay.u32Flags & orxDISPLAY_KU32_STATIC_FLAG_READY)) { /* Cleans static controller */ orxMemory_Zero(&sstDisplay, sizeof(orxDISPLAY_STATIC)); /* Is SDL partly initialized? */ if(SDL_WasInit(SDL_INIT_EVERYTHING) != 0) { /* Inits the video subsystem */ eResult = (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) ? orxSTATUS_SUCCESS : orxSTATUS_FAILURE; } else { /* Inits SDL with video */ eResult = (SDL_Init(SDL_INIT_VIDEO) == 0) ? orxSTATUS_SUCCESS : orxSTATUS_FAILURE; } /* Valid? */ if(eResult != orxSTATUS_FAILURE) { #ifdef __orxGP2X__ /* Inits display using config values? */ sstDisplay.pstScreen = SDL_SetVideoMode(orxDISPLAY_KU32_SCREEN_WIDTH, orxDISPLAY_KU32_SCREEN_HEIGHT, orxDISPLAY_KU32_SCREEN_DEPTH, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT); /* Stores values */ sstDisplay.fScreenWidth = orxU2F(orxDISPLAY_KU32_SCREEN_WIDTH); sstDisplay.fScreenHeight = orxU2F(orxDISPLAY_KU32_SCREEN_HEIGHT); #else /* __orxGP2X__ */ { orxU32 u32ConfigWidth, u32ConfigHeight, u32ConfigDepth, u32Flags; /* Gets resolution from config */ orxConfig_PushSection(orxDISPLAY_KZ_CONFIG_SECTION); u32ConfigWidth = orxConfig_GetU32(orxDISPLAY_KZ_CONFIG_WIDTH); u32ConfigHeight = orxConfig_GetU32(orxDISPLAY_KZ_CONFIG_HEIGHT); u32ConfigDepth = orxConfig_GetU32(orxDISPLAY_KZ_CONFIG_DEPTH); /* Full screen? */ if(orxConfig_GetBool(orxDISPLAY_KZ_CONFIG_FULLSCREEN) != orxFALSE) { /* Updates flags */ u32Flags = SDL_FULLSCREEN | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT; } else { /* Updates flags */ u32Flags = SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT; } /* Inits display using config values? */ if((sstDisplay.pstScreen = SDL_SetVideoMode(u32ConfigWidth, u32ConfigHeight, u32ConfigDepth, u32Flags)) == orxNULL) { /* Inits display using default parameters */ sstDisplay.pstScreen = SDL_SetVideoMode(orxDISPLAY_KU32_SCREEN_WIDTH, orxDISPLAY_KU32_SCREEN_HEIGHT, orxDISPLAY_KU32_SCREEN_DEPTH, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_ANYFORMAT); /* Stores values */ sstDisplay.fScreenWidth = orxU2F(orxDISPLAY_KU32_SCREEN_WIDTH); sstDisplay.fScreenHeight = orxU2F(orxDISPLAY_KU32_SCREEN_HEIGHT); } else { /* Stores values */ sstDisplay.fScreenWidth = orxU2F(u32ConfigWidth); sstDisplay.fScreenHeight = orxU2F(u32ConfigHeight); } /* Pops config section */ orxConfig_PopSection(); } #endif /* __orxGP2X__ */ /* Updates result ? */ eResult = (sstDisplay.pstScreen != NULL) ? orxSTATUS_SUCCESS : orxSTATUS_FAILURE; /* Valid? */ if(eResult != orxSTATUS_FAILURE) { orxCLOCK *pstClock; /* Gets clock */ pstClock = orxClock_FindFirst(orx2F(-1.0f), orxCLOCK_TYPE_CORE); /* Valid? */ if(pstClock != orxNULL) { /* Registers event update function */ eResult = orxClock_Register(pstClock, orxDisplay_SDL_EventUpdate, orxNULL, orxMODULE_ID_DISPLAY, orxCLOCK_PRIORITY_HIGHEST); } /* Decoration? */ if((orxConfig_HasValue(orxDISPLAY_KZ_CONFIG_DECORATION) == orxFALSE) || (orxConfig_GetBool(orxDISPLAY_KZ_CONFIG_DECORATION) != orxFALSE)) { /* Logs message */ orxLOG("This plugin can't remove window decorations."); } /* Has VSync value? */ if(orxConfig_HasValue(orxDISPLAY_KZ_CONFIG_VSYNC) != orxFALSE) { /* Logs message */ orxLOG("This plugin can't handle vsync."); } /* Updates its title */ SDL_WM_SetCaption(orxConfig_GetString(orxDISPLAY_KZ_CONFIG_TITLE), orxNULL); /* Sets module as ready */ sstDisplay.u32Flags = orxDISPLAY_KU32_STATIC_FLAG_READY; } } } /* Done! */ return eResult; }