Просмотр исходного кода

Introduced GlobalTransformation as we'll need this for scaling from mobile to desktop to consoles.

Dominique Louis 1 месяц назад
Родитель
Сommit
0d5ec02881
41 измененных файлов с 503 добавлено и 144 удалено
  1. 6 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/AndroidProjectSystem.xml
  2. 10 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/deploymentTargetSelector.xml
  3. 8 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/indexLayout.xml
  4. 8 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/projectSettingsUpdater.xml
  5. 7 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/vcs.xml
  6. 193 0
      RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/workspace.xml
  7. 2 2
      RolePlayingGame/Core/AudioManager.cs
  8. 1 1
      RolePlayingGame/Core/Combat/Combatant.cs
  9. 12 0
      RolePlayingGame/Core/Content/Content.mgcb
  10. BIN
      RolePlayingGame/Core/Content/Textures/GameScreens/blank.png
  11. 1 1
      RolePlayingGame/Core/Fonts.cs
  12. 1 1
      RolePlayingGame/Core/GameScreens/ChestScreen.cs
  13. 2 2
      RolePlayingGame/Core/GameScreens/DialogueScreen.cs
  14. 2 2
      RolePlayingGame/Core/GameScreens/GameOverScreen.cs
  15. 1 1
      RolePlayingGame/Core/GameScreens/Hud.cs
  16. 1 1
      RolePlayingGame/Core/GameScreens/InnScreen.cs
  17. 1 1
      RolePlayingGame/Core/GameScreens/LevelUpScreen.cs
  18. 2 2
      RolePlayingGame/Core/GameScreens/ListScreen.cs
  19. 2 2
      RolePlayingGame/Core/GameScreens/PlayerSelectionScreen.cs
  20. 1 1
      RolePlayingGame/Core/GameScreens/QuestDetailsScreen.cs
  21. 1 1
      RolePlayingGame/Core/GameScreens/RewardsScreen.cs
  22. 1 1
      RolePlayingGame/Core/GameScreens/StatisticsScreen.cs
  23. 1 1
      RolePlayingGame/Core/GameScreens/StoreScreen.cs
  24. 1 1
      RolePlayingGame/Core/MenuScreens/BackstoryScreen.cs
  25. 1 1
      RolePlayingGame/Core/MenuScreens/ControlsScreen.cs
  26. 1 1
      RolePlayingGame/Core/MenuScreens/LoadingScreen.cs
  27. 7 18
      RolePlayingGame/Core/MenuScreens/MainMenuScreen.cs
  28. 1 1
      RolePlayingGame/Core/MenuScreens/MessageBoxScreen.cs
  29. 1 1
      RolePlayingGame/Core/MenuScreens/SaveLoadScreen.cs
  30. 35 10
      RolePlayingGame/Core/RolePlayingGame.cs
  31. 39 44
      RolePlayingGame/Core/ScreenManager/GameScreen.cs
  32. 1 1
      RolePlayingGame/Core/ScreenManager/MenuScreen.cs
  33. 94 23
      RolePlayingGame/Core/ScreenManager/ScreenManager.cs
  34. 20 0
      RolePlayingGame/Core/ScreenManager/ScreenState.cs
  35. 9 6
      RolePlayingGame/Core/Session/Session.cs
  36. 1 1
      RolePlayingGame/Platforms/Android/AndroidManifest.xml
  37. 5 3
      RolePlayingGame/Platforms/Android/MainActivity.cs
  38. BIN
      RolePlayingGame/Platforms/Android/Resources/drawable/icon.png
  39. 2 0
      RolePlayingGame/Platforms/Android/Resources/drawable/icon.svg
  40. 2 9
      RolePlayingGame/Platforms/Android/RolePlayingGame.Android.csproj
  41. 19 4
      RolePlayingGame/Platforms/iOS/Program.cs

+ 6 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/AndroidProjectSystem.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AndroidProjectSystem">
+    <option name="providerId" value="RiderAndroidProjectSystem" />
+  </component>
+</project>

+ 10 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/deploymentTargetSelector.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="deploymentTargetSelector">
+    <selectionStates>
+      <SelectionState runConfigName="RolePlayingGame.Android">
+        <option name="selectionMode" value="DROPDOWN" />
+      </SelectionState>
+    </selectionStates>
+  </component>
+</project>

+ 8 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/indexLayout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="UserContentModel">
+    <attachedFolders />
+    <explicitIncludes />
+    <explicitExcludes />
+  </component>
+</project>

+ 8 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/projectSettingsUpdater.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RiderProjectSettingsUpdater">
+    <option name="singleClickDiffPreview" value="1" />
+    <option name="unhandledExceptionsIgnoreList" value="1" />
+    <option name="vcsConfiguration" value="3" />
+  </component>
+</project>

+ 7 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/vcs.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
+  </component>
+</project>

+ 193 - 0
RolePlayingGame/.idea/.idea.RolePlayingGame/.idea/workspace.xml

@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoGeneratedRunConfigurationManager">
+    <projectFile kind="XamarinAndroid">Platforms/Android/RolePlayingGame.Android.csproj</projectFile>
+    <projectFile>Platforms/Desktop/RolePlayingGame.Desktop.csproj</projectFile>
+    <projectFile>Platforms/Windows/RolePlayingGame.Windows.csproj</projectFile>
+    <projectFile kind="XamarinIOS">Platforms/iOS/RolePlayingGame.iOS.csproj</projectFile>
+  </component>
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="6ac6afe1-7aa8-4a82-8199-59730b04adfc" name="Changes" comment="">
+      <change afterPath="$PROJECT_DIR$/Platforms/Android/Resources/drawable/icon.svg" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../Audio3D/Core/Audio3D.Core.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/../Audio3D/Core/Audio3D.Core.csproj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../Audio3D/Platforms/DesktopGL/Audio3D.DesktopGL.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/../Audio3D/Platforms/DesktopGL/Audio3D.DesktopGL.csproj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/../Audio3D/Platforms/iOS/Audio3D.iOS.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/../Audio3D/Platforms/iOS/Audio3D.iOS.csproj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/AudioManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/AudioManager.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Combat/Combatant.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Combat/Combatant.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Content/Content.mgcb" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Content/Content.mgcb" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Fonts.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Fonts.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/ChestScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/ChestScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/DialogueScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/DialogueScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/GameOverScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/GameOverScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/Hud.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/Hud.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/InnScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/InnScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/LevelUpScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/LevelUpScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/ListScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/ListScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/PlayerSelectionScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/PlayerSelectionScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/QuestDetailsScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/QuestDetailsScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/RewardsScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/RewardsScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/StatisticsScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/StatisticsScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/GameScreens/StoreScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/GameScreens/StoreScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/BackstoryScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/BackstoryScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/ControlsScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/ControlsScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/LoadingScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/LoadingScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/MainMenuScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/MainMenuScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/MessageBoxScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/MessageBoxScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/MenuScreens/SaveLoadScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/MenuScreens/SaveLoadScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/RolePlayingGame.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/RolePlayingGame.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/ScreenManager/GameScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/ScreenManager/GameScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/ScreenManager/MenuScreen.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/ScreenManager/MenuScreen.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/ScreenManager/ScreenManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/ScreenManager/ScreenManager.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Core/Session/Session.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Core/Session/Session.cs" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Platforms/Android/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/Platforms/Android/AndroidManifest.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Platforms/Android/RolePlayingGame.Android.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/Platforms/Android/RolePlayingGame.Android.csproj" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/Platforms/iOS/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Platforms/iOS/Program.cs" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
+  </component>
+  <component name="HighlightingSettingsPerFile">
+    <setting file="file://$PROJECT_DIR$/Core/AudioManager.cs" root0="FORCE_HIGHLIGHTING" />
+  </component>
+  <component name="InvalidFacetManager">
+    <ignored-facets>
+      <facet id="RolePlayingGame.Android/invalid/Android Facet - RolePlayingGame.Android" />
+    </ignored-facets>
+  </component>
+  <component name="ProjectColorInfo">{
+  &quot;customColor&quot;: &quot;&quot;,
+  &quot;associatedIndex&quot;: 7
+}</component>
+  <component name="ProjectId" id="30q2NCUlaESqllqh7HzXgp5xOGm" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "Android.RolePlayingGame.Android.executor": "Debug",
+    "ModuleVcsDetector.initialDetectionPerformed": "true",
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "RunOnceActivity.git.unshallow": "true",
+    "git-widget-placeholder": "main",
+    "node.js.detected.package.eslint": "true",
+    "node.js.detected.package.tslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "node.js.selected.package.tslint": "(autodetect)",
+    "nodejs_package_manager_path": "npm",
+    "settings.editor.selected.configurable": "preferences.pluginManager",
+    "vue.rearranger.settings.migration": "true"
+  }
+}]]></component>
+  <component name="RunManager" selected="Android.RolePlayingGame.Android">
+    <configuration name="RolePlayingGame.Desktop" type="DotNetProject" factoryName=".NET Project">
+      <option name="EXE_PATH" value="" />
+      <option name="PROGRAM_PARAMETERS" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="PASS_PARENT_ENVS" value="1" />
+      <option name="USE_EXTERNAL_CONSOLE" value="0" />
+      <option name="ENV_FILE_PATHS" value="" />
+      <option name="REDIRECT_INPUT_PATH" value="" />
+      <option name="PTY_MODE" value="Auto" />
+      <option name="USE_MONO" value="0" />
+      <option name="RUNTIME_ARGUMENTS" value="" />
+      <option name="AUTO_ATTACH_CHILDREN" value="0" />
+      <option name="MIXED_MODE_DEBUG" value="0" />
+      <option name="PROJECT_PATH" value="$PROJECT_DIR$/Platforms/Desktop/RolePlayingGame.Desktop.csproj" />
+      <option name="PROJECT_EXE_PATH_TRACKING" value="1" />
+      <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
+      <option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
+      <option name="PROJECT_KIND" value="DotNetCore" />
+      <option name="PROJECT_TFM" value="" />
+      <method v="2">
+        <option name="Build" />
+      </method>
+    </configuration>
+    <configuration name="RolePlayingGame.Windows" type="DotNetProject" factoryName=".NET Project">
+      <option name="EXE_PATH" value="" />
+      <option name="PROGRAM_PARAMETERS" value="" />
+      <option name="WORKING_DIRECTORY" value="" />
+      <option name="PASS_PARENT_ENVS" value="1" />
+      <option name="USE_EXTERNAL_CONSOLE" value="0" />
+      <option name="ENV_FILE_PATHS" value="" />
+      <option name="REDIRECT_INPUT_PATH" value="" />
+      <option name="PTY_MODE" value="Auto" />
+      <option name="USE_MONO" value="0" />
+      <option name="RUNTIME_ARGUMENTS" value="" />
+      <option name="AUTO_ATTACH_CHILDREN" value="0" />
+      <option name="MIXED_MODE_DEBUG" value="0" />
+      <option name="PROJECT_PATH" value="$PROJECT_DIR$/Platforms/Windows/RolePlayingGame.Windows.csproj" />
+      <option name="PROJECT_EXE_PATH_TRACKING" value="1" />
+      <option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
+      <option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
+      <option name="PROJECT_KIND" value="DotNetCore" />
+      <option name="PROJECT_TFM" value="" />
+      <method v="2">
+        <option name="Build" />
+      </method>
+    </configuration>
+    <configuration name="RolePlayingGame.Android" type="XamarinAndroidProject" factoryName="Xamarin.Android">
+      <option name="PROJECT_PATH" value="$PROJECT_DIR$/Platforms/Android/RolePlayingGame.Android.csproj" />
+      <option name="PROGRAM_PARAMETERS" value="" />
+      <option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
+      <option name="DEPLOY_BEHAVIOUR_NAME" value="Default" />
+      <method v="2">
+        <option name="Build" />
+      </method>
+    </configuration>
+    <configuration name="RolePlayingGame.iOS" type="XamarinIOSProject" factoryName="Xamarin.iOS">
+      <option name="PROJECT_PATH" value="$PROJECT_DIR$/Platforms/iOS/RolePlayingGame.iOS.csproj" />
+      <option name="PROGRAM_PARAMETERS" value="" />
+      <option name="IS_PASS_PARENT_ENVS" value="false" />
+      <option name="EXTRA_MLAUNCH_PARAMETERS" value="" />
+      <option name="PLATFORM_TYPE" value="IOS" />
+      <method v="2" />
+    </configuration>
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="6ac6afe1-7aa8-4a82-8199-59730b04adfc" name="Changes" comment="" />
+      <created>1747951170889</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1747951170889</updated>
+      <workItem from="1747951170891" duration="9000" />
+      <workItem from="1754340741781" duration="1109000" />
+      <workItem from="1754350062927" duration="157000" />
+    </task>
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="UnityProjectConfiguration" hasMinimizedUI="false" />
+  <component name="VcsManagerConfiguration">
+    <option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager>
+      <breakpoints>
+        <breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
+          <properties exception="System.OperationCanceledException" breakIfHandledByOtherCode="false" displayValue="System.OperationCanceledException" />
+          <option name="timeStamp" value="1" />
+        </breakpoint>
+        <breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
+          <properties exception="System.Threading.Tasks.TaskCanceledException" breakIfHandledByOtherCode="false" displayValue="System.Threading.Tasks.TaskCanceledException" />
+          <option name="timeStamp" value="2" />
+        </breakpoint>
+        <breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
+          <properties exception="System.Threading.ThreadAbortException" breakIfHandledByOtherCode="false" displayValue="System.Threading.ThreadAbortException" />
+          <option name="timeStamp" value="3" />
+        </breakpoint>
+      </breakpoints>
+    </breakpoint-manager>
+  </component>
+</project>

+ 2 - 2
RolePlayingGame/Core/AudioManager.cs

@@ -52,13 +52,13 @@ namespace RolePlaying
             string soundBankFile)
             : base(game)
         {
-            try
+            /*try
             {
                 audioEngine = new AudioEngine(settingsFile);
                 waveBank = new WaveBank(audioEngine, waveBankFile);
                 soundBank = new SoundBank(audioEngine, soundBankFile);
             }
-            catch (NoAudioHardwareException)
+            catch (NoAudioHardwareException)*/
             {
                 // silently fall back to silence
                 audioEngine = null;

+ 1 - 1
RolePlayingGame/Core/Combat/Combatant.cs

@@ -286,7 +286,7 @@ namespace RolePlaying
         public virtual void Draw(GameTime gameTime)
         {
             CombatSprite.Draw(Session.ScreenManager.SpriteBatch,
-                Position, 1f - Position.Y / RolePlayingGame.BUFFER_WIDTH);
+                Position, 1f - Position.Y / Session.BACK_BUFFER_HEIGHT);
 
             if (Character.ShadowTexture != null)
             {

+ 12 - 0
RolePlayingGame/Core/Content/Content.mgcb

@@ -3427,6 +3427,18 @@
 /processorParam:TextureFormat=Color
 /build:Textures/GameScreens/TitleBar.png
 
+#begin Textures/GameScreens/blank.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:Textures/GameScreens/blank.png
+
 #begin Textures/Gear/Boots01a.png
 /importer:TextureImporter
 /processor:TextureProcessor

BIN
RolePlayingGame/Core/Content/Textures/GameScreens/blank.png


+ 1 - 1
RolePlayingGame/Core/Fonts.cs

@@ -387,7 +387,7 @@ namespace RolePlaying
 
             // draw the string
             spriteBatch.DrawString(font, text, centeredPosition, color, 0f, 
-                Vector2.Zero, 1f, SpriteEffects.None, 1f - position.Y / RolePlayingGame.BUFFER_HEIGHT);
+                Vector2.Zero, 1f, SpriteEffects.None, 1f - position.Y / Session.BACK_BUFFER_HEIGHT);
         }
 
 

+ 1 - 1
RolePlayingGame/Core/GameScreens/ChestScreen.cs

@@ -452,7 +452,7 @@ namespace RolePlaying
                 maximumCount - MaximumListEntries);
             EndIndex = Math.Min(StartIndex + MaximumListEntries, maximumCount);
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             DrawBackground();
             if (dataList.Count > 0)

+ 2 - 2
RolePlayingGame/Core/GameScreens/DialogueScreen.cs

@@ -269,10 +269,10 @@ namespace RolePlaying
             Vector2 textPosition = dialogueStartPosition;
 
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // draw the fading screen
-            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, RolePlayingGame.BUFFER_WIDTH, RolePlayingGame.BUFFER_HEIGHT), Color.White);
+            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT), Color.White);
 
             // draw popup background
             spriteBatch.Draw(backgroundTexture, backgroundPosition, Color.White);

+ 2 - 2
RolePlayingGame/Core/GameScreens/GameOverScreen.cs

@@ -120,10 +120,10 @@ namespace RolePlaying
         public override void Draw(GameTime gameTime)
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw fading screen
-            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, RolePlayingGame.BUFFER_WIDTH, RolePlayingGame.BUFFER_HEIGHT), Color.White);
+            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT), Color.White);
 
             // Draw popup texture
             spriteBatch.Draw(backTexture, backgroundPosition, Color.White);

+ 1 - 1
RolePlayingGame/Core/GameScreens/Hud.cs

@@ -157,7 +157,7 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = screenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, Session.ScreenManager.GlobalTransformation);
 
             startingInfoPosition.X = 640f;
 

+ 1 - 1
RolePlayingGame/Core/GameScreens/InnScreen.cs

@@ -290,7 +290,7 @@ namespace RolePlaying
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
             Vector2 dialogPosition = informationPosition;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw fade screen
             spriteBatch.Draw(fadeTexture, screenRectangle, Color.White);

+ 1 - 1
RolePlayingGame/Core/GameScreens/LevelUpScreen.cs

@@ -299,7 +299,7 @@ namespace RolePlaying
 
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw the fading screen
             spriteBatch.Draw(fadeTexture, fadeDest, Color.White);

+ 2 - 2
RolePlayingGame/Core/GameScreens/ListScreen.cs

@@ -25,7 +25,7 @@ namespace RolePlaying
 
         private Texture2D backgroundTexture;
         private readonly Rectangle backgroundDestination =
-            new Rectangle(0, 0, RolePlayingGame.BUFFER_WIDTH, RolePlayingGame.BUFFER_HEIGHT);
+            new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
         private Texture2D fadeTexture;
 
         private Texture2D listTexture;
@@ -411,7 +411,7 @@ namespace RolePlaying
                 dataList.Count - MaximumListEntries);
             endIndex = Math.Min(startIndex + MaximumListEntries, dataList.Count);
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             DrawBackground();
             if (dataList.Count > 0)

+ 2 - 2
RolePlayingGame/Core/GameScreens/PlayerSelectionScreen.cs

@@ -304,9 +304,9 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
-            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, RolePlayingGame.BUFFER_WIDTH, RolePlayingGame.BUFFER_HEIGHT), Color.White);
+            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT), Color.White);
 
             currentTextPosition = textPosition;
 

+ 1 - 1
RolePlayingGame/Core/GameScreens/QuestDetailsScreen.cs

@@ -323,7 +323,7 @@ namespace RolePlaying
             Vector2 dialoguePosition = textPosition;
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw the fading screen
             spriteBatch.Draw(fadeTexture, fadeDest, Color.White);

+ 1 - 1
RolePlayingGame/Core/GameScreens/RewardsScreen.cs

@@ -266,7 +266,7 @@ namespace RolePlaying
             titlePosition.Y = backgroundPosition.Y + lineSpacing;
 
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw the fading screen
             spriteBatch.Draw(fadeTexture, fadeDest, Color.White);

+ 1 - 1
RolePlayingGame/Core/GameScreens/StatisticsScreen.cs

@@ -222,7 +222,7 @@ namespace RolePlaying
         {
             screenAnimation.UpdateAnimation((float)gameTime.ElapsedGameTime.TotalSeconds);
 
-            ScreenManager.SpriteBatch.Begin();
+            ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
             DrawStatistics();
             ScreenManager.SpriteBatch.End();
         }

+ 1 - 1
RolePlayingGame/Core/GameScreens/StoreScreen.cs

@@ -175,7 +175,7 @@ namespace RolePlaying
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
             // Draw Shop Main Menu
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw Shop Main Menu Screen
             DrawMainMenu();

+ 1 - 1
RolePlayingGame/Core/MenuScreens/BackstoryScreen.cs

@@ -131,7 +131,7 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             spriteBatch.Draw(backgroundTexture, Vector2.Zero, Color.White);
             spriteBatch.Draw(plankTexture, plankPosition, Color.White);

+ 1 - 1
RolePlayingGame/Core/MenuScreens/ControlsScreen.cs

@@ -275,7 +275,7 @@ namespace RolePlaying
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
             Vector2 textPosition = Vector2.Zero;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw the background texture
             spriteBatch.Draw(backgroundTexture, Vector2.Zero, Color.White);

+ 1 - 1
RolePlayingGame/Core/MenuScreens/LoadingScreen.cs

@@ -165,7 +165,7 @@ namespace RolePlaying
 
                 Color color = new Color((byte)255, (byte)255, (byte)255, TransitionAlpha);
 
-                spriteBatch.Begin();
+                spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
                 spriteBatch.Draw(loadingBlackTexture, loadingBlackTextureDestination,
                     Color.White);
                 spriteBatch.Draw(loadingTexture, loadingPosition, Color.White);

+ 7 - 18
RolePlayingGame/Core/MenuScreens/MainMenuScreen.cs

@@ -41,20 +41,10 @@ namespace RolePlaying
 
         private Texture2D plankTexture1, plankTexture2, plankTexture3;
 
-
-
-
-
-
         MenuEntry newGameMenuEntry, exitGameMenuEntry;
         MenuEntry saveGameMenuEntry, loadGameMenuEntry;
         MenuEntry controlsMenuEntry, helpMenuEntry;
 
-
-
-
-
-
         /// <summary>
         /// Constructor fills in the menu contents.
         /// </summary>
@@ -65,7 +55,7 @@ namespace RolePlaying
             newGameMenuEntry = new MenuEntry("New Game");
             newGameMenuEntry.Description = "Start a New Game";
             newGameMenuEntry.Font = Fonts.HeaderFont;
-            newGameMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT - 5, 0f);
+            newGameMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT - 5, 0f);
             newGameMenuEntry.Angle = -3.0f;
             newGameMenuEntry.TextOffset = new Vector2(0f, 5.0f);
             newGameMenuEntry.Selected += NewGameMenuEntrySelected;
@@ -78,7 +68,7 @@ namespace RolePlaying
                 saveGameMenuEntry = new MenuEntry("Save Game");
                 saveGameMenuEntry.Description = "Save the Game";
                 saveGameMenuEntry.Font = Fonts.HeaderFont;
-                saveGameMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT + 10, 0f);
+                saveGameMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT + 10, 0f);
                 saveGameMenuEntry.Selected += SaveGameMenuEntrySelected;
                 MenuEntries.Add(saveGameMenuEntry);
             }
@@ -91,7 +81,7 @@ namespace RolePlaying
             loadGameMenuEntry = new MenuEntry("Load Game");
             loadGameMenuEntry.Description = "Load the Game";
             loadGameMenuEntry.Font = Fonts.HeaderFont;
-            loadGameMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT - 20, 0f);
+            loadGameMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT - 20, 0f);
             loadGameMenuEntry.Selected += LoadGameMenuEntrySelected;
             MenuEntries.Add(loadGameMenuEntry);
 
@@ -99,7 +89,7 @@ namespace RolePlaying
             controlsMenuEntry = new MenuEntry("Controls");
             controlsMenuEntry.Description = "View Game Controls";
             controlsMenuEntry.Font = Fonts.HeaderFont;
-            controlsMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT, 0f);
+            controlsMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT, 0f);
             controlsMenuEntry.Angle = 5.0f;
             controlsMenuEntry.TextOffset = new Vector2(0f, -15.0f);
             controlsMenuEntry.Selected += ControlsMenuEntrySelected;
@@ -109,7 +99,7 @@ namespace RolePlaying
             helpMenuEntry = new MenuEntry("Backstory");
             helpMenuEntry.Description = "View Game Backstory";
             helpMenuEntry.Font = Fonts.HeaderFont;
-            helpMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT - 20, 0f);
+            helpMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT - 20, 0f);
             helpMenuEntry.Angle = -4.0f;
             helpMenuEntry.TextOffset = new Vector2(0f, 5.0f);
             helpMenuEntry.Selected += HelpMenuEntrySelected;
@@ -119,7 +109,7 @@ namespace RolePlaying
             exitGameMenuEntry = new MenuEntry("Exit");
             exitGameMenuEntry.Description = "Quit the Game";
             exitGameMenuEntry.Font = Fonts.HeaderFont;
-            exitGameMenuEntry.Position = new Vector2(RolePlayingGame.BUFFER_HEIGHT, 0f);
+            exitGameMenuEntry.Position = new Vector2(Session.BACK_BUFFER_HEIGHT, 0f);
             exitGameMenuEntry.Selected += OnCancel;
             MenuEntries.Add(exitGameMenuEntry);
 
@@ -127,7 +117,6 @@ namespace RolePlaying
             AudioManager.PushMusic("MainTheme");
         }
 
-
         /// <summary>
         /// Load the graphics content for this screen.
         /// </summary>
@@ -323,7 +312,7 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // draw the background images
             spriteBatch.Draw(backgroundTexture, backgroundPosition, Color.White);

+ 1 - 1
RolePlayingGame/Core/MenuScreens/MessageBoxScreen.cs

@@ -141,7 +141,7 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             spriteBatch.Draw(loadingBlackTexture, loadingBlackTextureDestination, 
                 Color.White);

+ 1 - 1
RolePlayingGame/Core/MenuScreens/SaveLoadScreen.cs

@@ -323,7 +323,7 @@ namespace RolePlaying
         public override void Draw(GameTime gameTime)
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             spriteBatch.Draw(backgroundTexture, backgroundPosition, Color.White);
             spriteBatch.Draw(plankTexture, plankPosition, Color.White);

+ 35 - 10
RolePlayingGame/Core/RolePlayingGame.cs

@@ -5,6 +5,7 @@
 // Copyright (C) Microsoft Corporation. All rights reserved.
 //-----------------------------------------------------------------------------
 
+using System;
 using System.IO;
 using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Audio;
@@ -20,26 +21,50 @@ namespace RolePlaying
     /// </summary>
     public class RolePlayingGame : Game
     {
-        internal const int BUFFER_WIDTH = 1280;
-        internal const int BUFFER_HEIGHT = 720;
-        GraphicsDeviceManager graphics;
+        GraphicsDeviceManager graphicsDeviceManager;
         ScreenManager screenManager;
 
+        /// <summary>
+        /// Indicates if the game is running on a mobile platform.
+        /// </summary>
+        public readonly static bool IsMobile = OperatingSystem.IsAndroid() || OperatingSystem.IsIOS();
+
+        /// <summary>
+        /// Indicates if the game is running on a desktop platform.
+        /// </summary>
+        public readonly static bool IsDesktop = OperatingSystem.IsMacOS() || OperatingSystem.IsLinux() || OperatingSystem.IsWindows();
+
         /// <summary>
         /// Create a new RolePlayingGame object.
         /// </summary>
         public RolePlayingGame()
         {
             // initialize the graphics system
-            graphics = new GraphicsDeviceManager(this);
-            graphics.PreferredBackBufferWidth = BUFFER_WIDTH;
-            graphics.PreferredBackBufferHeight = BUFFER_HEIGHT;
-
-            IsMouseVisible = true;
+            graphicsDeviceManager = new GraphicsDeviceManager(this);
+            graphicsDeviceManager.PreferredBackBufferWidth = Session.BACK_BUFFER_WIDTH;
+            graphicsDeviceManager.PreferredBackBufferHeight = Session.BACK_BUFFER_HEIGHT;
+
+            if (IsMobile)
+            {
+                graphicsDeviceManager.IsFullScreen = true;
+                IsMouseVisible = false;
+            }
+            else if (IsDesktop)
+            {
+                graphicsDeviceManager.IsFullScreen = false;
+                IsMouseVisible = true;
+            }
+            else
+            {
+                throw new PlatformNotSupportedException();
+            }
 
             // configure the content manager
             Content.RootDirectory = "Content";
 
+            // Configure screen orientations.
+            graphicsDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
+
             // add a gamer-services component, which is required for the storage APIs
             // TODO: GamerServicesComponent was XNA-specific and not available in MonoGame
             // Components.Add(new GamerServicesComponent(this));
@@ -67,7 +92,7 @@ namespace RolePlaying
 
             base.Initialize();
 
-            TileEngine.Viewport = graphics.GraphicsDevice.Viewport;
+            TileEngine.Viewport = graphicsDeviceManager.GraphicsDevice.Viewport;
 
             screenManager.AddScreen(new MainMenuScreen());
         }
@@ -112,7 +137,7 @@ namespace RolePlaying
         /// <param name="gameTime">Provides a snapshot of timing values.</param>
         protected override void Draw(GameTime gameTime)
         {
-            graphics.GraphicsDevice.Clear(Color.Transparent);
+            graphicsDeviceManager.GraphicsDevice.Clear(Color.Transparent);
 
             base.Draw(gameTime);
         }

+ 39 - 44
RolePlayingGame/Core/ScreenManager/GameScreen.cs

@@ -7,21 +7,10 @@
 
 using System;
 using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input.Touch;
 
 namespace RolePlaying
 {
-    /// <summary>
-    /// Enum describes the screen transition state.
-    /// </summary>
-    public enum ScreenState
-    {
-        TransitionOn,
-        Active,
-        TransitionOff,
-        Hidden,
-    }
-
-
     /// <summary>
     /// A screen is a single layer that has update and draw logic, and which
     /// can be combined with other layers to build up a complex menu system.
@@ -35,8 +24,6 @@ namespace RolePlaying
     /// </remarks>
     public abstract class GameScreen
     {
-
-
         /// <summary>
         /// Normally when one screen is brought up over the top of another,
         /// the first screen will transition off to make room for the new
@@ -52,7 +39,6 @@ namespace RolePlaying
 
         bool isPopup = false;
 
-
         /// <summary>
         /// Indicates how long the screen takes to
         /// transition on when it is activated.
@@ -65,7 +51,6 @@ namespace RolePlaying
 
         TimeSpan transitionOnTime = TimeSpan.Zero;
 
-
         /// <summary>
         /// Indicates how long the screen takes to
         /// transition off when it is deactivated.
@@ -78,7 +63,6 @@ namespace RolePlaying
 
         TimeSpan transitionOffTime = TimeSpan.Zero;
 
-
         /// <summary>
         /// Gets the current position of the screen transition, ranging
         /// from zero (fully active, no transition) to one (transitioned
@@ -92,7 +76,6 @@ namespace RolePlaying
 
         float transitionPosition = 1;
 
-
         /// <summary>
         /// Gets the current alpha of the screen transition, ranging
         /// from 255 (fully active, no transition) to 0 (transitioned
@@ -103,7 +86,6 @@ namespace RolePlaying
             get { return (byte)(255 - TransitionPosition * 255); }
         }
 
-
         /// <summary>
         /// Gets the current screen transition state.
         /// </summary>
@@ -115,7 +97,6 @@ namespace RolePlaying
 
         ScreenState screenState = ScreenState.TransitionOn;
 
-
         /// <summary>
         /// There are two possible reasons why a screen might be transitioning
         /// off. It could be temporarily going away to make room for another
@@ -127,8 +108,8 @@ namespace RolePlaying
         public bool IsExiting
         {
             get { return isExiting; }
-            protected internal set 
-            { 
+            protected internal set
+            {
                 bool fireEvent = !isExiting && value;
                 isExiting = value;
                 if (fireEvent && (Exiting != null))
@@ -140,7 +121,6 @@ namespace RolePlaying
 
         bool isExiting = false;
 
-
         /// <summary>
         /// Checks whether this screen is active and can respond to user input.
         /// </summary>
@@ -156,7 +136,6 @@ namespace RolePlaying
 
         bool otherScreenHasFocus;
 
-
         /// <summary>
         /// Gets the manager that this screen belongs to.
         /// </summary>
@@ -168,30 +147,47 @@ namespace RolePlaying
 
         ScreenManager screenManager;
 
-
         public event EventHandler Exiting;
 
+        private GestureType enabledGestures = GestureType.None;
 
+        /// <summary>
+        /// Gets the gestures the screen is interested in. Screens should be as specific
+        /// as possible with gestures to increase the accuracy of the gesture engine.
+        /// For example, most menus only need Tap or perhaps Tap and VerticalDrag to operate.
+        /// These gestures are handled by the ScreenManager when screens change and
+        /// all gestures are placed in the InputState passed to the HandleInput method.
+        /// </summary>
+        public GestureType EnabledGestures
+        {
+            get { return enabledGestures; }
+            protected set
+            {
+                enabledGestures = value;
 
-
-
+                // the screen manager handles this during screen changes, but
+                // if this screen is active and the gesture types are changing,
+                // we have to update the TouchPanel ourself.
+                if (ScreenState == ScreenState.Active)
+                {
+                    TouchPanel.EnabledGestures = value;
+                }
+            }
+        }
 
         /// <summary>
         /// Load graphics content for the screen.
         /// </summary>
-        public virtual void LoadContent() { }
-
+        public virtual void LoadContent()
+        {
+            ScreenManager.ScalePresentationArea();
+        }
 
         /// <summary>
         /// Unload content for the screen.
         /// </summary>
         public virtual void UnloadContent() { }
 
-
-
-
-
-
         /// <summary>
         /// Allows the screen to run logic, such as updating the transition position.
         /// Unlike HandleInput, this method is called regardless of whether the screen
@@ -241,8 +237,15 @@ namespace RolePlaying
                     screenState = ScreenState.Active;
                 }
             }
-        }
 
+            // Check if the back buffer size has changed (e.g., window resize).
+            if (ScreenManager.BackbufferHeight != ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight
+                || ScreenManager.BackbufferWidth != ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth)
+            {
+                // Adjust the presentation area to match the new back buffer size.
+                ScreenManager.ScalePresentationArea();
+            }
+        }
 
         /// <summary>
         /// Helper for updating the screen transition position.
@@ -272,7 +275,6 @@ namespace RolePlaying
             return true;
         }
 
-
         /// <summary>
         /// Allows the screen to handle user input. Unlike Update, this method
         /// is only called when the screen is active, and not when some other
@@ -286,11 +288,6 @@ namespace RolePlaying
         /// </summary>
         public virtual void Draw(GameTime gameTime) { }
 
-
-
-
-
-
         /// <summary>
         /// Tells the screen to go away. Unlike ScreenManager.RemoveScreen, which
         /// instantly kills the screen, this method respects the transition timings
@@ -306,7 +303,5 @@ namespace RolePlaying
                 ScreenManager.RemoveScreen(this);
             }
         }
-
-
     }
-}
+}

+ 1 - 1
RolePlayingGame/Core/ScreenManager/MenuScreen.cs

@@ -169,7 +169,7 @@ namespace RolePlaying
         {
             SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
 
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
 
             // Draw each menu entry in turn.
             for (int i = 0; i < menuEntries.Count; i++)

+ 94 - 23
RolePlayingGame/Core/ScreenManager/ScreenManager.cs

@@ -12,6 +12,7 @@ using Microsoft.Xna.Framework;
 using Microsoft.Xna.Framework.Content;
 using Microsoft.Xna.Framework.Graphics;
 using System.Text;
+using Microsoft.Xna.Framework.Input.Touch;
 
 namespace RolePlaying
 {
@@ -27,18 +28,30 @@ namespace RolePlaying
     /// </remarks>
     public class ScreenManager : DrawableGameComponent
     {
-
         List<GameScreen> screens = new List<GameScreen>();
         List<GameScreen> screensToUpdate = new List<GameScreen>();
 
         SpriteBatch spriteBatch;
+        private Texture2D blankTexture;
 
         bool isInitialized;
         bool traceEnabled;
 
+        private int backbufferWidth;
+        /// <summary>Gets or sets the current backbuffer width.</summary>
+        public int BackbufferWidth { get => backbufferWidth; set => backbufferWidth = value; }
 
+        private int backbufferHeight;
+        /// <summary>Gets or sets the current backbuffer height.</summary>
+        public int BackbufferHeight { get => backbufferHeight; set => backbufferHeight = value; }
 
+        private Vector2 baseScreenSize = new Vector2(Session.BACK_BUFFER_WIDTH, Session.BACK_BUFFER_HEIGHT);
+        /// <summary>Gets or sets the base screen size used for scaling calculations.</summary>
+        public Vector2 BaseScreenSize { get => baseScreenSize; set => baseScreenSize = value; }
 
+        private Matrix globalTransformation;
+        /// <summary>Gets or sets the global transformation matrix for scaling and positioning.</summary>
+        public Matrix GlobalTransformation { get => globalTransformation; set => globalTransformation = value; }
 
         /// <summary>
         /// A default SpriteBatch shared by all the screens. This saves
@@ -49,7 +62,6 @@ namespace RolePlaying
             get { return spriteBatch; }
         }
 
-
         /// <summary>
         /// If true, the manager prints out a list of all the screens
         /// each time it is updated. This can be useful for making sure
@@ -61,20 +73,15 @@ namespace RolePlaying
             set { traceEnabled = value; }
         }
 
-
-
-
-
-
         /// <summary>
         /// Constructs a new screen manager component.
         /// </summary>
         public ScreenManager(Game game)
             : base(game)
         {
+            TouchPanel.EnabledGestures = GestureType.None;
         }
 
-
         /// <summary>
         /// Initializes the screen manager component.
         /// </summary>
@@ -85,7 +92,6 @@ namespace RolePlaying
             isInitialized = true;
         }
 
-
         /// <summary>
         /// Load your graphics content.
         /// </summary>
@@ -96,6 +102,8 @@ namespace RolePlaying
 
             spriteBatch = new SpriteBatch(GraphicsDevice);
 
+            blankTexture = content.Load<Texture2D>("Textures/GameScreens/blank");
+
             // Tell each of the screens to load their content.
             foreach (GameScreen screen in screens)
             {
@@ -103,7 +111,6 @@ namespace RolePlaying
             }
         }
 
-
         /// <summary>
         /// Unload your graphics content.
         /// </summary>
@@ -116,11 +123,6 @@ namespace RolePlaying
             }
         }
 
-
-
-
-
-
         /// <summary>
         /// Allows each screen to run logic.
         /// </summary>
@@ -171,7 +173,6 @@ namespace RolePlaying
                 TraceScreens();
         }
 
-
         /// <summary>
         /// Prints a list of all the screens, for debugging.
         /// </summary>
@@ -182,7 +183,7 @@ namespace RolePlaying
             foreach (GameScreen screen in screens)
                 screenNames.Add(screen.GetType().Name);
 
-#if WINDOWS
+#if DEBUG
             Trace.WriteLine(string.Join(", ", screenNames.ToArray()));
 #endif
         }
@@ -202,11 +203,6 @@ namespace RolePlaying
             }
         }
 
-
-
-
-
-
         /// <summary>
         /// Adds a new screen to the screen manager.
         /// </summary>
@@ -222,6 +218,7 @@ namespace RolePlaying
             }
 
             screens.Add(screen);
+            TouchPanel.EnabledGestures = screen.EnabledGestures;
         }
 
 
@@ -254,6 +251,80 @@ namespace RolePlaying
             return screens.ToArray();
         }
 
+        /// <summary>
+        /// Draws a translucent black fullscreen sprite. This is used for fading
+        /// screens in and out, or for darkening the background behind popups.
+        /// </summary>
+        /// <param name="alpha">The opacity level of the fade (0 = fully transparent, 1 = fully opaque).</param>
+        public void FadeBackBufferToBlack(float alpha)
+        {
+            Viewport viewport = GraphicsDevice.Viewport;
+
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, GlobalTransformation);
 
+            spriteBatch.Draw(blankTexture,
+                             new Rectangle(0, 0, viewport.Width, viewport.Height),
+                             Color.Black * alpha);
+
+            spriteBatch.End();
+        }
+
+        /// <summary>
+        /// Scales the game presentation area to match the screen's aspect ratio.
+        /// </summary>
+        public void ScalePresentationArea()
+        {
+            // Validate parameters before calculation
+            if (GraphicsDevice == null || baseScreenSize.X <= 0 || baseScreenSize.Y <= 0)
+            {
+                throw new InvalidOperationException("Invalid graphics configuration");
+            }
+
+            // Fetch screen dimensions
+            backbufferWidth = GraphicsDevice.PresentationParameters.BackBufferWidth;
+            backbufferHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;
+
+            // Prevent division by zero
+            if (backbufferHeight == 0 || baseScreenSize.Y == 0)
+            {
+                return;
+            }
+
+            // Calculate aspect ratios
+            float baseAspectRatio = baseScreenSize.X / baseScreenSize.Y;
+            float screenAspectRatio = backbufferWidth / (float)backbufferHeight;
+
+            // Determine uniform scaling factor
+            float scalingFactor;
+            float horizontalOffset = 0;
+            float verticalOffset = 0;
+
+            if (screenAspectRatio > baseAspectRatio)
+            {
+                // Wider screen: scale by height
+                scalingFactor = backbufferHeight / baseScreenSize.Y;
+
+                // Centre things horizontally.
+                horizontalOffset = (backbufferWidth - baseScreenSize.X * scalingFactor) / 2;
+            }
+            else
+            {
+                // Taller screen: scale by width
+                scalingFactor = backbufferWidth / baseScreenSize.X;
+
+                // Centre things vertically.
+                verticalOffset = (backbufferHeight - baseScreenSize.Y * scalingFactor) / 2;
+            }
+
+            // Update the transformation matrix
+            globalTransformation = Matrix.CreateScale(scalingFactor) *
+                                   Matrix.CreateTranslation(horizontalOffset, verticalOffset, 0);
+
+            // Update the inputTransformation with the Inverted globalTransformation
+            // TODO inputState.UpdateInputTransformation(Matrix.Invert(globalTransformation));
+
+            // Debug info
+            Debug.WriteLine($"Screen Size - Width[{backbufferWidth}] Height[{backbufferHeight}] ScalingFactor[{scalingFactor}]");
+        }
     }
-}
+}

+ 20 - 0
RolePlayingGame/Core/ScreenManager/ScreenState.cs

@@ -0,0 +1,20 @@
+//-----------------------------------------------------------------------------
+// ScreenState.cs
+//
+// Microsoft XNA Community Game Platform
+// Copyright (C) Microsoft Corporation. All rights reserved.
+//-----------------------------------------------------------------------------
+
+namespace RolePlaying
+{
+    /// <summary>
+    /// Enum describes the screen transition state.
+    /// </summary>
+    public enum ScreenState
+    {
+        TransitionOn,
+        Active,
+        TransitionOff,
+        Hidden,
+    }
+}

+ 9 - 6
RolePlayingGame/Core/Session/Session.cs

@@ -20,6 +20,9 @@ namespace RolePlaying
 {
     class Session
     {
+        internal const int BACK_BUFFER_WIDTH = 1280;
+        internal const int BACK_BUFFER_HEIGHT = 720;
+
         /// <summary>
         /// The single Session instance that can be active at a time.
         /// </summary>
@@ -1110,14 +1113,14 @@ namespace RolePlaying
                 // draw the combat background
                 if (TileEngine.Map.CombatTexture != null)
                 {
-                    spriteBatch.Begin();
+                    spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
                     spriteBatch.Draw(TileEngine.Map.CombatTexture, Vector2.Zero,
                         Color.White);
                     spriteBatch.End();
                 }
 
                 // draw the combat itself
-                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
+                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, ScreenManager.GlobalTransformation);
                 CombatEngine.Draw(gameTime);
                 spriteBatch.End();
             }
@@ -1130,7 +1133,7 @@ namespace RolePlaying
 
 #if DEBUG
             // draw the debug information
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
             spriteBatch.DrawString(Fonts.DebugFont, "Map: " + TileEngine.Map.AssetName, new Vector2(10, 10), Color.Yellow);
             spriteBatch.End();
 #endif
@@ -1145,7 +1148,7 @@ namespace RolePlaying
             SpriteBatch spriteBatch = screenManager.SpriteBatch;
 
             // draw the background
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
             if (TileEngine.Map.Texture != null)
             {
                 // draw the ground layer
@@ -1156,7 +1159,7 @@ namespace RolePlaying
             spriteBatch.End();
 
             // Sort the object layer and player according to depth 
-            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
+            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, ScreenManager.GlobalTransformation);
 
             float elapsedSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;
 
@@ -1358,7 +1361,7 @@ namespace RolePlaying
             spriteBatch.End();
 
             // draw the foreground
-            spriteBatch.Begin();
+            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, ScreenManager.GlobalTransformation);
             if (TileEngine.Map.Texture != null)
             {
                 TileEngine.DrawLayers(spriteBatch, false, false, true);

+ 1 - 1
RolePlayingGame/Platforms/Android/AndroidManifest.xml

@@ -4,7 +4,7 @@
           android:versionCode="1" 
           android:versionName="1.0">
   
-  <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
+  <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="34" />
   
   <uses-permission android:name="android.permission.INTERNET" />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

+ 5 - 3
RolePlayingGame/Platforms/Android/MainActivity.cs

@@ -12,8 +12,8 @@ namespace RolePlaying.Android
         Icon = "@drawable/icon",
         AlwaysRetainTaskState = true,
         LaunchMode = LaunchMode.SingleInstance,
-        ScreenOrientation = ScreenOrientation.FullUser,
-        ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
+        ScreenOrientation = ScreenOrientation.SensorLandscape,
+        ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden
     )]
     public class MainActivity : AndroidGameActivity
     {
@@ -25,9 +25,11 @@ namespace RolePlaying.Android
             base.OnCreate(bundle);
 
             _game = new RolePlayingGame();
+
             _view = _game.Services.GetService(typeof(View)) as View;
             SetContentView(_view);
+
             _game.Run();
         }
     }
-}
+}

BIN
RolePlayingGame/Platforms/Android/Resources/drawable/icon.png


Разница между файлами не показана из-за своего большого размера
+ 2 - 0
RolePlayingGame/Platforms/Android/Resources/drawable/icon.svg


+ 2 - 9
RolePlayingGame/Platforms/Android/RolePlayingGame.Android.csproj

@@ -7,21 +7,14 @@
     <AssemblyName>RolePlayingGame</AssemblyName>
     <AssemblyTitle>Role Playing Game - Android</AssemblyTitle>
     <AssemblyDescription>MonoGame Role Playing Game Sample for Android</AssemblyDescription>
-    <AssemblyCompany>MonoGame Samples</AssemblyCompany>
+    <AssemblyCompany>MonoGame Foundation</AssemblyCompany>
     <AssemblyProduct>Role Playing Game</AssemblyProduct>
-    <AssemblyCopyright>Copyright (c) 2011 Kenneth J. Pouncey - MIT License</AssemblyCopyright>
     <AssemblyVersion>1.0.0.0</AssemblyVersion>
-    <FileVersion>1.0.0.0</FileVersion>
     <AndroidApplication>true</AndroidApplication>
-    <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
-    <AndroidResgenClass>Resource</AndroidResgenClass>
     <AndroidManifest>AndroidManifest.xml</AndroidManifest>
-    <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
-    <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
-    <AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
-    <AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
     <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
     <MonoGamePlatform>Android</MonoGamePlatform>
+    <SupportedOSPlatformVersion>28</SupportedOSPlatformVersion>
   </PropertyGroup>
 
   <ItemGroup>

+ 19 - 4
RolePlayingGame/Platforms/iOS/Program.cs

@@ -4,24 +4,39 @@ using UIKit;
 namespace RolePlaying.iOS
 {
     [Register("AppDelegate")]
-    public class AppDelegate : UIApplicationDelegate
+    internal class Program : UIApplicationDelegate
     {
         private static RolePlayingGame _game;
 
+        /// <summary>
+        /// Initializes and starts the game by creating an instance of the
+        /// Game class and invoking its Run method.
+        /// </summary>
         internal static void RunGame()
         {
             _game = new RolePlayingGame();
             _game.Run();
         }
 
+        /// <summary>
+        /// Called when the application has finished launching.
+        /// This method starts the game by calling RunGame.
+        /// </summary>
+        /// <param name="app">The UIApplication instance representing the application.</param>
         public override void FinishedLaunching(UIApplication app)
         {
             RunGame();
         }
 
-        public static void Main(string[] args)
+        /// <summary>
+        /// The main entry point for the application.
+        /// This sets up the application and specifies the UIApplicationDelegate
+        /// class to handle application lifecycle events.
+        /// </summary>
+        /// <param name="args">Command-line arguments passed to the application.</param>
+        static void Main(string[] args)
         {
-            UIApplication.Main(args, null, typeof(AppDelegate));
+            UIApplication.Main(args, null, typeof(Program));
         }
     }
-}
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов