Exemplo n.º 1
0
 protected internal Graphics(LGame game, GL20 gl, Scale scale)
 {
     this.game  = game;
     this.gl    = gl;
     this.scale = scale;
     this.defaultRenderTarget = new DefaultRender(this);
 }
Exemplo n.º 2
0
        public LProcess(LGame game) : base()
        {
            this._game = game;
            LSetting setting = _game.setting;

            setting.UpdateScale();
            LSystem.viewSize.SetSize(setting.width, setting.height);
            this._bundle       = new ObjectBundle();
            this._currentInput = new SysInputFactory();
            this._screens      = new TArray <Screen>();
            this._screenMap    = new ListMap <string, Screen>();
            this.Clear();
            InputMake input = game.Input();

            if (input != null)
            {
                //这部分与Java版没必要1:1实现,因为XNA有TouchPanel.GetCapabilities().IsConnected方法判定是否支持触屏
                if (!game.setting.emulateTouch && !_game.Input().HasTouch())
                {
                    input.mouseEvents.Connect(new ButtonPort(this));
                }
                else
                {
                    input.touchEvents.Connect(new TouchPort(this));
                }
                input.keyboardEvents.Connect(new KeyPort(this));
            }
            game.status.Connect(new StatusPort(this));
        }
Exemplo n.º 3
0
 public LSystemView(LGame g, long updateRate)
 {
     this.updateRate = updateRate;
     this._game      = g;
     _game.CheckBaseGame(g);
     _game.frame.Connect(new PortImpl(this));
 }
Exemplo n.º 4
0
 public virtual void SetPlatform(Platform plat)
 {
     if (plat != null)
     {
         LGame._platform = plat;
         LGame._base     = plat.GetGame();
     }
 }
Exemplo n.º 5
0
 protected void InitProcess(LGame game)
 {
     _base = game;
     if (_base == null && _platform != null)
     {
         _base = _platform.GetGame();
     }
     processImpl = new LProcess(game);
     Log().Debug("The Loon Game Engine is Begin");
 }
Exemplo n.º 6
0
 public virtual void SetPlatform(Platform plat)
 {
     if (plat != null)
     {
         LGame._platform = plat;
         LGame game = plat.GetGame();
         if (game != null)
         {
             LGame._base = game;
             //  LGame._base.resetShader();
         }
     }
 }
Exemplo n.º 7
0
        public static GoFuture <string> LoadAsynText(string path)
        {
            LGame game = LSystem.Base;

            if (game != null)
            {
                try
                {
                    return(game.Assets().GetText(path));
                }
                catch (System.Exception)
                {
                    return(null);
                }
            }
            return(null);
        }
Exemplo n.º 8
0
        public static System.IO.Stream OpenStream(string path)
        {
            LGame game = LSystem.Base;

            if (game != null)
            {
                try
                {
                    return(game.Assets().OpenStream(path));
                }
                catch (System.Exception)
                {
                    return(null);
                }
            }
            return(null);
        }
Exemplo n.º 9
0
        internal virtual void Call(Level level, string msg, System.Exception e)
        {
            if (LSystem.IsConsoleLog())
            {
                if (collector != null)
                {
                    collector.Logged(level, msg, e);
                }
                if (level.id >= minLevel.id)
                {
                    CallNativeLog(level, msg, e);
                    LGame game = LSystem.Base;
                    if (game != null)
                    {
                        LSetting setting = game.setting;
                        // 待实现GLEx

                        /*  LProcess process = LSystem.GetProcess();
                         * if (process != null && (setting.isDebug || setting.isDisplayLog))
                         * {
                         *    LColor color = LColor.white;
                         *    if (level.id > Level.INFO.id)
                         *    {
                         *        color = LColor.red;
                         *    }
                         *    if (process != null)
                         *    {
                         *        if (e == null)
                         *        {
                         *            process.addLog(msg, color);
                         *        }
                         *        else
                         *        {
                         *            process.addLog(msg + " [ " + e.getMessage() + " ] ", color);
                         *        }
                         *    }
                         */
                    }
                }
            }
            if (e != null)
            {
                OnError(e);
            }
        }
Exemplo n.º 10
0
        public Display(LGame g, long updateRate)
        {
            this.updateRate = updateRate;
            this._game      = g;
            this._game.CheckBaseGame(g);
            this._setting   = _game.setting;
            this._process   = _game.Process();
            this.memorySelf = _game.IsHTML5();
            Graphics graphics = _game.Graphics();
            GL20     gl       = graphics.gl;

            this._glEx = new GLEx(graphics, graphics.defaultRenderTarget, gl);
            this._glEx.Update();
            UpdateSyncTween(_setting.isSyncTween);
            this.displayMemony  = MEMORY_STR + "0";
            this.displaySprites = SPRITE_STR + "0, " + DESKTOP_STR + "0";
            if (!_setting.isLogo)
            {
                _process.Start();
            }
            _game.frame.Connect(new PortImpl(this));
        }
Exemplo n.º 11
0
        protected internal virtual LGame CheckBaseGame(LGame game)
        {
            LGame oldGame = _base;

            if (game != oldGame && game != null)
            {
                oldGame = game;
            }
            else if (game == null)
            {
                if (oldGame != null && _platform != null && _platform.GetGame() != null)
                {
                    if (oldGame != _platform.GetGame())
                    {
                        oldGame = _platform.GetGame();
                    }
                }
            }
            if (_base != game || _base != oldGame)
            {
                _base = oldGame;
            }
            return(LSystem.Base);
        }
Exemplo n.º 12
0
 public static void FreeStatic()
 {
     LGame._platform = null;
     LGame._base     = null;
 }