09 - SystemInfo.lua

Last-modified: 2009-03-11 (水) 12:42:52

(scripts/09 - SystemInfo.lua)

01:SCREEN_BOTTOM   = 0
02:BGBotText = Screen.LoadTextBG()
03:Screen.Initialize( SCREEN_BOTTOM, BGBotText )
04:
05:BGBotText:Clear()
06:BGBotText:PrintXY( 0, 0, "Press START to exit" );
07:BGBotText:PrintXY( 0, 2, "Version: " .. DSLua.Version() )
08:BGBotText:PrintXY( 0, 3, DSLua.UserName() )
09:BGBotText:PrintXY( 0, 4, "BDay: " .. DSLua.BirthMonth() .. "/" .. DSLua.BirthDay() )
10:BGBotText:PrintXY( 0, 5, "Msg: " .. DSLua.UserMessage() )
11:if ( DSLua.Language() == 0 ) then
12:  BGBotText:PrintXY( 0, 6, "Lang: Japanese" )
13:elseif  ( DSLua.Language() == 1 ) then
14:  BGBotText:PrintXY( 0, 6, "Lang: English" )
15:elseif  ( DSLua.Language() == 2 ) then
16:  BGBotText:PrintXY( 0, 6, "Lang: French" )
17:else
18:  BGBotText:PrintXY( 0, 6, "Lang: Unknown(" .. DSLua.Language() .. ")" )
19:end
20:BGBotText:PrintXY( 0, 7, "Color: " .. DSLua.Color() )
21:BGBotText:PrintXY( 0, 8, "Alarm: " .. DSLua.AlarmHour() .. ":" .. DSLua.AlarmMin() )
22:
23:while true do
24:  BGBotText:PrintXY( 0, 10, "Time: " .. ( 2000 + DSLua.Year() ) .. "/" .. DSLua.Month() .. "/" .. DSLua.Day() .. " " .. DSLua.Hour() .. ":" .. DSLua.Min() .. ":" .. DSLua.Sec() )
25:  BGBotText:PrintXY( 0, 11, "VBlankCount: " .. DSLua.VBlankCount() )
26:  if Pads.Start() then
27:    break
28:  end
29:end

プログラムの解説

01:SCREEN_BOTTOM   = 0
02:BGBotText = Screen.LoadTextBG()
03:Screen.Initialize( SCREEN_BOTTOM, BGBotText )

いつもの画面初期化

 
05:BGBotText:Clear()

念のために画面初期化

 
06:BGBotText:PrintXY( 0, 0, "Press START to exit" );

STARTボタンで終了

 
07:BGBotText:PrintXY( 0, 2, "Version: " .. DSLua.Version() )

DSLuaのバージョンを表示

 
08:BGBotText:PrintXY( 0, 3, DSLua.UserName() )

ユーザ名を表示

 
09:BGBotText:PrintXY( 0, 4, "BDay: " .. DSLua.BirthMonth() .. "/" .. DSLua.BirthDay() )

ユーザの誕生日を表示

 
10:BGBotText:PrintXY( 0, 5, "Msg: " .. DSLua.UserMessage() )

ユーザメッセージを表示

 
11:if ( DSLua.Language() == 0 ) then
12:  BGBotText:PrintXY( 0, 6, "Lang: Japanese" )
13:elseif  ( DSLua.Language() == 1 ) then
14:  BGBotText:PrintXY( 0, 6, "Lang: English" )
15:elseif  ( DSLua.Language() == 2 ) then
16:  BGBotText:PrintXY( 0, 6, "Lang: French" )
17:else
18:  BGBotText:PrintXY( 0, 6, "Lang: Unknown(" .. DSLua.Language() .. ")" )
19:end

DSに設定されている言語を取得して、日本語・英語・仏語ならそのまま出力
それ以外はUnknownとして出力する

 
20:BGBotText:PrintXY( 0, 7, "Color: " .. DSLua.Color() )

DSのカラーを出力

 
21:BGBotText:PrintXY( 0, 8, "Alarm: " .. DSLua.AlarmHour() .. ":" .. DSLua.AlarmMin() )

DSに設定されているアラームの時刻を出力

 
23:while true do

29行目まで無限ループ

 
24:  BGBotText:PrintXY( 0, 10, "Time: " .. ( 2000 + DSLua.Year() ) .. "/" .. DSLua.Month() .. "/" .. DSLua.Day() .. " " .. DSLua.Hour() .. ":" .. DSLua.Min() .. ":" .. DSLua.Sec() )

現在の年月日と時間を取得して出力

 
25:  BGBotText:PrintXY( 0, 11, "VBlankCount: " .. DSLua.VBlankCount() )

DSが起動してから何回画面を更新したかを出力

 
26:  if Pads.Start() then
27:    break
28:  end

STARTボタンが押されたら終了

 
29:end

23行目のループ終端

 

コメント