/** Initializes the object. @return true if initialized correctly, false otherwise */ bool IND_Math::init() { end(); freeVars(); //----- Random seed ------ #ifdef PLATFORM_LINUX struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); srand(tp.tv_nsec); #endif // OS X does not have clock_gettime, use clock_get_time // Great solution from StackOverflow:http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x #if defined (PLATFORM_IOS) || defined (PLATFORM_OSX) struct timespec tp; clock_serv_t cclock; mach_timespec_t mts; host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); tp.tv_sec = mts.tv_sec; tp.tv_nsec = mts.tv_nsec; srand(static_cast<unsigned>(tp.tv_nsec)); #endif #ifdef PLATFORM_WIN32 srand(GetTickCount()); #endif _ok = true; return _ok; }
/** * End */ void DebugApi::end() { if (_ok) { _count->close(); freeVars(); _ok = false; } }
/** * Frees the manager and all the objects that it contains. */ void IND_Math::end() { if (_ok) { freeVars(); _ok = false; } }
/** * Frees the manager and all the objects that it contains. */ void IND_SpriterManager::end() { if (_ok) { g_debug->header("Finalizing SpriterManager", 5); freeVars(); g_debug->header("SpriterManager finalized", 6); _ok = false; } }
/** * End */ void DebugApi::end() { if (_ok) { #if !LOG_REDIRECT_TO_CONSOLE _count->close(); #endif _timer->stop(); freeVars(); _ok = false; } }
/*! \b Operation: This function frees the manager and all the objects that it contains. */ void IND_SurfaceManager::end() { if (_ok) { g_debug->header("Finalizing SurfaceManager", 5); g_debug->header("Freeing surfaces" , 5); freeVars(); g_debug->header("Surfaces freed", 6); g_debug->header("IND_SurfaceManager finalized", 6); _ok = false; } }
/** @b Operation: This function frees the manager and all the objects that it contains. */ void IND_TmxMapManager::end() { if (_ok) { g_debug->header("Finalizing TmxMapManager", DebugApi::LogHeaderBegin); g_debug->header("Freeing TmxMaps" , DebugApi::LogHeaderBegin); freeVars(); g_debug->header("TmxMaps freed", 6); g_debug->header("TmxMapManager finalized", 6); _ok = false; } }
/** * Frees the manager and all the objects that it contains. */ void IND_3dMeshManager::end() { if (_ok) { // Free the subject if it has already loaded a mesh g_debug->header("Finalizing IND_3dMeshManager", 5); g_debug->header("Freeing 3d Meshes" , 5); freeVars(); g_debug->header("3d meshes freed", 6); g_debug->header("IND_3dMeshManager finalized", 6); _ok = false; } }
/** * Frees the manager and all the objects that it contains. */ void IND_ImageManager::end() { if (_ok) { g_debug->header("Finalizing ImageManager", DebugApi::LogHeaderBegin); g_debug->header("Freeing images" , DebugApi::LogHeaderBegin); freeVars(); FreeImage_DeInitialise(); g_debug->header("Images freed", DebugApi::LogHeaderEnd); g_debug->header("ImageManager finalized", DebugApi::LogHeaderEnd); _ok = false; } }
/** * Frees the manager and all the objects that it contains. */ void IND_FontManager::end() { if (_ok) { // If the object is loaded, we free it g_debug->header("Finalizing FontManager", DebugApi::LogHeaderBegin); g_debug->header("Freeing fonts" , DebugApi::LogHeaderBegin); freeVars(); g_debug->header("Fonts freed", DebugApi::LogHeaderEnd); g_debug->header("FontManager finalized", DebugApi::LogHeaderEnd); _ok = false; } }