Skip to content

Commit

Permalink
Merge pull request #423 from rds1983/input_overhaul
Browse files Browse the repository at this point in the history
Input overhaul
  • Loading branch information
rds1983 authored Oct 25, 2023
2 parents 3fea1a4 + cce318e commit b969a88
Show file tree
Hide file tree
Showing 42 changed files with 1,123 additions and 1,613 deletions.
23 changes: 0 additions & 23 deletions samples/Myra.Samples.AllWidgets/AllWidgetsGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
#if ANDROID
using Microsoft.Xna.Framework.GamerServices;
#endif
#else
using System.Threading.Tasks;
Expand Down Expand Up @@ -110,28 +109,6 @@ protected override void LoadContent()
_desktop.OnChar(a.Character);
};
#endif

#if ANDROID
_desktop.WidgetGotKeyboardFocus += (s, a) =>
{
var asTextBox = a.Data as TextBox;
if (asTextBox == null)
{
return;
}
Guide.BeginShowKeyboardInput(PlayerIndex.One,
"Title",
"Description",
asTextBox.Text,
new AsyncCallback(r =>
{
var text = Guide.EndShowKeyboardInput(r);
asTextBox.Text = text;
}),
null);
};
#endif
}
#endif

Expand Down
36 changes: 36 additions & 0 deletions samples/Myra.Samples.AndroidAllWidgets/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}
17 changes: 9 additions & 8 deletions samples/Myra.Samples.AndroidAllWidgets/Activity1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

namespace Myra.Samples.AllWidgets
{
[Activity(Label = "MGAndroidGame"
, MainLauncher = true
, Icon = "@drawable/icon"
, Theme = "@style/Theme.Splash"
, AlwaysRetainTaskState = true
, LaunchMode = Android.Content.PM.LaunchMode.SingleInstance
, ScreenOrientation = ScreenOrientation.FullUser
, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize | ConfigChanges.ScreenLayout)]
[Activity(
Label = "@string/app_name",
MainLauncher = true,
Icon = "@drawable/icon",
AlwaysRetainTaskState = true,
LaunchMode = LaunchMode.SingleInstance,
ScreenOrientation = ScreenOrientation.FullUser,
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize
)]
public class Activity1 : Microsoft.Xna.Framework.AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="Myra.Samples.AllWidgets" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:targetSdkVersion="28" />
<uses-sdk android:targetSdkVersion="31" />
<application android:label="Myra.Samples.AllWidgets"></application>
</manifest>
19 changes: 0 additions & 19 deletions samples/Myra.Samples.AndroidAllWidgets/Assets/AboutAssets.txt

This file was deleted.

15 changes: 15 additions & 0 deletions samples/Myra.Samples.AndroidAllWidgets/Content/Content.mgcb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:Android
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#


#---------------------------------- Content ---------------------------------#

Original file line number Diff line number Diff line change
@@ -1,141 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{36C4B1CF-4E3C-4EFE-8B4D-1F2B398BF55D}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Myra.Samples.AllWidgets</RootNamespace>
<AssemblyName>Myra.Samples.AllWidgets</AssemblyName>
<FileAlignment>512</FileAlignment>
<AndroidApplication>true</AndroidApplication>
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<AndroidSupportedAbis>armeabi-v7a%3bx86</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions>
<MandroidI18n />
<TargetFrameworkVersion>v11.0</TargetFrameworkVersion>
<MonoGamePlatform>Android</MonoGamePlatform>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>TRACE;DEBUG;ANDROID;MONOGAME</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
<AndroidLinkMode>None</AndroidLinkMode>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
<BundleAssemblies>false</BundleAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>TRACE;ANDROID;MONOGAME</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<TargetFramework>net6.0-android</TargetFramework>
<SupportedOSPlatformVersion>23</SupportedOSPlatformVersion>
<OutputType>Exe</OutputType>
<DefineConstants>$(DefineConstants);MONOGAME;ANDROID</DefineConstants>
<ApplicationId>Myra.Samples.AllWidgets</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="AssetManagementBase, Version=0.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\AssetManagementBase.0.5.2\lib\netstandard2.0\AssetManagementBase.dll</HintPath>
</Reference>
<Reference Include="Cyotek.Drawing.BitmapFont, Version=1.0.0.0, Culture=neutral, PublicKeyToken=58daa28b0b2de221, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\Cyotek.Drawing.BitmapFont.2.0.4\lib\netstandard2.1\Cyotek.Drawing.BitmapFont.dll</HintPath>
</Reference>
<Reference Include="FontStashSharp.Base, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\FontStashSharp.Base.1.0.0\lib\netstandard2.0\FontStashSharp.Base.dll</HintPath>
</Reference>
<Reference Include="FontStashSharp.MonoGame, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\FontStashSharp.MonoGame.1.1.1\lib\netstandard2.0\FontStashSharp.MonoGame.dll</HintPath>
</Reference>
<Reference Include="info.lundin.math, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2f7fe9ec5efab85f, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\info.lundin.math.dll.1.2.6\lib\netstandard2.0\info.lundin.math.dll</HintPath>
</Reference>
<Reference Include="Mono.Android" />
<Reference Include="MonoGame.Framework.Net, Version=3.7.1.189, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\MonoGame\v3.0\Assemblies\Android\MonoGame.Framework.Net.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="OpenTK-1.0" />
<Reference Include="StbImageSharp, Version=2.27.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\StbImageSharp.2.27.8\lib\netstandard2.0\StbImageSharp.dll</HintPath>
</Reference>
<Reference Include="StbTrueTypeSharp, Version=1.26.9.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\build\packages\StbTrueTypeSharp.1.26.9\lib\netstandard2.0\StbTrueTypeSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="MonoGame.Framework">
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Android\MonoGame.Framework.dll</HintPath>
</Reference>
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgets.cs" Link="AllWidgets.cs" />
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgets.Generated.cs" Link="AllWidgets.Generated.cs" />
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgetsGame.cs" Link="AllWidgetsGame.cs" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgets.cs">
<Link>AllWidgets.cs</Link>
</Compile>
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgets.Generated.cs">
<Link>AllWidgets.Generated.cs</Link>
</Compile>
<Compile Include="..\Myra.Samples.AllWidgets\AllWidgetsGame.cs">
<Link>AllWidgetsGame.cs</Link>
</Compile>
<Compile Include="Activity1.cs" />
<Compile Include="Resources\Resource.Designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<PackageReference Include="MonoGame.Framework.Android" Version="$(MonoGameVersion)" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="$(MonoGameVersion)" />
</ItemGroup>

<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<ProjectReference Include="..\..\src\Myra\Myra.MonoGame.csproj" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Values\Strings.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Drawable\Icon.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\Layout\" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Drawable\Splash.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\Values\Styles.xml" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Myra\Myra.MonoGame.csproj">
<Project>{10764131-25e8-4b3e-abe7-45ade3fd6cca}</Project>
<Name>Myra.MonoGame</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">

<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
<Message Text="Restoring dotnet tools" Importance="High" />
<Exec Command="dotnet tool restore" />
</Target>
-->
</Project>
41 changes: 0 additions & 41 deletions samples/Myra.Samples.AndroidAllWidgets/Properties/AssemblyInfo.cs

This file was deleted.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading

0 comments on commit b969a88

Please sign in to comment.