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)); }
/// <summary> /// 复制setting设置到自身 /// </summary> /// <param name="setting"> </param> public virtual void Copy(LSetting setting) { this.isSyncTween = setting.isSyncTween; this.isFPS = setting.isFPS; this.isLogo = setting.isLogo; this.isCheckReisze = setting.isCheckReisze; this.isConsoleLog = setting.isConsoleLog; this.disposeTexture = setting.disposeTexture; this.fps = setting.fps; this.width = setting.width; this.height = setting.height; this.width_zoom = setting.width_zoom; this.height_zoom = setting.height_zoom; this.fullscreen = setting.fullscreen; this.emulateTouch = setting.emulateTouch; this.activationKey = setting.activationKey; this.convertImagesOnLoad = setting.convertImagesOnLoad; this.saveTexturePixels = setting.saveTexturePixels; this.appName = setting.appName; this.logoPath = setting.logoPath; this.fontName = setting.fontName; this.version = setting.version; this.fixedPaintLoopTime = setting.fixedPaintLoopTime; this.fixedUpdateLoopTime = setting.fixedUpdateLoopTime; this.useTrueFontClip = setting.useTrueFontClip; this.emulatorScale = setting.emulatorScale; this.notAllowDragAndMove = setting.notAllowDragAndMove; this.lockAllTouchEvent = setting.lockAllTouchEvent; this.args = setting.args; }
private void OnFrame() { if (!LSystem._auto_repaint) { return; } int updateTick = _game.Tick(); LSetting setting = _game.setting; long paintLoop = setting.fixedPaintLoopTime; long updateLoop = setting.fixedUpdateLoopTime; long nextUpdate = this.nextUpdate; if (updateTick >= nextUpdate) { long updateRate = this.updateRate; long updates = 0; while (updateTick >= nextUpdate) { nextUpdate += updateRate; updates++; } this.nextUpdate = nextUpdate; long updateDt = updates * updateRate; updateClock.tick += updateDt; if (updateLoop == -1) { updateClock.timeSinceLastUpdate = updateDt; } else { updateClock.timeSinceLastUpdate = updateLoop; } Update(updateClock); } long paintTick = _game.Tick(); if (paintLoop == -1) { paintClock.timeSinceLastUpdate = paintTick - paintClock.tick; } else { paintClock.timeSinceLastUpdate = paintLoop; } paintClock.tick = paintTick; paintClock.alpha = 1f - (nextUpdate - paintTick) / (float)updateRate; Paint(paintClock); }
/// <summary> /// 以Data接口方式注入初始数据 /// </summary> /// <param name="s"></param> /// <param name="data"></param> public virtual void Register(LSetting s, Data data) { if (s is MonoGameSetting mgs) { this._setting = mgs; } else { MonoGameSetting tmp = new MonoGameSetting(); tmp.Copy(s); tmp.fullscreen = true; this._setting = tmp; } this._mainInterfaceData = data; }
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); } }
public LGame(LSetting config, Platform plat) { LGame._platform = plat; if (config == null) { config = new LSetting(); } this.setting = config; string appName = config.appName; if (StringUtils.IsEmpty(appName)) { setting.appName = APP_NAME; } string fontName = config.fontName; if (StringUtils.IsEmpty(fontName)) { setting.fontName = FONT_NAME; } }
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)); }