Beispiel #1
0
        public static void Init(GlobalState state)
        {
            if (state != null)
            {
                _state = state;
                BaseRenderer.UpdateState((BaseRenderer)BackgroundRenderer, state);
                BaseRenderer.UpdateState((BaseRenderer)MagicRenderer, state);
            }

            if (IsInitialized)
            {
                return;
            }

            _deviceManager1 = new CommonDX.DeviceManager();
            _deviceManager2 = new CommonDX.DeviceManager();

            _renderer1 = new DxRenderer.BackgroundComposer()
            {
                State = _state
            };
            _renderer2 = new DxRenderer.MagicComposer()
            {
                State = _state
            };


            BackgroundSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
                (gt) => { _renderer1.Update(gt); },
                (tb) => { _renderer1.Render(tb); },
                (dm) => { _renderer1.Initialize(dm); },
                (e1, e2) => { _renderer1.InitializeUI(e1, e2); },
                (uri) => { _renderer1.LoadLocalAsset(uri); },
                () => { _renderer1.Unload(); },
                _deviceManager1);
            //_renderer1, _deviceManager1);



            MagicSIS = new SumoNinjaMonkey.Framework.Controls.DrawingSurfaceSIS(
                (gt) => { _renderer2.Update(gt); },
                (tb) => { _renderer2.Render(tb); },
                (dm) => { _renderer2.Initialize(dm); },
                (e1, e2) => { _renderer2.InitializeUI(e1, e2); },
                (uri) => { _renderer2.LoadLocalAsset(uri); },
                () => { _renderer2.Unload(); },
                _deviceManager2);
            //_renderer2, _deviceManager2);


            IsInitialized = true;
        }