/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { m_graphics.GraphicsDevice.Clear(Color.CornflowerBlue); m_spriteBatch.Begin(); Activity1.DrawString(m_spriteBatch, m_font, string.Format("Hello from MonoGame! {0} | {1}", Activity1._ouyaFacade.IsRunningOnOUYAHardware ? "(Running on OUYA)" : "Not Running on OUYA", m_debugText), new Vector2(100, 100), Color.White); Activity1.DrawString(m_spriteBatch, m_font, "Use DPAD to switch between buttons | Press O to click the button", new Vector2(500, 170), Color.Orange); foreach (ButtonSprite button in m_buttons) { button.Draw(m_spriteBatch, m_font, m_activeButton, m_inactiveButton); } #region Products if (m_focusManager.SelectedButton == BtnRequestProducts || m_focusManager.SelectedButton == BtnRequestPurchase) { Vector2 position = new Vector2(140, 300); for (int index = 0; index < s_products.Count; ++index) { Product product = s_products[index]; Activity1.DrawString(m_spriteBatch, m_font, string.Format("{0} Product: {1} LocalPrice={2}", index == s_productIndex ? "*" : string.Empty, product.Identifier, product.LocalPrice), position, index == s_productIndex ? Color.White : Color.Orange); position += new Vector2(0, 20); } } #endregion #region Receipts if (m_focusManager.SelectedButton == BtnRequestReceipts) { Vector2 position = new Vector2(1120, 300); for (int index = 0; index < s_receipts.Count; ++index) { Receipt receipt = s_receipts[index]; Activity1.DrawString(m_spriteBatch, m_font, string.Format("Receipt: {0} LocalPrice={1}", receipt.Identifier, receipt.LocalPrice), position, Color.White); position += new Vector2(0, 20); } } #endregion m_spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// Draw the sprite /// </summary> /// <param name="spriteBatch"></param> public void Draw(SpriteBatch spriteBatch, SpriteFont font, Texture2D buttonActive, Texture2D buttonInactive) { if (m_isActive) { Draw(spriteBatch, buttonActive); } else { Draw(spriteBatch, buttonInactive); } Activity1.DrawString(spriteBatch, font, Text, Position + TextOffset, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); }