COM コンポーネント( セットアップ用スクリプト同梱 )
【2006/09/15 バージョン】
<JOB>
<OBJECT id="Dx" progid="DxlibWrap.Game" />
<OBJECT id="WshShell" progid="WScript.Shell" />
<REFERENCE object="DxlibWrap.Game" />
<SCRIPT language="VBScript" src="Game.vbs"></SCRIPT>
<SCRIPT language=VBScript>
strCurDir = WScript.ScriptFullName
strCurDir = Replace( strCurDir, WScript.ScriptName, "" )
Dx.WindowMode
If Dx.Init = -1 Then
Wscript.Quit
End If
Set MyGame = new Game
Call MyGame(320,340,strCurDir & "\play.bmp")
' **********************************************************
' メインループ( クラス内より呼ばれる )
' **********************************************************
Function MainLoop()
If Dx.CheckHitKey(KEY_INPUT_LEFT) = 1 Then
MyGame.x = MyGame.x - 3
End If
If Dx.CheckHitKey(KEY_INPUT_RIGHT) = 1 Then
MyGame.x = MyGame.x + 3
End If
' 描画
MyGame.DrawPlay
End Function
</SCRIPT>
</JOB>
外部ファイル(クラス)
Class Game
Public x,y,Handle
Public Default Function InitSetting(px,py,strPath)
Handle = Dx.LoadGraph( strPath )
x = px : y = py
Dx.SetDrawScreen (DX_SCREEN_BACK)
Do
' クリア
Dx.ClearDrawScreen
on error resume next
Call MainLoop()
on error goto 0
' 裏画面の内容を表画面に反映させる
Dx.ScreenFlip
' Windows システムからくる情報を処理する
If Dx.ProcessMessage = -1 Then
Exit Do
End If
If Dx.CheckHitKey(KEY_INPUT_ESCAPE) = 1 Then
Exit Do
End If
Loop
Dx.End
End function
Function DrawPlay()
Call Dx.DrawGraph( x, y, Handle, 1 )
End Function
End Class
現時点実装メソッド
[id(1), helpstring("メソッド Init")] HRESULT Init([out,retval] int *pVal);
[id(2), helpstring("メソッド DxLib_End")] HRESULT End([out,retval] int *pVal);
[id(3), helpstring("メソッド ProcessMessage")] HRESULT ProcessMessage([out,retval] int *pVal);
[id(4), helpstring("メソッド WindowMode")] HRESULT WindowMode([out,retval] int *pVal);
[id(5), helpstring("メソッド DrawPixel")] HRESULT DrawPixel([in] int x ,[in] int y , [in] int Color,[out,retval] int *pVal);
[id(6), helpstring("メソッド WaitKey")] HRESULT WaitKey([out,retval] int *pVal);
[id(7), helpstring("メソッド LoadGraphScreen")] HRESULT LoadGraphScreen([in] int x , [in] int y ,[in] BSTR GraphName,[out,retval] int *pVal);
[id(8), helpstring("メソッド LoadGraph")] HRESULT LoadGraph([in] BSTR FileName,[out,retval] int *pVal);
[id(9), helpstring("メソッド GetScreenState")] HRESULT GetScreenState([in] int nType,[out,retval] int *pVal);
[id(10), helpstring("メソッド SetDrawScreen")] HRESULT SetDrawScreen([in] int DrawScreen,[out,retval] int *pVal);
[id(11), helpstring("メソッド ClearDrawScreen")] HRESULT ClearDrawScreen([out,retval] int *pVal);
[id(12), helpstring("メソッド ScreenFlip")] HRESULT ScreenFlip([out,retval] int *pVal);
[id(13), helpstring("メソッド CheckHitKey")] HRESULT CheckHitKey([in] int KeyCode,[out,retval] int *pVal);
[id(14), helpstring("メソッド GetJoypadInputState")] HRESULT GetJoypadInputState([in] int InputType,[out,retval] int *pVal);
[id(15), helpstring("メソッド WaitTimer")] HRESULT WaitTimer([in] int WaitTime,[out,retval] int *pVal);
[id(16), helpstring("メソッド DrawGraph")] HRESULT DrawGraph([in] int x,[in] int y,[in] int GrHandle,[in] int TransFlag ,[out,retval] int *pVal);
実装定数
PAD_INPUT_DOWN = (0x00000001),
PAD_INPUT_LEFT =(0x00000002),
PAD_INPUT_RIGHT = (0x00000004),
PAD_INPUT_UP = (0x00000008),
PAD_INPUT_A = (0x00000010),
PAD_INPUT_B = (0x00000020),
PAD_INPUT_C = (0x00000040),
PAD_INPUT_X = (0x00000080),
PAD_INPUT_Y = (0x00000100),
PAD_INPUT_Z = (0x00000200),
PAD_INPUT_L = (0x00000400),
PAD_INPUT_R = (0x00000800),
PAD_INPUT_START = (0x00001000),
PAD_INPUT_M = (0x00002000),
PAD_INPUT_D = (0x00004000),
PAD_INPUT_F = (0x00008000),
PAD_INPUT_G = (0x00010000),
PAD_INPUT_H = (0x00020000),
PAD_INPUT_I = (0x00040000),
PAD_INPUT_J = (0x00080000),
PAD_INPUT_K = (0x00100000),
PAD_INPUT_LL = (0x00200000),
PAD_INPUT_N = (0x00400000),
PAD_INPUT_O = (0x00800000),
PAD_INPUT_P = (0x01000000),
PAD_INPUT_RR = (0x02000000),
PAD_INPUT_S = (0x04000000),
PAD_INPUT_T = (0x08000000),
PAD_INPUT_U = (0x10000000),
PAD_INPUT_V = (0x20000000),
PAD_INPUT_W = (0x40000000),
PAD_INPUT_XX = (0x80000000)
GETSCREEN_X = 0,
GETSCREEN_Y = 1,
GETSCREEN_COLOR = 2
DX_SCREEN_FRONT = (0xfffffffc),
DX_SCREEN_BACK = (0xfffffffe)
D_DIK_ESCAPE = (0x01),
D_DIK_1 = (0x02),
D_DIK_2 = (0x03),
D_DIK_3 = (0x04),
D_DIK_4 = (0x05),
D_DIK_5 = (0x06),
D_DIK_6 = (0x07),
D_DIK_7 = (0x08),
D_DIK_8 = (0x09),
D_DIK_9 = (0x0A),
D_DIK_0 = (0x0B),
D_DIK_MINUS = (0x0C),
D_DIK_EQUALS = (0x0D),
D_DIK_BACK = (0x0E),
D_DIK_TAB = (0x0F),
D_DIK_LEFT = (0xCB),
D_DIK_RIGHT = (0xCD)
KEY_INPUT_ESCAPE = (D_DIK_ESCAPE),
KEY_INPUT_0 = (D_DIK_0),
KEY_INPUT_1 = (D_DIK_1),
KEY_INPUT_2 = (D_DIK_2),
KEY_INPUT_3 = (D_DIK_3),
KEY_INPUT_4 = (D_DIK_4),
KEY_INPUT_5 = (D_DIK_5),
KEY_INPUT_6 = (D_DIK_6),
KEY_INPUT_7 = (D_DIK_7),
KEY_INPUT_8 = (D_DIK_8),
KEY_INPUT_9 = (D_DIK_9),
KEY_INPUT_MINUS = (D_DIK_MINUS),
KEY_INPUT_EQUALS = (D_DIK_EQUALS),
KEY_INPUT_BACK = (D_DIK_BACK),
KEY_INPUT_TAB = (D_DIK_TAB),
KEY_INPUT_LEFT = (D_DIK_LEFT),
KEY_INPUT_RIGHT = (D_DIK_RIGHT)