1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

updated and fixed android demo

This commit is contained in:
Ellpeck 2020-04-19 03:20:25 +02:00
parent bc61e36ac5
commit 0ee7f74efd
12 changed files with 137 additions and 181 deletions

View file

@ -2,27 +2,38 @@ using Android.App;
using Android.Content.PM; using Android.Content.PM;
using Android.OS; using Android.OS;
using Android.Views; using Android.Views;
using Microsoft.Xna.Framework;
using MLEM.Extensions;
using MLEM.Misc; using MLEM.Misc;
namespace Demos.Android { namespace Demos.Android {
[Activity(Label = "Demos.Android" [Activity(
, MainLauncher = true Label = "@string/app_name",
, Icon = "@drawable/icon" MainLauncher = true,
, Theme = "@style/Theme.Splash" Icon = "@drawable/icon",
, AlwaysRetainTaskState = true AlwaysRetainTaskState = true,
, LaunchMode = LaunchMode.SingleInstance LaunchMode = LaunchMode.SingleInstance,
, ScreenOrientation = ScreenOrientation.UserLandscape ScreenOrientation = ScreenOrientation.UserLandscape,
, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)] ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity { )]
public class Activity1 : AndroidGameActivity {
private GameImpl game;
private View view;
protected override void OnCreate(Bundle bundle) { protected override void OnCreate(Bundle bundle) {
base.OnCreate(bundle); base.OnCreate(bundle);
TextInputWrapper.Current = new TextInputWrapper.Mobile(); TextInputWrapper.Current = new TextInputWrapper.Mobile();
var g = new GameImpl(); this.game = new GameImpl();
// reset MlemGame width and height to use device's aspect ratio
this.game.GraphicsDeviceManager.ResetWidthAndHeight(this.game);
// disable mouse handling for android to make emulator behavior more coherent // disable mouse handling for android to make emulator behavior more coherent
g.OnLoadContent += game => game.InputHandler.HandleMouse = false; this.game.OnLoadContent += game => game.InputHandler.HandleMouse = false;
this.SetContentView((View) g.Services.GetService(typeof(View))); this.view = this.game.Services.GetService(typeof(View)) as View;
g.Run();
this.SetContentView(this.view);
this.game.Run();
} }
} }

View file

@ -1,106 +1,92 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" /> <PropertyGroup>
<PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.30703</ProductVersion>
<ProductVersion>8.0.30703</ProductVersion> <SchemaVersion>2.0</SchemaVersion>
<SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{410C0262-131C-4D0E-910D-D01B4F7143E0}</ProjectGuid>
<ProjectGuid>{410C0262-131C-4D0E-910D-D01B4F7143E0}</ProjectGuid> <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <OutputType>Library</OutputType>
<OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder>
<AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Demos.Android</RootNamespace>
<RootNamespace>Demos.Android</RootNamespace> <AssemblyName>Demos.Android</AssemblyName>
<AssemblyName>Demos.Android</AssemblyName> <FileAlignment>512</FileAlignment>
<FileAlignment>512</FileAlignment> <AndroidApplication>true</AndroidApplication>
<AndroidApplication>true</AndroidApplication> <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile> <AndroidResgenClass>Resource</AndroidResgenClass>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidSupportedAbis>armeabi-v7a;x86</AndroidSupportedAbis> <AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions>
<AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions> <TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
<MandroidI18n /> <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion> <AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<MonoGamePlatform>Android</MonoGamePlatform> <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> <AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
</PropertyGroup> <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> </PropertyGroup>
<DebugSymbols>true</DebugSymbols> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType> <DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize> <DebugType>full</DebugType>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath> <Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE;ANDROID</DefineConstants> <OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<ErrorReport>prompt</ErrorReport> <DefineConstants>DEBUG;TRACE;ANDROID</DefineConstants>
<WarningLevel>4</WarningLevel> <ErrorReport>prompt</ErrorReport>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> <WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode> <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
</PropertyGroup> <AndroidLinkMode>None</AndroidLinkMode>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup>
<DebugType>pdbonly</DebugType> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize> <DebugType>pdbonly</DebugType>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath> <Optimize>true</Optimize>
<DefineConstants>TRACE;ANDROID</DefineConstants> <OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<ErrorReport>prompt</ErrorReport> <DefineConstants>TRACE;ANDROID</DefineConstants>
<WarningLevel>4</WarningLevel> <ErrorReport>prompt</ErrorReport>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> <WarningLevel>4</WarningLevel>
<AndroidLinkMode>SdkOnly</AndroidLinkMode> <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
</PropertyGroup> <AndroidLinkMode>SdkOnly</AndroidLinkMode>
<ItemGroup> </PropertyGroup>
<Reference Include="Coroutine, Version=1.0.2.0, Culture=neutral, PublicKeyToken=null"> <ItemGroup>
<HintPath>..\packages\Coroutine.1.0.2\lib\netstandard2.0\Coroutine.dll</HintPath> <Reference Include="System" />
<Private>True</Private> <Reference Include="System.Core" />
</Reference> <Reference Include="System.Xml" />
<Reference Include="Mono.Android" /> <Reference Include="Mono.Android" />
<Reference Include="mscorlib" /> </ItemGroup>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed"> <ItemGroup>
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath> <Compile Include="Activity1.cs" />
<Private>True</Private> <Compile Include="Resources\Resource.Designer.cs" />
</Reference> <Compile Include="Properties\AssemblyInfo.cs" />
<Reference Include="System" /> </ItemGroup>
<Reference Include="System.Core" /> <ItemGroup>
<Reference Include="System.Xml.Linq" /> <AndroidResource Include="Resources\Drawable\Icon.png" />
<Reference Include="System.Xml" /> <AndroidResource Include="Resources\Values\Strings.xml" />
<Reference Include="MonoGame.Framework"> </ItemGroup>
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Android\MonoGame.Framework.dll</HintPath> <ItemGroup>
</Reference> <MonoGameContentReference Include="..\Demos\Content\Content.mgcb" />
<Reference Include="TextCopy, Version=3.0.0.0, Culture=neutral, PublicKeyToken=1ca091877d12ca03"> <None Include="..\Demos\Content\*\**" />
<HintPath>..\packages\TextCopy.3.0.0\lib\netstandard2.1\TextCopy.dll</HintPath> </ItemGroup>
<Private>True</Private> <ItemGroup>
</Reference> <None Include="Properties\AndroidManifest.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Activity1.cs" /> <PackageReference Include="Coroutine" Version="1.0.2" />
<Compile Include="Resources\Resource.Designer.cs" /> <PackageReference Include="MonoGame.Content.Builder" Version="3.7.*" />
<Compile Include="Properties\AssemblyInfo.cs" /> <PackageReference Include="MonoGame.Framework.Android" Version="3.7.1.189" />
</ItemGroup> <PackageReference Include="TextCopy" Version="3.0.2" />
<ItemGroup> </ItemGroup>
<AndroidResource Include="Resources\Values\Strings.xml" /> <ItemGroup>
<AndroidResource Include="Resources\Drawable\Icon.png" /> <ProjectReference Include="..\Demos\Demos.csproj">
<AndroidResource Include="Resources\Drawable\Splash.png" /> <Project>{1bc4682b-aa14-4937-b5c7-707e20fe88ff}</Project>
<AndroidResource Include="Resources\Values\Styles.xml" /> <Name>Demos</Name>
</ItemGroup> </ProjectReference>
<ItemGroup> <ProjectReference Include="..\MLEM.Startup\MLEM.Startup.csproj">
<MonoGameContentReference Include="..\Demos\Content\Content.mgcb" /> <Project>{997f4739-7bec-4621-b9ca-68deb2d74412}</Project>
<None Include="..\Demos\Content\*\**" /> <Name>MLEM.Startup</Name>
</ItemGroup> </ProjectReference>
<ItemGroup> <ProjectReference Include="..\MLEM\MLEM.csproj">
<None Include="packages.config" /> <Project>{1d6ab762-43c4-4775-8924-707c7ec3f142}</Project>
<None Include="Properties\AndroidManifest.xml" /> <Name>MLEM</Name>
</ItemGroup> </ProjectReference>
<ItemGroup> </ItemGroup>
<ProjectReference Include="..\Demos\Demos.csproj"> <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Project>{1bc4682b-aa14-4937-b5c7-707e20fe88ff}</Project>
<Name>Demos</Name>
</ProjectReference>
<ProjectReference Include="..\MLEM.Startup\MLEM.Startup.csproj">
<Project>{997f4739-7bec-4621-b9ca-68deb2d74412}</Project>
<Name>MLEM.Startup</Name>
</ProjectReference>
<ProjectReference Include="..\MLEM\MLEM.csproj">
<Project>{1d6ab762-43c4-4775-8924-707c7ec3f142}</Project>
<Name>MLEM</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
</Project> </Project>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Demos.Android" android:versionCode="1" android:versionName="1.0"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Demos.Android.Demos.Android" android:versionCode="1" android:versionName="1.0">
<uses-sdk /> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="Demos.Android"></application> <application android:label="Demos.Android"></application>
</manifest> </manifest>

View file

@ -7,22 +7,15 @@ using Android.App;
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Demos.Android")] [assembly: AssemblyTitle("Demos.Android")]
[assembly: AssemblyProduct("Demos.Android")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyProduct("Demos.Android")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)] [assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6f377592-2266-4c47-855e-6260ff75e1f4")]
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
@ -35,7 +28,3 @@ using Android.App;
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

View file

@ -47,9 +47,6 @@ namespace Demos.Android
// aapt resource value: 0x7F010000 // aapt resource value: 0x7F010000
public const int Icon = 2130771968; public const int Icon = 2130771968;
// aapt resource value: 0x7F010001
public const int Splash = 2130771969;
static Drawable() static Drawable()
{ {
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); global::Android.Runtime.ResourceIdManager.UpdateIdValues();
@ -64,10 +61,7 @@ namespace Demos.Android
{ {
// aapt resource value: 0x7F020000 // aapt resource value: 0x7F020000
public const int ApplicationName = 2130837504; public const int app_name = 2130837504;
// aapt resource value: 0x7F020001
public const int Hello = 2130837505;
static String() static String()
{ {
@ -78,22 +72,6 @@ namespace Demos.Android
{ {
} }
} }
public partial class Style
{
// aapt resource value: 0x7F030000
public const int Theme_Splash = 2130903040;
static Style()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
}
private Style()
{
}
}
} }
} }
#pragma warning restore 1591 #pragma warning restore 1591

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="Hello">Hello World, Click Me!</string> <string name="app_name">Demos.Android</string>
<string name="ApplicationName">Demos.Android</string>
</resources> </resources>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Coroutine" version="1.0.2" targetFramework="monoandroid90" />
<package id="MonoGame.Extended" version="3.7.0" targetFramework="monoandroid90" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="monoandroid90" />
<package id="TextCopy" version="3.0.0" targetFramework="monoandroid90" />
</packages>

View file

@ -14,12 +14,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.DesktopGL", "Demos.De
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox", "Sandbox\Sandbox.csproj", "{289ABC96-7A0B-4EB9-A0BE-75C807C09F74}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sandbox", "Sandbox\Sandbox.csproj", "{289ABC96-7A0B-4EB9-A0BE-75C807C09F74}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.Android", "Demos.Android\Demos.Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Data", "MLEM.Data\MLEM.Data.csproj", "{28938AAA-FB91-4E6F-8511-0DB99EC831F7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Data", "MLEM.Data\MLEM.Data.csproj", "{28938AAA-FB91-4E6F-8511-0DB99EC831F7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Templates", "MLEM.Templates\MLEM.Templates.csproj", "{C2A2CFED-C9E8-4675-BD66-EFC3DB210977}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MLEM.Templates", "MLEM.Templates\MLEM.Templates.csproj", "{C2A2CFED-C9E8-4675-BD66-EFC3DB210977}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demos.Android", "Demos.Android\Demos.Android.csproj", "{410C0262-131C-4D0E-910D-D01B4F7143E0}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -54,10 +54,6 @@ Global
{289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Debug|Any CPU.Build.0 = Debug|Any CPU {289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Release|Any CPU.ActiveCfg = Release|Any CPU {289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Release|Any CPU.Build.0 = Release|Any CPU {289ABC96-7A0B-4EB9-A0BE-75C807C09F74}.Release|Any CPU.Build.0 = Release|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
{28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Debug|Any CPU.Build.0 = Debug|Any CPU {28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Release|Any CPU.ActiveCfg = Release|Any CPU {28938AAA-FB91-4E6F-8511-0DB99EC831F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -66,5 +62,9 @@ Global
{C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Debug|Any CPU.Build.0 = Debug|Any CPU {C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Release|Any CPU.ActiveCfg = Release|Any CPU {C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Release|Any CPU.Build.0 = Release|Any CPU {C2A2CFED-C9E8-4675-BD66-EFC3DB210977}.Release|Any CPU.Build.0 = Release|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{410C0262-131C-4D0E-910D-D01B4F7143E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -39,6 +39,13 @@ namespace MLEM.Extensions {
manager.ApplyChanges(); manager.ApplyChanges();
} }
public static void ResetWidthAndHeight(this GraphicsDeviceManager manager, Game game) {
var (_, _, width, height) = game.Window.ClientBounds;
manager.PreferredBackBufferWidth = Math.Max(height, width);
manager.PreferredBackBufferHeight = Math.Min(height, width);
manager.ApplyChanges();
}
public static TargetContext WithRenderTarget(this GraphicsDevice device, RenderTarget2D target) { public static TargetContext WithRenderTarget(this GraphicsDevice device, RenderTarget2D target) {
return new TargetContext(device, target); return new TargetContext(device, target);
} }