//----------------------------------------------------------------------------------------------
// compass test
//----------------------------------------------------------------------------------------------
print "version Motion=";versionXBiOSMotion$()
font("Cochin",6):// ファンクションキーのフォントを設定
setFunctionKey(0,"end" ,'!')
setFunctionKey(1,"pause" ,'p')
setFunctionKey(2,"start" ,'s')
setFunctionKey(3,"clear" ,'c')
displayFunctionKey(YES,0,3)
kBackgroundAlpha(0.9)
font("IPAGothic")
if compassStart(10) then {
print localizedString("方位取得は使えません","Can't use compass.")
end
}
float degree,magnetic
int ky,cnt,i
while YES
if not kbhit() then {
i=0
cnt=compassCount()
if cnt>0 then locate(0,1):print "cnt=";cnt
while cnt>0
degree=compassGetData(magnetic)
locate(0,2+i)
if isLocalizeJapan() then {
print using "極北からの角度=###.####,磁北からの角度=###.####";degree,magnetic
} else {
print using "true=###.####,magnetic=###.####";degree,magnetic
}
cnt=cnt-1
i=i+1
if kbhit() then break
endwhile
} else {
ky=inkey()
switch ky
case 'p'
compassPause(YES)
print "Pause"
break
case 's'
compassPause(NO)
print "Start"
break
case 'c'
cls()
compassClear()
break
default:
// 念のため
beep()
break
endswitch
if ky='!' then break
}
endwhile
compassEnd()
end
//----------------------------------------------------------------------------------------------
func str localizedString(js;str,es;str)
if isLocalizeJapan() then return(js)
return (es)
endfunc
//----------------------------------------------------------------------------------------------
Zipファイル :XBtests.zip
0 件のコメント:
コメントを投稿