-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e5d5a5b
commit d7a8624
Showing
50 changed files
with
33,504 additions
and
31,928 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.yourcompany.yourapp"> | ||
<application android:icon="@mipmap/icon" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0-android</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="libc++_shared.so" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.0.1" /> | ||
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.13.1.3" /> | ||
<PackageReference Include="Hexa.NET.SDL2" Version="1.2.4" /> | ||
<PackageReference Include="Hexa.NET.Utilities" Version="2.1.5" /> | ||
</ItemGroup> | ||
|
||
|
||
|
||
|
||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
namespace ExampleAndroid | ||
{ | ||
using Android.Content.PM; | ||
using Android.Runtime; | ||
using Hexa.NET.SDL2; | ||
using Hexa.NET.Utilities; | ||
using System.Runtime.InteropServices; | ||
|
||
[Activity(Label = "ExampleAndroid", MainLauncher = true, Icon = "@mipmap/icon", Theme = "@style/AppTheme")] | ||
public unsafe class MainActivity : Activity | ||
{ | ||
private Thread thread; | ||
|
||
protected override void OnCreate(Bundle? savedInstanceState) | ||
{ | ||
base.OnCreate(savedInstanceState); | ||
RunOnUiThread(() => | ||
{ | ||
SDL.SetHint(SDL.SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); | ||
SDL.SetHint(SDL.SDL_HINT_AUTO_UPDATE_JOYSTICKS, "1"); | ||
SDL.SetHint(SDL.SDL_HINT_JOYSTICK_HIDAPI_PS4, "1");//HintJoystickHidapiPS4 | ||
SDL.SetHint(SDL.SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1"); //HintJoystickHidapiPS4Rumble | ||
SDL.SetHint(SDL.SDL_HINT_JOYSTICK_RAWINPUT, "0"); | ||
SDL.SetHint(SDL.SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, "1"); //HintWindowsDisableThreadNaming | ||
SDL.SetHint(SDL.SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, "1"); | ||
SDL.SetHint(SDL.SDL_HINT_MOUSE_AUTO_CAPTURE, "0"); | ||
SDL.SetHint(SDL.SDL_HINT_IME_SHOW_UI, "1"); | ||
SDL.Init(SDL.SDL_INIT_EVENTS + SDL.SDL_INIT_GAMECONTROLLER + SDL.SDL_INIT_HAPTIC + SDL.SDL_INIT_JOYSTICK + SDL.SDL_INIT_SENSOR); | ||
thread = new Thread(NewMethod); | ||
thread.Start(); | ||
}); | ||
} | ||
|
||
private static void NewMethod() | ||
{ | ||
var window = SDL.CreateWindow("Test Window", (int)SDL.SDL_WINDOWPOS_UNDEFINED_MASK, (int)SDL.SDL_WINDOWPOS_UNDEFINED_MASK, 1280, 720, (uint)SDLWindowFlags.Resizable); | ||
var windowId = SDL.GetWindowID(window); | ||
|
||
SDLRenderer* renderer = SDL.CreateRenderer(window, -1, (uint)SDLRendererFlags.Accelerated); | ||
|
||
UnsafeList<SDLVertex> verts = | ||
[ | ||
new(new SDLFPoint( 400, 150 ), new SDLColor( 255, 0, 0, 255 ), new SDLFPoint( 0 ) ), | ||
new(new SDLFPoint( 200, 450 ), new SDLColor( 0, 0, 255, 255 ), new SDLFPoint( 0 ) ), | ||
new(new SDLFPoint( 600, 450 ), new SDLColor( 0, 255, 0, 255 ), new SDLFPoint( 0 ) ), | ||
]; | ||
|
||
SDLEvent sdlEvent = default; | ||
bool exiting = false; | ||
while (!exiting) | ||
{ | ||
SDL.PumpEvents(); | ||
|
||
while ((SDLBool)SDL.PollEvent(ref sdlEvent) == SDLBool.True) | ||
{ | ||
switch ((SDLEventType)sdlEvent.Type) | ||
{ | ||
case SDLEventType.Quit: | ||
exiting = true; | ||
break; | ||
|
||
case SDLEventType.AppTerminating: | ||
exiting = true; | ||
break; | ||
|
||
case SDLEventType.Windowevent: | ||
var windowEvent = sdlEvent.Window; | ||
if (windowEvent.WindowID == windowId) | ||
{ | ||
if ((SDLWindowEventID)windowEvent.Event == SDLWindowEventID.Close) | ||
{ | ||
exiting = true; | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
|
||
SDL.RenderClear(renderer); | ||
|
||
SDL.SetRenderTarget(renderer, null); | ||
SDL.RenderGeometry(renderer, null, verts.Data, verts.Size, null, 0); | ||
|
||
SDL.RenderPresent(renderer); | ||
} | ||
} | ||
|
||
protected override void OnDestroy() | ||
{ | ||
base.OnDestroy(); | ||
SDL.Quit(); | ||
thread.Join(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar"> | ||
<!-- Customize your theme here --> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.