question

MNik avatar image
0 Votes"
MNik asked JarvanZhang-MSFT commented

How to implement Surface.setFrameRate on Fw30 ?

Hello everyone,
using a lot of c# i'm not used to translating Android snippets. In this case i'd like to force my game to run at 60 hz but the Surface.setFrameRate is an instance method, how to i use it from my activity.onCreate method?

dotnet-androiddotnet-xamarinessentials
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, MNik. Do you mean how to get the surface instance? Xamarin.Android is only a layer of wrapper for Android native libraries, no extra operations. You could refer to the native Android method of the Surface api. Try using the Surface (SurfaceControl from) constructor to initialize the surface.

To get the csharp grammar of the class, you could click 'F12' on the class to check the source code. Or search with the keywords as 'Xamarin.Android Surface' to check the official documentation.

Surface surface = new Surface(new SurfaceControl.Builder().Build());
surface.SetFrameRate(float_value, int_value);

Here are the related links, please check:
https://developer.android.com/reference/android/view/Surface#public-constructors_1
https://developer.android.com/reference/android/view/SurfaceControl#summary
https://developer.android.com/reference/android/view/SurfaceControl.Builder#public-methods_1

0 Votes 0 ·

0 Answers