'Require explicit variable declaration
Option Explicit'API STUFF:
'---------------------------------------------
'TYPES:
Public Type POINTAPI
X As Long
Y As Long
End TypePublic Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type'DECLARES:
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function MyGetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long'CONSTANTS:
Public Const SRCAND = &H8800C6
Public Const SRCINVERT = &H660046
Public Const SRCCOPY = &HCC0020
Public Const SND_MEMORY = &H4
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_LOOP = &H8
Public Const SND_PURGE = &H40
'---------------------------------------------'Constants:
'-----------------------------------------
Global Const LR_LOADFROMFILE = 10
Global Const LR_CREATEDIBSECTION = 2000
Global Const APPNAME = "LexxSol"
'-----------------------------------------'Types:
'-----------------------------------------
Type tCardElement
Pos As POINTAPI 'Position inside the card
Flag As Byte '0 = not in use; 1 = normal; 2 = upside-down
End TypeType tCard
Elmt10(1 To 4) As tCardElement 'The imgs on the card showing the sort. 10x10 pixels.
Elmt15(1 To 10) As tCardElement 'The imgs on the card showing the sort & value. 15x15 pixels.
Value As Byte 'The card's value
Sort As Byte 'The card type
Flag As Byte '0 = facedown; 1 = faceup
End TypeType tPlaceHolder
Pos As POINTAPI 'Placeholder position in gamefield
Cards() As Byte 'The cards in the placeholder. Not all may be in use.
nCards As Byte 'The number of cards in the placeholder.
End TypeType tResource
fPath As String 'The path of the img file
hBMP As Long 'The handle to the memory BMP
hOldBMP As Long 'The handle to the old BMP
hdc As Long 'The Device Context handle
nW As Integer 'The width of the BMP
nH As Integer 'The height of the BMP
End TypeType tUndo
nCards As Byte
nSrc As Byte
nDest As Byte
Available As Boolean
End TypeType tGameField
Card() As tCard 'The cards.
CardNone As tCard 'The no-card card
CardBack As tCard 'The upside-down card
PlaceHolder(1 To 7) As tPlaceHolder 'The placeholders in the middle
GoalCell(1 To 4) As tPlaceHolder 'The placeholders at the top
Deck(1 To 2) As tPlaceHolder 'The deck
Img15 As tResource '15x15 img resource
ImgCardBack As tResource 'Card back images
ImgCardFront As tResource 'Card front images
ImgGoal As tResource 'Goal Cell Images
ImgSign As tResource 'Number/letter resource (10x10 pixels)
ImgCard As tResource 'Images on the img cards
BB As tResource 'Back Buffer
BG As tResource 'Background Image(in memory)
TmpBG As tResource 'Temporary Background buffer(for tiling)
Img790 As tResource 'Picture of the 790 robot head
Img790ani As tResource 'Animation of 790 robot head
BufTmp As tResource 'A temporary buffer
nW As Long 'Width of gamefield
nH As Long 'Height of gamefield
Pos790 As POINTAPI 'Position of the 790 robot head
DefaultSnd As String 'Buffer for default sound effect
GoalSnd As String 'Buffer for "move to goal" sound effect
WinSnd As String 'Buffer for winning sound (drumroll)
Win2Snd As String 'Buffer for winning applause
End TypeType tInfo
ACPos As POINTAPI
ClickPos As POINTAPI
DblClickPos As POINTAPI
Undo As tUndo
AppPath As String
ActiveCard(1 To 13) As Byte
nActive As Byte
srcPH As Byte
srcType As Byte
StartTime As Long
ThisTime As Long
nCardFront As Integer
nCardfronts As Integer
nCardBack As Integer
nCardBacks As Integer
nBG As Integer
nBGs As Integer
nDefSnd As Integer
nGoalSnd As Integer
nSnds As Integer
MouseButton As Byte
nDrawCards As Byte
nRemoved As Byte
Moving As Boolean
Interrupt As Boolean
CheckingWinner As Boolean
Debugging As Boolean
Show790 As Boolean
PlaySounds As Boolean
UserName As String
Language As String
End Type
Option Explicit'API STUFF:
'---------------------------------------------
'TYPES:
Public Type POINTAPI
X As Long
Y As Long
End TypePublic Type BITMAP
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type'DECLARES:
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function GetTickCount Lib "kernel32" () As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function MyGetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long'CONSTANTS:
Public Const SRCAND = &H8800C6
Public Const SRCINVERT = &H660046
Public Const SRCCOPY = &HCC0020
Public Const SND_MEMORY = &H4
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_LOOP = &H8
Public Const SND_PURGE = &H40
'---------------------------------------------'Constants:
'-----------------------------------------
Global Const LR_LOADFROMFILE = 10
Global Const LR_CREATEDIBSECTION = 2000
Global Const APPNAME = "LexxSol"
'-----------------------------------------'Types:
'-----------------------------------------
Type tCardElement
Pos As POINTAPI 'Position inside the card
Flag As Byte '0 = not in use; 1 = normal; 2 = upside-down
End TypeType tCard
Elmt10(1 To 4) As tCardElement 'The imgs on the card showing the sort. 10x10 pixels.
Elmt15(1 To 10) As tCardElement 'The imgs on the card showing the sort & value. 15x15 pixels.
Value As Byte 'The card's value
Sort As Byte 'The card type
Flag As Byte '0 = facedown; 1 = faceup
End TypeType tPlaceHolder
Pos As POINTAPI 'Placeholder position in gamefield
Cards() As Byte 'The cards in the placeholder. Not all may be in use.
nCards As Byte 'The number of cards in the placeholder.
End TypeType tResource
fPath As String 'The path of the img file
hBMP As Long 'The handle to the memory BMP
hOldBMP As Long 'The handle to the old BMP
hdc As Long 'The Device Context handle
nW As Integer 'The width of the BMP
nH As Integer 'The height of the BMP
End TypeType tUndo
nCards As Byte
nSrc As Byte
nDest As Byte
Available As Boolean
End TypeType tGameField
Card() As tCard 'The cards.
CardNone As tCard 'The no-card card
CardBack As tCard 'The upside-down card
PlaceHolder(1 To 7) As tPlaceHolder 'The placeholders in the middle
GoalCell(1 To 4) As tPlaceHolder 'The placeholders at the top
Deck(1 To 2) As tPlaceHolder 'The deck
Img15 As tResource '15x15 img resource
ImgCardBack As tResource 'Card back images
ImgCardFront As tResource 'Card front images
ImgGoal As tResource 'Goal Cell Images
ImgSign As tResource 'Number/letter resource (10x10 pixels)
ImgCard As tResource 'Images on the img cards
BB As tResource 'Back Buffer
BG As tResource 'Background Image(in memory)
TmpBG As tResource 'Temporary Background buffer(for tiling)
Img790 As tResource 'Picture of the 790 robot head
Img790ani As tResource 'Animation of 790 robot head
BufTmp As tResource 'A temporary buffer
nW As Long 'Width of gamefield
nH As Long 'Height of gamefield
Pos790 As POINTAPI 'Position of the 790 robot head
DefaultSnd As String 'Buffer for default sound effect
GoalSnd As String 'Buffer for "move to goal" sound effect
WinSnd As String 'Buffer for winning sound (drumroll)
Win2Snd As String 'Buffer for winning applause
End TypeType tInfo
ACPos As POINTAPI
ClickPos As POINTAPI
DblClickPos As POINTAPI
Undo As tUndo
AppPath As String
ActiveCard(1 To 13) As Byte
nActive As Byte
srcPH As Byte
srcType As Byte
StartTime As Long
ThisTime As Long
nCardFront As Integer
nCardfronts As Integer
nCardBack As Integer
nCardBacks As Integer
nBG As Integer
nBGs As Integer
nDefSnd As Integer
nGoalSnd As Integer
nSnds As Integer
MouseButton As Byte
nDrawCards As Byte
nRemoved As Byte
Moving As Boolean
Interrupt As Boolean
CheckingWinner As Boolean
Debugging As Boolean
Show790 As Boolean
PlaySounds As Boolean
UserName As String
Language As String
End Type
然后接下来tCard这个结构里面就有了数个tCardElement的元素。。
你仔细分析这个结构,你把这个结构分析明白了,也就明白了这个纸牌游戏的核心了/
教你如何制作微软的纸牌和空当接龙