xamarin / urho-samples

Samples for the Urho bindings
MIT License
384 stars 491 forks source link

FeatureSample Testing; Quickstart & FormsSample Xamarin Android Demo working #52

Open ghost opened 7 years ago

ghost commented 7 years ago

I had downloaded the whole package of FeatureSample and compiled it with no errors into an APK file.

It was 40 mb and I started to run the app. The first page selection is running fine with all the selection of the 43 samples listed but when I try to test each one of them - there is a black screen that follow on - every single one of the declared activity.

Thanks

ghost commented 7 years ago

I don't have a working solution for this because of how it is coded (eg - obsolete class, UrhoSurfacePlaceholder doesn't work) but I previously had made FormsSample demo working - UrhoSurface & Xamarin+Forms.

You can port the (eg. 01_HelloWorld.cs activity - from Core FeatureSample file) into FormsSample project and change its setting of App.cs line StartUrhoApp() (from Show Charts into Show HelloWorld as their super class is Application) and start a demo from there. Obviously it may resemble the original layout but the words display accordingly.

This is just an hack to see how does it work - maybe you can try other harder examples if it does fit into the criteria rather than waiting for the answer.

https://www.bountysource.com/issues/48864595-urhosurface-createsurface-mygame-activity

ghost commented 7 years ago

I have another one working for 27_Urho2DPhysics. The files can be added to the existing project running on FormsSample.

JoystickLayoutPatches.cs - FeaturesSamples/Core github Sample.cs - FeaturesSamples/Core Urho2DPhysics.cs - FeaturesSamples/Core/27_Urho2DPhysics

Remember to add in Asset/Data files according to the files in github for: Asset/Data/Textures/LogoLarge.png Asset/Data/Textures/UrhoIcon.png Asset/Data/UI/DefaultStyle.xml Asset/Data/UI/ScreenJoystick_Samples.xml Asset/Data/Urho2D/Ball.png Asset/Data/Urho2D/Box.png Asset/Data/Fonts/Anonymous Pro.ttf

They load the graphics into the screen.

What does the line for the App.cs look like:


public class UrhoPage : ContentPage { UrhoSurface urhoSurface; //Charts urhoApp; //HelloWorld hwApp; -- example from last comment. Urho2dPhysics u2dApp; Slider selectedBarSlider;

...

async void StartUrhoApp() { //urhoApp = await urhoSurface.Show<Charts>(new ApplicationOptions(assetsFolder: null) { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });

//hwApp = await urhoSurface.Show<HelloWorld>(new ApplicationOptions(assetsFolder: "Data") { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });

u2dApp = await urhoSurface.Show<Urho2DPhysics>(new ApplicationOptions(assetsFolder: "Data") { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait });

}

Happy Demoing!! :) ( - make sure everything does load such as correct namespaces when copying the files from Github)

ghost commented 7 years ago

More for readers on the topic Xamarin Quickstart demo.

For those who had finished the Quickstart demo from the Xamarin, there is a few clues left hidden in producing the same results as us.

For those who had the emulators not working for them (too slow machines), they can try producing a signed apk file to their Android phone following this part of the story: https://developer.xamarin.com/guides/android/deployment,_testing,_and_metrics/publishing_an_application/part2-_signing_the_android_application_package/

Important to know how to if you wanted the build the apk file!!

Go to Project's Build tab -> Rebuild solution (*no errors) then Build -> Archive .

This builds the dll files in the folder then View Archive -> Select your Archive file -> Distribute

Make sure it has been signed properly (Ad-hoc - with alias: (eg a name), password: (eg. abcd - remember this as you would do it for every signed apk) ) or otherwise it may suffer "parsing the package" error when the phone tries to do during the installation process. (you are actually port this file to your phone apk storage with your phone set to developer's mode and settings. )

What other things should be aware of: API settings of your phone to the correct version from the manifest file (right-click to properties of your project "Phoneword" (From Solution Explorer). Go to Application tab and select the correct settings.)

NB: There is the application ICON settings that needs to be aware of. https://forums.xamarin.com/discussion/104884/issue-about-application-icon-present-in-hello-android-quickstart-document

** I have spent six hours to get this far and it has been my first Xamarin app ever :)

ghost commented 7 years ago

Similarly making this work would make FormsSample demo work as well by the same lines.

Happy demoing~~~