ECS Similar to ECX?


#1

I updated my OpenFL version today and my project wont compile because ECX doesnt work, some kind of error for invalid use of void expression. I was wondering if there were any alternative ECS that work similarly that would be easy to replace it with, any help is appreciated.


#2

There are others, but first I’d try fixing ECX. Do you get a line number with the error?


#3

Segmentation fault when compiling Neko, and here is the error for compiling C++, Linux Mint 18.3:

Compiling group: haxe
g++ -Iinclude -c -fvisibility=hidden -O2 -fpic -fPIC -Wno-overflow -DHX_LINUX -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) -m64 -DHXCPP_M64 -I/home/pengu/haxelib/hxcpp/3,4,188/include … tags=[haxe,static]

  • src/ecx/common/systems/FsmSystem.cpp
  • src/ecx/common/components/Fsm.cpp
  • src/ecx/common/systems/FpsMeter.cpp
  • src/lime/utils/AssetCache.cpp [haxe,release]

Error: ./src/ecx/common/systems/FpsMeter.cpp: In member function ‘virtual void ecx::common::systems::FpsMeter_obj::_hx___inject()’:
./src/ecx/common/systems/FpsMeter.cpp:99:156: error: invalid use of void expression
HXLINE( 102) this->_time = ( ( ::ecx::common::systems::TimeSystem)(::cpp::Pointer_obj::fromRaw(::cpp::Pointer_obj::addressOf(tmp)->rawCast())->get_value()) );
^


If I try commenting out the Fps Meter I get:

Compiling group: haxe
g++ -Iinclude -c -fvisibility=hidden -O2 -fpic -fPIC -Wno-overflow -DHX_LINUX -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS(haxe) -DHXCPP_API_LEVEL=331(haxe) -m64 -DHXCPP_M64 -I/home/pengu/haxelib/hxcpp/3,4,188/include … tags=[haxe,static]

  • src/ecx/types/TypeManager.cpp
  • src/lime/utils/AssetCache.cpp [haxe,release]
  • src/ecx/common/components/Name.cpp
  • src/ecx/common/systems/FsmSystem.cpp
    Error: ./src/ecx/common/systems/FsmSystem.cpp: In member function ‘virtual void ecx::common::systems::FsmSystem_obj::_hx___inject()’:
    ./src/ecx/common/systems/FsmSystem.cpp:166:151: error: invalid use of void expression
    HXLINE( 102) this->_fsm = ( ( ::ecx::common::components::Fsm)(::cpp::Pointer_obj::fromRaw(::cpp::Pointer_obj::addressOf(tmp)->rawCast())->get_value()) );

Commenting FsmSystem out I just get a bunch more invalid use of void expression errors.


#4

I have the same problem https://github.com/eliasku/ecx/issues/10

I did the following change:

diff --git a/src/ecx/ds/Cast.hx b/src/ecx/ds/Cast.hx
index ac3b1bd..d610308 100644
--- a/src/ecx/ds/Cast.hx
+++ b/src/ecx/ds/Cast.hx
@@ -6,19 +6,11 @@ package ecx.ds;
 class Cast {
     //@:unreflective // no using / generic ?
     @:extern inline public static function unsafe<TIn, TClass>(value:TIn, clazz:Class<TClass>):TClass {
-        #if (cpp && haxe_ver >= 3.3)
-        return cpp.Pointer.fromRaw(cpp.Pointer.addressOf(value).rawCast()).value;
-        #else
         return cast value;
-        #end
     }
 
     @:unreflective // no using / generic ?
     @:extern inline public static function unsafe_T<TIn, TOut>(value:TIn):TOut {
-        #if (cpp && haxe_ver >= 3.3)
-        return cpp.Pointer.fromRaw(cpp.Pointer.addressOf(value).rawCast()).value;
-        #else
         return cast value;
-        #end
     }
 }

No hacks for c++ casting, just haxe casts. Haven’t noticed some massive performance penalties, though I don’t have a massive amount of entities yet.


#5

Thanks a lot, that did fix the C++ compiling for me.

I’ve got a segmentation fault for Neko now though, but at least I can work with it now. :stuck_out_tongue: