Example #1
0
        public SceneBase(int id, State state)
            : base(IntPtr.Zero)
        {
            _parentState = state;
            _id          = id;
            _entities    = new List <Entity>();
            _systems     = new List <ISystem>();

            SceneCreatedCallback callback = () =>
            {
                // Console.WriteLine("Progress = {0}", value);
            };

            SceneUpdateCallback updateCallback = (value) =>
            {
                //not used !!!!!!!!!!!!
                Updated(value);
                // Console.WriteLine("Progress = {0}", value);
            };

            EntityAddedCallback entityAddedCallback = (UInt64 entityID, IntPtr entityHolder) =>
            {
                _entities.Add(new Entity(entityID, entityHolder));
                // Console.WriteLine("Progress = {0}", value);
            };

            EntityRemovedCallback entityRemovedCallback = (UInt64 entityID) =>
            {
                // Console.WriteLine("Progress = {0}", value);
            };

            CPointer = GetScene(_parentState.CPointer, id, callback, updateCallback, entityAddedCallback, entityRemovedCallback, true); //call sceneCreate in c++
        }
Example #2
0
 private static extern unsafe IntPtr GetScene(IntPtr parentStateNativePtr, int id
                                              , [MarshalAs(UnmanagedType.FunctionPtr)] SceneCreatedCallback callbackPointer
                                              , [MarshalAs(UnmanagedType.FunctionPtr)] SceneUpdateCallback sceneUpdateCB
                                              , [MarshalAs(UnmanagedType.FunctionPtr)] EntityAddedCallback EntityAddedCB
                                              , [MarshalAs(UnmanagedType.FunctionPtr)] EntityRemovedCallback EntityRemovedCB, bool createNew);