2016-09-18 81 views
1

遊戲製作工作室Studio可以使用android的工具創建新的GML功能,作爲程序員,這對我來說非常有趣。我想知道如何實現陀螺儀傳感器。它採用「Android.permission ......」我不太清楚哪些是必要的加入陀螺儀,也有一個Java文件,其中他們得到的數據,溜溜球比賽有一個例子:如何在Game Maker Studio上實現Android陀螺儀?

package ${YYAndroidPackageName}; 
 

 
import android.util.Log; 
 
import java.io.File; 
 
import java.io.FileReader; 
 
import java.io.BufferedReader; 
 
import java.io.FileNotFoundException; 
 
import java.io.IOException; 
 
import java.lang.String; 
 

 
import ${YYAndroidPackageName}.R; 
 
import com.yoyogames.runner.RunnerJNILib; 
 

 

 
public class GenericTest 
 
{ 
 

 
private static final int EVENT_OTHER_SOCIAL = 70; 
 

 
\t \t public void ReturnAsync(double arg0, double arg1) 
 
\t { \t \t \t 
 
\t \t \t int dsMapIndex = RunnerJNILib.jCreateDsMap(null, null, null); 
 
\t \t \t RunnerJNILib.DsMapAddString(dsMapIndex, "type", "finished"); 
 
\t \t \t RunnerJNILib.DsMapAddDouble(dsMapIndex, "argument0", arg0); 
 
\t \t \t RunnerJNILib.DsMapAddDouble(dsMapIndex, "argument1", arg1); 
 
\t \t \t RunnerJNILib.CreateAsynEventWithDSMap(dsMapIndex, EVENT_OTHER_SOCIAL); 
 
\t \t \t 
 
\t \t } 
 

 
    \t public double AddTwoNumbers(double arg0, double arg1) 
 
\t { 
 
     \t double value = arg0 + arg1; 
 
     \t Log.i("yoyo", arg0 + "+" + arg1 + " = " + value); 
 

 
     \t return value; 
 
    \t } 
 

 

 
    \t public String BuildAString(String arg0, String arg1) 
 
\t { 
 
     \t String myString = arg0 + " " + arg1; 
 
     \t Log.i("yoyo", myString); 
 

 
     \t return myString; 
 
    \t } 
 

 

 
    \t public String HowManyObjects(double arg0, double arg1, String arg2) 
 
\t { 
 
     \t double value = arg0 + arg1; 
 
     \t Log.i("yoyo", arg0 + "+" + arg1 + " = " + value); 
 

 
\t \t String myString = String.valueOf(value) + " " + arg2; 
 
\t \t Log.i("yoyo", myString); 
 

 
     \t return myString; 
 
    \t } 
 

 
} // End of class

然後他們在GML中創建函數以便用於遊戲製造商。

我不擅長Android或Java,我想知道是否有人有線索並知道如何做到這一點?謝謝。

Yoyogame的帖子: http://help.yoyogames.com/hc/en-us/articles/216755248-Creating-A-Native-Extension-For-Android-GMS-v1-3-

回答