public override void Render() { Debug.Assert(this.pAzulSprite != null); Debug.Assert(this.pColor != null); Debug.Assert(this.pScreenRect != null); Debug.Assert(this.pMessage != null); Debug.Assert(this.pMessage.Length > 0); float xTmp = this.x; float yTmp = this.y; float xEnd = this.x; for (int i = 0; i < this.pMessage.Length; i++) { int key = Convert.ToByte(pMessage[i]); Glyph pGlyph = GlyphManager.Find(this.glyphName, key); Debug.Assert(pGlyph != null); xTmp = xEnd + pGlyph.GetAzulSubRect().width / 2; this.pScreenRect.Set(xTmp, yTmp, pGlyph.GetAzulSubRect().width, pGlyph.GetAzulSubRect().height); pAzulSprite.Swap(pGlyph.GetAzulTexture(), pGlyph.GetAzulSubRect(), this.pScreenRect, this.pColor); pAzulSprite.Update(); pAzulSprite.Render(); // move the starting to the next character xEnd = pGlyph.GetAzulSubRect().width / 2 + xTmp; } }
override public void render() { Debug.Assert(this.azulSprite != null); Debug.Assert(this.fontColor != null); Debug.Assert(this.screenRect != null); Debug.Assert(this.text != null); Debug.Assert(this.text.Length > 0); float xTmp = this.x; float yTmp = this.y; float xEnd = this.x; for (int i = 0; i < this.text.Length; i++) { int key = Convert.ToByte(text[i]); Glyph pGlyph = GlyphManager.Find(this.glyphName, key); Debug.Assert(pGlyph != null); xTmp = xEnd + pGlyph.glyphRect.width / 2; this.screenRect.Set(xTmp, yTmp, pGlyph.glyphRect.width, pGlyph.glyphRect.height); azulSprite.Swap(pGlyph.glyphTex.getAzulTexture(), pGlyph.glyphRect, this.screenRect, this.fontColor); azulSprite.Update(); azulSprite.Render(); xEnd = pGlyph.glyphRect.width / 2 + xTmp; } }
public void Draw() { String pMsg = this.msg; float x = this.xStart; float y = this.yStart; for (int i = 0; i < pMsg.Length; i++) { int key = Convert.ToByte(pMsg[i]); Glyph pGlyph = GlyphMan.Find(key); Debug.Assert(pGlyph != null); Azul.Sprite pAzulSprite = new Azul.Sprite(pGlyph.pFont, new Azul.Rect(pGlyph.x, pGlyph.y, pGlyph.width, pGlyph.height), new Azul.Rect(x, y, pGlyph.width, pGlyph.height), new Azul.Color(1.0f, 1.0f, 1.0f)); pAzulSprite.Update(); pAzulSprite.Render(); x += pGlyph.width; } }
public void Draw() { String pMsg = this.msg; float xTmp = this.xStart; float yTmp = this.yStart; float xEnd = this.xStart; for (int i = 0; i < pMsg.Length; i++) { int key = Convert.ToByte(pMsg[i]); Glyph pGlyph = GlyphMan.Find(key); Debug.Assert(pGlyph != null); xTmp = xEnd + pGlyph.width / 2; Azul.Sprite pAzulSprite = new Azul.Sprite(pGlyph.pFont, new Azul.Rect(pGlyph.x, pGlyph.y, pGlyph.width, pGlyph.height), new Azul.Rect(xTmp, yTmp, pGlyph.width, pGlyph.height), new Azul.Color(1.0f, 1.0f, 1.0f)); pAzulSprite.Update(); pAzulSprite.Render(); // move the starting to the next character xEnd = pGlyph.width / 2 + xTmp; } }
private void LoadScreenUpdate() { mainMenuSprite.Update(); if (InputManager.GetButtonDown(INPUTBUTTON.START) || InputManager.GetButtonDown(INPUTBUTTON.JUMP)) { FirstLoad(); state = GAME_STATE.LOBBY; } }
public virtual void Update() { //if (pBody != null) // { // pushPhysics(); // } pSprite.x = pWorldRect.x; pSprite.y = pWorldRect.y; pSprite.Update(); }
public virtual void Update() { if (pBody != null) { pushPhysics(); } pSprite.x = pScreenRect.x; pSprite.y = pScreenRect.y; pSprite.Update(); }
public virtual void Update() { // if (updatebody) // { // if (pBody != null) // { // pushPhysics(); // } // pSprite.x = pScreenRect.x; // pSprite.y = pScreenRect.y; //} pSprite.Update(); }
public static void DrawString(String pString, float x, float y, ColorName color = ColorName.White) { Azul.Sprite pAzulSprite = new Azul.Sprite(); for (int i = 0; i < pString.Length; i++) { int key = Convert.ToByte(pString[i]); Font pFont = FontManager.Find(FontName.Consolas36pt, key); Debug.Assert(pFont != null); pAzulSprite.Swap(pFont.GetAzulTexture(), pFont.GetAzulRect(), new Azul.Rect(x, y, pFont.GetAzulRect().width, pFont.GetAzulRect().height), ColorFactory.Create(color).pAzulColor); pAzulSprite.Update(); pAzulSprite.Render(); x += pFont.GetAzulRect().width; } }
private void ArmedUpdate() { mine2.x = pScreenRect.x; mine2.y = pScreenRect.y; mine2.Update(); TimeSpan ts = lifeTimer.Elapsed; if (lifeTime <= ts.Seconds) { GameManager.DestroyObject(this); } TimeSpan animTs = animTimer.Elapsed; if (animTs.Milliseconds > 300f) { drawMine2 = !drawMine2; animTimer.Restart(); } }
// Author: Stahl Samuel, Yuetao Zhu public override void Update() { AudioEngine.Update(); if (music.Volume > 0.30f) { vol_delta = -0.002f; } else if (music.Volume < 0.00f) { vol_delta = 0.002f; } music.Volume += vol_delta; // Intentionally disabling sounds for now music.Volume = 0.000f; inputReader.GetInputs(); if (!isPaused) { //-------------------------------------------------------- // Rotate Sprite -- shows if game paused or not... //-------------------------------------------------------- pRedBird.angle = pRedBird.angle + 0.01f; pRedBird.Update(); BlockGrid grid = state.getGrid(); GameShape activeShape = state.getActiveShape(); // Things we need to check on every update: // 1. activeShape is placed => trigger GameState.activateNext() and set active shape to new active shape // 2. if timer is expired => reset timer and MovementManager.ApplyAction(InputAction.MoveDown,grid,shape); // 3. if timer is not expired => processInput(); if (activeShape.isPlaced) { //Update activeShape, lines, score, level, check game-over UpdateGameState(grid); } //if shape was placed, timer was just reset (mutually exclusive) else if (lineCycleTimer.IsExpired()) { Console.WriteLine($"Moving shape down: {activeShape}"); MovementManager.ApplyAction(InputAction.MoveDown, grid, activeShape); lineCycleTimer.ResetTimer(); inputTimer.ResetTimer(); } else { if (inputTimer.IsExpired()) { processInput(grid, activeShape); inputTimer.ResetTimer(); } } } else { if (inputTimer.IsExpired()) { // Paused processInput(null, null); inputTimer.ResetTimer(); } } }
public void Update() { sprite.Update(); }
public virtual void Update() { sprite.Update(); }
void DisplayHUD() { // pLobby.Update(); p1ScoreText = new SpriteFont(p1Score + "", 380, 285); p1ScoreText.Update(); p1ScoreText.Draw(); p2ScoreText = new SpriteFont(p2Score + "", 420, 285); p2ScoreText.Update(); p2ScoreText.Draw(); p1KillText = new SpriteFont("P1 KI LLS: " + p1Kills, 245, 220); p1KillText.Update(); p1KillText.Draw(); p2KillText = new SpriteFont("P2 KI LLS: " + p2Kills, 455, 220); p2KillText.Update(); p2KillText.Draw(); p1DeathText = new SpriteFont("P1 DEATHS: " + p1Deaths, 245, 200); p1DeathText.Update(); p1DeathText.Draw(); p2DeathText = new SpriteFont("P2 DEATHS: " + p2Deaths, 455, 200); p2DeathText.Update(); p2DeathText.Draw(); for (int i = 0; i < p1Lives; i++) { p1LifeDisplay.x = 265 + (i * 30); p1LifeDisplay.y = 285; p1LifeDisplay.Update(); p1LifeDisplay.Render(); } for (int i = 0; i < p2Lives; i++) { p2LifeDisplay.x = 475 + (i * 30); p2LifeDisplay.y = 285; p2LifeDisplay.Update(); p2LifeDisplay.Render(); } int p1MineCount = player1.MineCount(); for (int i = 0; i < p1MineCount; i++) { p1MineDisplay.x = 235 + (i * 30); p1MineDisplay.y = 250; p1MineDisplay.Update(); p1MineDisplay.Render(); } int p2MineCount = player2.MineCount(); for (int i = 0; i < p2MineCount; i++) { p2MineDisplay.x = 445 + (i * 30); p2MineDisplay.y = 250; p2MineDisplay.Update(); p2MineDisplay.Render(); } }
//----------------------------------------------------------------------------- // Game::Update() // Called once per frame, update data, tranformations, etc // Use this function to control process order // Input, AI, Physics, Animation, and Graphics //----------------------------------------------------------------------------- public override void Update() { // Snd update - Need to be called once a frame AudioEngine.Update(); //----------------------------------------------------------- // Input Test //----------------------------------------------------------- // InputTest.KeyboardTest(); // InputTest.MouseTest(); //----------------------------------------------------------- // Sound Experiments //----------------------------------------------------------- // Adjust music theme volume if (music.Volume > 0.30f) { vol_delta = -0.002f; } else if (music.Volume < 0.00f) { vol_delta = 0.002f; } music.Volume += vol_delta; //-------------------------------------------------------- // Rotate Sprite //-------------------------------------------------------- pRedBird.angle = pRedBird.angle + 0.01f; pRedBird.Update(); //-------------------------------------------------------- // Keyboard test //-------------------------------------------------------- // Quick hack to have a one off call. // you need to release the keyboard between calls if (Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER) && prevEnterKey == 0) { prevEnterKey = Azul.AZUL_KEY.KEY_ENTER; sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); } else { if (!Azul.Input.GetKeyState(Azul.AZUL_KEY.KEY_ENTER)) { prevEnterKey = 0; } } //-------------------------------------------------------- // Stats test //-------------------------------------------------------- stats.setScore(stats.getScore() + 1); if (statsCount % 400 == 0) { stats.setLevelNum(stats.getLevelNum() + 1); } if (statsCount % 50 == 0) { stats.setLineCount(stats.getLineCount() + 1); } statsCount++; }