diff options
author | Bruno Dilly <bdilly@profusion.mobi> | 2012-06-26 22:36:12 +0000 |
---|---|---|
committer | Bruno Dilly <bdilly@profusion.mobi> | 2012-06-26 22:36:12 +0000 |
commit | 28d9f92ef24a0d059470da7f1ef64be9542637d4 (patch) | |
tree | b0e29f1104d72089295d5b6121cc09cf01c81a53 /legacy/ephysics/src/lib/ephysics_main.cpp | |
parent | 3eaa894b6945756814045be4604e417387626fa7 (diff) |
EPhysics: a new library comes to E world
It’s a wrapper between Bullet Physics and EFL to add physics effects
in a simple way.
More details on README, TODO, and edevelop mail list =)
SVN revision: 72896
Diffstat (limited to 'legacy/ephysics/src/lib/ephysics_main.cpp')
-rw-r--r-- | legacy/ephysics/src/lib/ephysics_main.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/legacy/ephysics/src/lib/ephysics_main.cpp b/legacy/ephysics/src/lib/ephysics_main.cpp new file mode 100644 index 0000000000..35680b378f --- /dev/null +++ b/legacy/ephysics/src/lib/ephysics_main.cpp | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include "ephysics_private.h" | ||
6 | |||
7 | #ifdef __cplusplus | ||
8 | extern "C" { | ||
9 | #endif | ||
10 | |||
11 | int _ephysics_log_dom = -1; | ||
12 | static int _ephysics_init_count = 0; | ||
13 | |||
14 | EAPI int | ||
15 | ephysics_init() | ||
16 | { | ||
17 | if (++_ephysics_init_count != 1) | ||
18 | return _ephysics_init_count; | ||
19 | |||
20 | _ephysics_log_dom = eina_log_domain_register("ephysics", EPHYSICS_LOG_COLOR); | ||
21 | if (_ephysics_log_dom < 0) | ||
22 | { | ||
23 | EINA_LOG_ERR("Couldn't create a log domain for ephysics"); | ||
24 | return --_ephysics_init_count; | ||
25 | } | ||
26 | |||
27 | if (!ephysics_world_init()) | ||
28 | { | ||
29 | ERR("Couldn't initialize worlds"); | ||
30 | eina_log_domain_unregister(_ephysics_log_dom); | ||
31 | _ephysics_log_dom = -1; | ||
32 | return --_ephysics_init_count; | ||
33 | } | ||
34 | |||
35 | INF("EPhysics initialized"); | ||
36 | |||
37 | return _ephysics_init_count; | ||
38 | } | ||
39 | |||
40 | EAPI int | ||
41 | ephysics_shutdown() | ||
42 | { | ||
43 | if (--_ephysics_init_count != 0) | ||
44 | return _ephysics_init_count; | ||
45 | |||
46 | ephysics_world_shutdown(); | ||
47 | |||
48 | INF("EPhysics shutdown"); | ||
49 | |||
50 | eina_log_domain_unregister(_ephysics_log_dom); | ||
51 | _ephysics_log_dom = -1; | ||
52 | |||
53 | return _ephysics_init_count; | ||
54 | } | ||
55 | |||
56 | #ifdef __cplusplus | ||
57 | } | ||
58 | #endif | ||