EPhysics: properly initializes library

It wasn't initializing required libs.



SVN revision: 73384
This commit is contained in:
Bruno Dilly 2012-07-05 22:53:28 +00:00
parent 9b1d6ecb87
commit 6208fcfaf3
1 changed files with 31 additions and 6 deletions

View File

@ -2,6 +2,9 @@
# include <config.h> # include <config.h>
#endif #endif
#include "Ecore.h"
#include "Eina.h"
#include "ephysics_private.h" #include "ephysics_private.h"
#ifdef __cplusplus #ifdef __cplusplus
@ -17,24 +20,43 @@ ephysics_init()
if (++_ephysics_init_count != 1) if (++_ephysics_init_count != 1)
return _ephysics_init_count; return _ephysics_init_count;
if (!eina_init())
{
EINA_LOG_CRIT("Couldn't init eina");
return --_ephysics_init_count;
}
if (!ecore_init())
{
EINA_LOG_CRIT("Couldn't init ecore");
goto no_ecore;
}
_ephysics_log_dom = eina_log_domain_register("ephysics", EPHYSICS_LOG_COLOR); _ephysics_log_dom = eina_log_domain_register("ephysics", EPHYSICS_LOG_COLOR);
if (_ephysics_log_dom < 0) if (_ephysics_log_dom < 0)
{ {
EINA_LOG_ERR("Couldn't create a log domain for ephysics"); EINA_LOG_CRIT("Couldn't create a log domain for ephysics");
return --_ephysics_init_count; goto no_log;
} }
if (!ephysics_world_init()) if (!ephysics_world_init())
{ {
ERR("Couldn't initialize worlds"); ERR("Couldn't initialize worlds");
eina_log_domain_unregister(_ephysics_log_dom); goto no_world;
_ephysics_log_dom = -1;
return --_ephysics_init_count;
} }
INF("EPhysics initialized"); INF("EPhysics initialized");
return _ephysics_init_count; return _ephysics_init_count;
no_world:
eina_log_domain_unregister(_ephysics_log_dom);
_ephysics_log_dom = -1;
no_log:
ecore_shutdown();
no_ecore:
eina_shutdown();
return --_ephysics_init_count;
} }
EAPI int EAPI int
@ -50,6 +72,9 @@ ephysics_shutdown()
eina_log_domain_unregister(_ephysics_log_dom); eina_log_domain_unregister(_ephysics_log_dom);
_ephysics_log_dom = -1; _ephysics_log_dom = -1;
ecore_shutdown();
eina_shutdown();
return _ephysics_init_count; return _ephysics_init_count;
} }