public void SetLogo(LTexture img) { if (logoFlag == null) { this.logoFlag = new Logo(new LTexture(img)); } }
public override void Draw(GL g) { this.m_onRunning = false; this.m_onPause = false; this.m_onDestroy = false; this.m_onResume = false; lock (m_sync) { m_onRunning = LSystem.isRunning; m_onPause = LSystem.isPaused; m_onDestroy = LSystem.isDestroy; m_onResume = LSystem.isResume; if (LSystem.isResume) { LSystem.isResume = false; } if (LSystem.isPaused) { LSystem.isPaused = false; JavaRuntime.NotifyAll(m_sync); } if (LSystem.isDestroy) { LSystem.isDestroy = false; JavaRuntime.NotifyAll(m_sync); } if (m_onResume) { m_log.I("m_onResume"); timer = LSystem.GetSystemTimer(); lastTimeMicros = timer.GetTimeMicros(); elapsedTime = 0; remainderMicros = 0; m_process.OnResume(); } if (m_onRunning) { if (LSystem.isLogo) { if (logoFlag == null) { LSystem.isLogo = false; return; } logoFlag.Draw(m_process.gl); if (logoFlag.finish) { m_process.gl.SetAlpha(1.0f); m_process.gl.DrawClear(LColor.black); LSystem.isLogo = false; logoFlag.Dispose(); logoFlag = null; return; } return; } if (!m_process.Next()) { return; } m_process.Load(); m_process.Calls(); goalTimeMicros = lastTimeMicros + 1000000L / maxFrames; currTimeMicros = timer.SleepTimeMicros(goalTimeMicros); elapsedTimeMicros = currTimeMicros - lastTimeMicros + remainderMicros; elapsedTime = MathUtils.Max(0, (elapsedTimeMicros / 1000)); remainderMicros = elapsedTimeMicros - elapsedTime * 1000; lastTimeMicros = currTimeMicros; timerContext.millisSleepTime = remainderMicros; timerContext.timeSinceLastUpdate = elapsedTime; ActionControl.Update(elapsedTime); m_process.RunTimer(timerContext); if (LSystem.AUTO_REPAINT) { GLEx gl = m_process.gl; if (gl != null) { if (!m_process.Next()) { return; } //�趨graphics.PreferredBackBufferWidth��graphics.PreferredBackBufferHeightʱWP���Զ����Ż��棬 //�˴�����������һ�Ρ� /*if (LSystem.scaleWidth != 1f || LSystem.scaleHeight != 1f) { gl.Scale(LSystem.scaleWidth, LSystem.scaleHeight); }*/ int repaintMode = m_process.GetRepaintMode(); switch (repaintMode) { case Screen.SCREEN_BITMAP_REPAINT: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture(m_process.GetBackground(), 0, 0); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX(), m_process.GetY()); } break; case Screen.SCREEN_COLOR_REPAINT: LColor c = m_process.GetColor(); if (c != null) { gl.DrawClear(c); } break; case Screen.SCREEN_CANVAS_REPAINT: gl.Reset(true); break; case Screen.SCREEN_NOT_REPAINT: gl.Reset(true); break; default: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture( m_process.GetBackground(), repaintMode / 2 - LSystem.random.Next(repaintMode), repaintMode / 2 - LSystem.random.Next(repaintMode)); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX() + repaintMode / 2 - LSystem.random.Next(repaintMode), m_process.GetY() + repaintMode / 2 - LSystem.random.Next(repaintMode)); } break; } m_process.Draw(); m_process.Drawable(elapsedTime); if (isFPS) { this.TickFrames(); fpsFont.DrawString(string.Format(numformat, "FPS:{0}", frameRate), 5, 5, 0, LColor.white); } m_process.DrawEmulator(); m_process.Unload(); gl.Restore(); } } } } }
private void OnDraw(object sender, GameTimerEventArgs e) { if (isClose) { return; } if (LSystem.isLogo) { if (logoFlag == null) { LSystem.isLogo = false; return; } lock (logoFlag) { logoFlag.Draw(process.GL, (long)e.ElapsedTime.TotalMilliseconds); } if (logoFlag.finish) { process.GL.Clear(); LSystem.isLogo = false; logoFlag = null; return; } return; } if (LSystem.AUTO_REPAINT) { DrawXNA((float)e.ElapsedTime.TotalSeconds); } if (useXNAListener) { sl_listener.Draw(GamePage,e); } }
protected override void Draw(GameTime gameTime) { if (isClose) { return; } if (LSystem.isLogo) { if (logoFlag == null) { LSystem.isLogo = false; return; } lock (logoFlag) { logoFlag.Draw(process.GL, (long)gameTime.ElapsedGameTime.TotalMilliseconds); } if (logoFlag.finish) { process.GL.Clear(); LSystem.isLogo = false; logoFlag = null; return; } return; } if (LSystem.AUTO_REPAINT) { DrawXNA((float)gameTime.ElapsedGameTime.TotalSeconds); } if (useXNAListener) { xna_listener.Draw(this,gameTime); } if (UseXNA) { base.Draw(gameTime); } }
public override void Draw(GL g) { this.m_onRunning = false; this.m_onPause = false; this.m_onDestroy = false; this.m_onResume = false; lock (m_sync) { m_onRunning = LSystem.isRunning; m_onPause = LSystem.isPaused; m_onDestroy = LSystem.isDestroy; m_onResume = LSystem.isResume; if (LSystem.isResume) { LSystem.isResume = false; } if (LSystem.isPaused) { LSystem.isPaused = false; JavaRuntime.NotifyAll(m_sync); } if (LSystem.isDestroy) { LSystem.isDestroy = false; JavaRuntime.NotifyAll(m_sync); } if (m_onResume) { m_log.I("m_onResume"); timer = LSystem.GetSystemTimer(); lastTimeMicros = timer.GetTimeMicros(); elapsedTime = 0; remainderMicros = 0; m_process.OnResume(); } if (m_onRunning) { if (LSystem.isLogo) { if (logoFlag == null) { LSystem.isLogo = false; return; } logoFlag.Draw(m_process.gl); if (logoFlag.finish) { m_process.gl.SetAlpha(1.0f); m_process.gl.DrawClear(LColor.black); LSystem.isLogo = false; logoFlag.Dispose(); logoFlag = null; return; } return; } if (!m_process.Next()) { return; } m_process.Load(); m_process.Calls(); goalTimeMicros = lastTimeMicros + 1000000L / maxFrames; currTimeMicros = timer.SleepTimeMicros(goalTimeMicros); elapsedTimeMicros = currTimeMicros - lastTimeMicros + remainderMicros; elapsedTime = MathUtils.Max(0, (elapsedTimeMicros / 1000)); remainderMicros = elapsedTimeMicros - elapsedTime * 1000; lastTimeMicros = currTimeMicros; timerContext.millisSleepTime = remainderMicros; timerContext.timeSinceLastUpdate = elapsedTime; ActionControl.Update(elapsedTime); m_process.RunTimer(timerContext); if (LSystem.AUTO_REPAINT) { GLEx gl = m_process.gl; if (gl != null) { if (!m_process.Next()) { return; } //设定graphics.PreferredBackBufferWidth和graphics.PreferredBackBufferHeight时WP会自动缩放画面, //此处无需再缩放一次。 /*if (LSystem.scaleWidth != 1f || LSystem.scaleHeight != 1f) * { * gl.Scale(LSystem.scaleWidth, * LSystem.scaleHeight); * }*/ int repaintMode = m_process.GetRepaintMode(); switch (repaintMode) { case Screen.SCREEN_BITMAP_REPAINT: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture(m_process.GetBackground(), 0, 0); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX(), m_process.GetY()); } break; case Screen.SCREEN_COLOR_REPAINT: LColor c = m_process.GetColor(); if (c != null) { gl.DrawClear(c); } break; case Screen.SCREEN_CANVAS_REPAINT: gl.Reset(true); break; case Screen.SCREEN_NOT_REPAINT: gl.Reset(true); break; default: gl.Reset(true); if (m_process.GetX() == 0 && m_process.GetY() == 0) { gl.DrawTexture( m_process.GetBackground(), repaintMode / 2 - LSystem.random.Next(repaintMode), repaintMode / 2 - LSystem.random.Next(repaintMode)); } else { gl.DrawTexture(m_process.GetBackground(), m_process.GetX() + repaintMode / 2 - LSystem.random.Next(repaintMode), m_process.GetY() + repaintMode / 2 - LSystem.random.Next(repaintMode)); } break; } m_process.Draw(); m_process.Drawable(elapsedTime); if (isFPS) { this.TickFrames(); fpsFont.DrawString(string.Format(numformat, "FPS:{0}", frameRate), 5, 5, 0, LColor.white); } m_process.DrawEmulator(); m_process.Unload(); gl.Restore(); } } } } }