2010-04-27 65 views
1

沒有人knws我怎麼稱呼它? 公共結構SmiAccelerometerVector { public float x; public float y; public float z; }三星api如何調用

我想獲得x,y,z值並將其粘貼到標籤中。

+1

? – mmr 2010-04-27 01:46:00

+0

三星Omnia加速度計,觸覺 – cheesebunz 2010-04-27 01:50:15

+0

它仍然是C++。 http://stackoverflow.com/questions/2696221/in-using-samsung-acclerometer – 2010-04-27 05:03:42

回答

0

感謝ctacke我得到它了。這:)

private void GetVectorHandler(Accelerometer.Vector accel) 
    { 
     if (Accelerometer.GetVector(ref accel) == SmiResultCode.Success) 
     { 
      yy = accel.y.ToString(); 
      xx = accel.x.ToString(); 
      zz = accel.z.ToString(); 
     } 
    } 

之後,我們需要什麼樣的設備做到這一點,裏面的Form_Load或wadeva

  GetVectorHandler(gVector); 
      lblX.Text = "x: " + xx; 
      lblY.Text = "y: " + yy; 
      lblZ.Text = "z: " + zz; 
0

Samsung's documentation是包含這些功能的確切DLL不清楚,但我相信它應該是這樣的:

public struct Vector 
{ 
    Single X; 
    Single Y; 
    Single Z; 
} 

[DllImport("SmiSDK.dll", SetLastError=true)] 
public static extern int SmiAccelerometerGetVector(out Vector vector);