UIConstants.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // UIConstants.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using Microsoft.Xna.Framework;
  13. #endregion
  14. namespace HoneycombRush
  15. {
  16. /// <summary>
  17. /// Defines constants for positioning UI elements.
  18. /// </summary>
  19. static class UIConstants
  20. {
  21. #if WINDOWS_PHONE
  22. public const float BeehiveLeftMargin = 85;
  23. public const float BeehiveRightMargin = 85;
  24. public const float BeehiveTopMargin = 10;
  25. /// <summary>
  26. /// An additional offset used for positioning the bottom two beehives.
  27. /// </summary>
  28. public const float BeehiveMiddleOffset = 0;
  29. public const float HoneyJarTopMargin = 8;
  30. public const float HoneyJarLeftMargin = 20;
  31. public const float VatArrowOffset = -20;
  32. public const float VatBottomMargin = 25;
  33. public const int VatScorebarHeight = 10;
  34. public const int VatScorebarWidth = 190;
  35. /// <summary>
  36. /// The size of a single frame in the smoke button's two-state texture.
  37. /// </summary>
  38. public const int SmokeButtonSize = 109;
  39. /// <summary>
  40. /// This margin takes the button's own size in consideration.
  41. /// </summary>
  42. public const float SmokeButtonRightAbsoluteMargin = 137;
  43. /// <summary>
  44. /// This margin takes the button's own size in consideration.
  45. /// </summary>
  46. public const float SmokeButtonBottomAbsoluteMargin = 144;
  47. public const float SprayUpOffset = 0;
  48. public const float SprayMiddleOffset = 25;
  49. public const float SprayDownOffset = 30;
  50. public const float SprayRightOffset = 75;
  51. public const float SprayLeftOffset = 75;
  52. public const float HighScorePlaceLeftMargin = 15;
  53. public const float HighScoreNameLeftMargin = 190;
  54. public const float HighScoreScoreLeftMargin = 545;
  55. public const float HighScoreTopMargin = 86;
  56. public const float HighScoreVerticalJump = 72;
  57. #else
  58. /// <summary>
  59. /// Updates all constants returned by the class according to a specified scale factor.
  60. /// Always call this method at least once before retrieving constants from the class.
  61. /// </summary>
  62. /// <param name="scaleVector">Vector depicting the scale used.</param>
  63. public static void SetScale(Vector2 scaleVector)
  64. {
  65. BeehiveLeftMargin = 130 * scaleVector.X;
  66. BeehiveRightMargin = 130 * scaleVector.X;
  67. BeehiveTopMargin = 30 * scaleVector.Y;
  68. BeehiveMiddleOffset = 70 * scaleVector.Y;
  69. HoneyJarTopMargin = 12 * scaleVector.Y;
  70. HoneyJarLeftMargin = 30 * scaleVector.Y;
  71. VatArrowOffset = -35 * scaleVector.Y;
  72. VatBottomMargin = 50 * scaleVector.Y;
  73. VatScorebarHeight = (int)(20 * scaleVector.Y);
  74. VatScorebarWidth = (int)(210 * scaleVector.X);
  75. SmokeButtonSize = 137;
  76. SmokeButtonRightAbsoluteMargin = 170 * scaleVector.X;
  77. SmokeButtonBottomAbsoluteMargin = 200 * scaleVector.Y;
  78. SprayUpOffset = 24 * scaleVector.Y;
  79. SprayMiddleOffset = 65 * scaleVector.Y;
  80. SprayDownOffset = 110 * scaleVector.Y;
  81. SprayRightOffset = 230 * scaleVector.X;
  82. SprayLeftOffset = 130 * scaleVector.X;
  83. HighScorePlaceLeftMargin = 50 * scaleVector.X;
  84. HighScoreNameLeftMargin = 300 * scaleVector.X;
  85. HighScoreScoreLeftMargin = 960 * scaleVector.X;
  86. HighScoreTopMargin = 147 * scaleVector.Y;
  87. HighScoreOddVerticalJump = 74 * scaleVector.Y;
  88. HighScoreEvenVerticalJump = 69 * scaleVector.Y;
  89. }
  90. public static float BeehiveLeftMargin { get; private set; }
  91. public static float BeehiveRightMargin { get; private set; }
  92. public static float BeehiveTopMargin { get; private set; }
  93. /// <summary>
  94. /// An additional offset used for positioning the bottom two beehives.
  95. /// </summary>
  96. public static float BeehiveMiddleOffset { get; private set; }
  97. public static float HoneyJarTopMargin { get; private set; }
  98. public static float HoneyJarLeftMargin { get; private set; }
  99. public static float VatArrowOffset { get; private set; }
  100. public static float VatBottomMargin { get; private set; }
  101. public static int VatScorebarHeight { get; private set; }
  102. public static int VatScorebarWidth { get; private set; }
  103. /// <summary>
  104. /// Sets the size of the smoke button. This does not take the scale factor into account.
  105. /// </summary>
  106. public static float SmokeButtonSize { get; private set; }
  107. /// <summary>
  108. /// This margin takes the button's own size in consideration.
  109. /// </summary>
  110. public static float SmokeButtonRightAbsoluteMargin { get; private set; }
  111. /// <summary>
  112. /// This margin takes the button's own size in consideration.
  113. /// </summary>
  114. public static float SmokeButtonBottomAbsoluteMargin { get; private set; }
  115. public static float SprayUpOffset { get; private set; }
  116. public static float SprayMiddleOffset { get; private set; }
  117. public static float SprayDownOffset { get; private set; }
  118. public static float SprayRightOffset { get; private set; }
  119. public static float SprayLeftOffset { get; private set; }
  120. public static float HighScorePlaceLeftMargin { get; private set; }
  121. public static float HighScoreNameLeftMargin { get; private set; }
  122. public static float HighScoreScoreLeftMargin { get; private set; }
  123. public static float HighScoreTopMargin { get; private set; }
  124. public static float HighScoreOddVerticalJump { get; private set; }
  125. public static float HighScoreEvenVerticalJump { get; private set; }
  126. #endif
  127. }
  128. }