} // ToString() #endregion #region Unit Testing #if DEBUG /// <summary> /// Test textures /// </summary> public static void TestRenderTexture() { Texture testTexture = null; Texture testTexture2 = null; TestGame.Start("TestTextures", delegate { testTexture = new Texture("MainMenu"); testTexture2 = new Texture("InGame"); }, delegate { /*tst1 * testTexture.RenderOnScreen( * new Rectangle(100, 100, 256, 256), * testTexture.GfxRectangle, * Color.White, SpriteBlendMode.Additive); * * // Use alpha blending * testTexture.RenderOnScreen( * new Rectangle(Input.MousePos.X, Input.MousePos.Y, 512, 512), * testTexture.GfxRectangle, Color.Red, SpriteBlendMode.Additive); */ Point rocketPos = new Point(100, 100); float rocketRotation = Input.MousePos.X / 500.0f; Rectangle MiniMapRocketRect = new Rectangle(143, 21, 24, 24); //* testTexture2.RenderOnScreenWithRotation( rocketPos, MiniMapRocketRect.Width / 3, rocketRotation, MiniMapRocketRect, new Vector2(MiniMapRocketRect.Width / 2, MiniMapRocketRect.Width / 2.0f)); /* * testTexture2.RenderOnScreen( * new Rectangle(200, 100, * MiniMapRocketRect.Width, MiniMapRocketRect.Height), * MiniMapRocketRect); * * * Vector2 rotationPoint = new Vector2( * MiniMapRocketRect.Width / 2, * MiniMapRocketRect.Height / 2); * testTexture2.RenderOnScreenWithRotation( * new Rectangle(rocketPos.X, rocketPos.Y, * MiniMapRocketRect.Width, MiniMapRocketRect.Height), * MiniMapRocketRect, * rocketRotation, rotationPoint); */ }); } // TestTextures()
} // SetHitDirectionEffect(direction) /// <summary> /// Show hit direction effect /// </summary> public void ShowHitDirectionEffect() { if (hitDirectionEffectTimeoutMs > 0) { hitDirectionEffectTimeoutMs -= (int)BaseGame.ElapsedTimeThisFrameInMs; hitDirectionTexture.RenderOnScreenWithRotation( new Point(BaseGame.Width / 2, BaseGame.Height / 2), BaseGame.Height / 2, (float)Math.PI + hitDirection, hitDirectionTexture.GfxRectangle, //0, 0, 1, 1, ColorHelper.ApplyAlphaToColor( Color.White, // Use 1.0f for first second, then fade out. Math.Min(1.0f, (hitDirectionEffectTimeoutMs / ((float)MaxHitDirectionTimeoutMs / 2.0f))))); } // if } // ShowHitDirectionEffect()
/// <summary> /// Test textures /// </summary> public static void TestRenderTexture() { Texture testTexture = null; Texture testTexture2 = null; TestGame.Start("TestTextures", delegate { testTexture = new Texture("MainMenu"); testTexture2 = new Texture("InGame"); }, delegate { /*tst1 testTexture.RenderOnScreen( new Rectangle(100, 100, 256, 256), testTexture.GfxRectangle, Color.White, SpriteBlendMode.Additive); // Use alpha blending testTexture.RenderOnScreen( new Rectangle(Input.MousePos.X, Input.MousePos.Y, 512, 512), testTexture.GfxRectangle, Color.Red, SpriteBlendMode.Additive); */ Point rocketPos = new Point(100, 100); float rocketRotation = Input.MousePos.X / 500.0f; Rectangle MiniMapRocketRect = new Rectangle(143, 21, 24, 24); //* testTexture2.RenderOnScreenWithRotation( rocketPos, MiniMapRocketRect.Width / 3, rocketRotation, MiniMapRocketRect, new Vector2(MiniMapRocketRect.Width / 2, MiniMapRocketRect.Width / 2.0f)); /* testTexture2.RenderOnScreen( new Rectangle(200, 100, MiniMapRocketRect.Width, MiniMapRocketRect.Height), MiniMapRocketRect); * Vector2 rotationPoint = new Vector2( MiniMapRocketRect.Width / 2, MiniMapRocketRect.Height / 2); testTexture2.RenderOnScreenWithRotation( new Rectangle(rocketPos.X, rocketPos.Y, MiniMapRocketRect.Width, MiniMapRocketRect.Height), MiniMapRocketRect, rocketRotation, rotationPoint); */ }); }