Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://learn.microsoft.com/en-us/dotnet/core/tutorials/cli-templates-create-template-package?pivots=dotnet-8-0
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/Install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new install .\
4 changes: 4 additions & 0 deletions Templates/dotnetTemplates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Provide an overview of what your template package does and how to get started.
Consider previewing the README before uploading (https://learn.microsoft.com/en-us/nuget/nuget-org/package-readme-on-nuget-org#preview-your-readme). -->


1 change: 1 addition & 0 deletions Templates/dotnetTemplates/Uninstall.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new uninstall .\
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/UpdateVSCache.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" /updateconfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<TargetFramework>net8.0-android</TargetFramework>
<ProjectGuid>$guid1$</ProjectGuid>
<OutputType>Exe</OutputType>
<IsTrimmable>True</IsTrimmable>
<TrimMode>partial</TrimMode>
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>$(DefineConstants);ANDROID</DefineConstants>
<KniPlatform>Android</KniPlatform>
<ApplicationId>com.companyname.$safeprojectname$</ApplicationId>
<ApplicationVersion>1</ApplicationVersion>
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nkast.Xna.Framework" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Content" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Graphics" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Audio" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Media" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Input" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Game" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Devices" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Storage" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.XR" Version="4.2.9001" />
<PackageReference Include="nkast.Kni.Platform.Android.GL" Version="4.2.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Builder" Version="4.2.9001" />
</ItemGroup>
<ItemGroup>
<Compile Include="$projectname$Activity.cs" />
<Compile Include="$projectname$Game.cs" />
</ItemGroup>
<ItemGroup>
<None Include="AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Resources\AboutResources.txt" />
<AndroidResource Include="Resources\Drawable\Icon.png" />
<AndroidResource Include="Resources\Drawable\Splash.png" />
<AndroidResource Include="Resources\Values\Strings.xml" />
<AndroidResource Include="Resources\Values\Styles.xml" />
<Folder Include="Resources\Layout\" />
</ItemGroup>

<ItemGroup>
<KniContentReference Include="Content\$projectname$Content.mgcb" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36811.4 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "$projectname$", "$projectname$.csproj", "{$guid1$}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{$guid1$}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{$guid1$}.Debug|Any CPU.Build.0 = Debug|Any CPU
{$guid1$}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{$guid1$}.Release|Any CPU.ActiveCfg = Release|Any CPU
{$guid1$}.Release|Any CPU.Build.0 = Release|Any CPU
{$guid1$}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {$slnguid$}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Views;

namespace $safeprojectname$
{
[Activity(Label = "$projectname$"
, MainLauncher = true
, Icon = "@drawable/icon"
, Theme = "@style/Theme.Splash"
, AlwaysRetainTaskState = true
, LaunchMode = LaunchMode.SingleInstance
, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize | ConfigChanges.ScreenLayout | ConfigChanges.UiMode | ConfigChanges.SmallestScreenSize
, ScreenOrientation = ScreenOrientation.FullSensor
)]
public class $safeprojectname$Activity : Microsoft.Xna.Framework.AndroidGameActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var game = new $safeprojectname$Game();
SetContentView((View)game.Services.GetService(typeof(View)));
game.Run();
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;

namespace $safeprojectname$
{
/// <summary>
/// This is the main type for your game.
/// </summary>
public class $safeprojectname$Game : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;

public $safeprojectname$Game()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";

graphics.IsFullScreen = true;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
}

/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here

base.Initialize();

}

/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);

// TODO: Use this.Content to load your game content here
}

/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// game-specific content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}

/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
MouseState mouseState = Mouse.GetState();
KeyboardState keyboardState = Keyboard.GetState();
GamePadState gamePadState = GamePad.GetState(PlayerIndex.One);

if (keyboardState.IsKeyDown(Keys.Escape) ||
keyboardState.IsKeyDown(Keys.Back) ||
gamePadState.Buttons.Back == ButtonState.Pressed)
{
try { Exit(); }
catch (PlatformNotSupportedException) { /* ignore */ }
}

// TODO: Add your update logic here

base.Update(gameTime);
}

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

base.Draw(gameTime);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": " https://json.schemastore.org/ide.host",
"icon": "TemplateIcon.png",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "KNI Engine",
"classifications": [ "KNI", "Games", "Android", "mobile" ],
"identity": "nkast.Kni.Android.GL.Project.CSharp",
"name": "KNI Android Game Project",
"shortName": "kni-android-gl",
"description": "A KNI game project for Android.",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "$projectname$",
"primaryOutputs": [
{
"path": "$projectname$.csproj"
}
],
"symbols": {
"slnguid": { "type": "generated", "generator": "guid", "replaces": "$slnguid$" },
"guid1": { "type": "generated", "generator": "guid", "replaces": "$guid1$" },
"filesafeprojectname": {
"type": "derived",
"valueSource": "name",
"replaces": "$safeprojectname$",
"valueTransform": "safe_name"
}
},
"preferNameDirectory": true,
"icon": "TemplateIcon.png"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="$safeprojectname$.$safeprojectname$" android:versionCode="1" android:versionName="1.0">
<application android:label="$projectname$"></application>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
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
@@ -0,0 +1,4 @@
<Project>

</Project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.

For example, a sample Android app that contains a user interface layout (Main.xml),
an internationalization string table (Strings.xml) and some icons (drawable/Icon.png)
would keep its resources in the "Resources" directory of the application:

Resources/
Drawable/
Icon.png

Layout/
Main.axml

Values/
Strings.xml

In order to get the build system to recognize Android resources, the build action should be set
to "AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called
"Resource" that contains the tokens for each one of the resources included. For example,
for the above Resources layout, this is what the Resource class would expose:

public class Resource {
public class Drawable {
public const int Icon = 0x123;
}

public class Layout {
public const int Main = 0x456;
}

public class String {
public const int FirstString = 0xabc;
public const int SecondString = 0xbcd;
}
}

You would then use Resource.Drawable.Icon to reference the Drawable/Icon.png file, or
Resource.Layout.Main to reference the Layout/Main.axml file, or Resource.String.FirstString
to reference the first string in the dictionary file Values/Strings.xml.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading