1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
| Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, _
ByVal X As Long, ByVal Y As Long) As Long ' fonction pour tester la couleur sur laquelle s'arrete chaque roue ( permet d'en déduire les gains)
Dim testokdroite As Boolean 'permet d'arréter les roues dans un bon alignement
Dim testokcentre As Boolean
Dim testokgauche As Boolean
Public Sub Prendu()
PDevice.Clear 0, ByVal 0, D3DCLEAR_TARGET Or D3DCLEAR_ZBUFFER, RGB(0, 0, 0), 1#, 0
PDevice.BeginScene
'XXXXXXXXXXXXXX ci dessous , si les roues sont en rotation , la touche SPIN est rouge sinon bleu XXXXXXX
'XXXXXXXXXXXX on va chercher une géométrie différente XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If tournedroite = False And tournecentre = False And tournegauche = False Then changespin1 Else changespin2
PDevice.SetRenderState D3DRS_LIGHTING, 0 'si=,0 l'éclairage n'est pas géré sinon =,1
'PDevice.SetRenderState D3DRS_AMBIENT, RGB(40, 40, 40) ' limite inférieure pour la puiisance de la lumière
PDevice.SetRenderState D3DRS_ZENABLE, 1 'buffer de profondeur
PDevice.SetVertexShader PFVF
'xxxxxxxxxxxxxxxxxxxx calcul pour les rotations des roues xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'xxxxxxxxxxxxxxxxxx roue du centre xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'XXX C'est là le problème XXXXXXX
nbretourcentre = nbretourcentre - 0.5' vitesse de rotation
couleur(1) = GetPixel(Form1.hdc, 540, 245) ' on teste la couleur
If testokcentre = True And couleur(1) <> &HFFFFFF Then
tournecentre = False'si on n'est pas sur du blanc la roue stoppe
sndPlaySound Ppath & "stoproue.wav", &H1 ' le h0 permet d'attendre la fin du wave avant de rendre la main
stopcentre = True
End If
If anglerouecentre = 0.01 And couleur(1) = &HFFFFFF Then testokcentre = True Else testokcentre = False
If nbretourcentre < -200 Then anglerouecentre = 0.04 '0.06
If nbretourcentre < -300 Then anglerouecentre = 0.03 '0.05
If nbretourcentre < -400 Then anglerouecentre = 0.02 '0.04' la vitesse de rotation diminue
If nbretourcentre < -500 Then anglerouecentre = 0.01 '0.03
'xxxxxxxxxxxxxxxxxxxxx roue de droite xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
nbretourdroite = nbretourdroite - 0.5
couleur(2) = GetPixel(Form1.hdc, 570, 245) ' on teste la couleur sur laquelle pass la roue
If testokdroite = True And couleur(2) <> &HFFFFFF Then 'autorisation à l'arret de la roue
tournedroite = False ' on stoppe la rotation de la roue
sndPlaySound Ppath & "stoproue.wav", &H1 ' le h0 permet d'attendre la fin du wave avant de rendre la main
stopdroite = True
End If
If anglerouedroite = 0.01 And couleur(2) = &HFFFFFF Then testokdroite = True Else testokdroite = False ' pour etre sur que la roue stoppe bien au centre
If nbretourdroite < -200 Then anglerouedroite = 0.04 ' on diminue au fur et à mesure la vitesse de rotation
If nbretourdroite < -300 Then anglerouedroite = 0.03
If nbretourdroite < -400 Then anglerouedroite = 0.02
If nbretourdroite < -500 Then anglerouedroite = 0.01
'xxxxxxxxxxxxxxxxxxxxx roue de gauche xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
nbretourgauche = nbretourgauche - 0.5
couleur(0) = GetPixel(Form1.hdc, 250, 245)
If testokgauche = True And couleur(0) <> &HFFFFFF Then
tournegauche = False
sndPlaySound Ppath & "stoproue.wav", &H1 ' le h0 permet d'attendre la fin du wave avant de rendre la main
stopgauche = True
End If
If anglerouegauche = 0.01 And couleur(0) = &HFFFFFF Then testokgauche = True Else testokgauche = False
If nbretourgauche < -200 Then anglerouegauche = 0.04 '0.05
If nbretourgauche < -300 Then anglerouegauche = 0.03 '0.04
If nbretourgauche < -400 Then anglerouegauche = 0.02 '0.03
If nbretourgauche < -500 Then anglerouegauche = 0.01
'xxxxxxxxxxxxxxxxxx calcul des gains xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
If stopgauche = True And stopcentre = True And stopdroite = True Then
calculgain' cest la sub qui va calculer les gains
stopgauche = False
stopcentre = False
stopdroite = False
End If
'XXXXXXXXXXXXXXXXXX fond du jeu XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'PDevice.SetTexture 0, texture9 'photo des calanques
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexfondjeu(0), Len(vertexfondjeu(0)) ' le 2=nbre de triangles a dessiner
'XXXXXXXXXXXXXXXXXXXX DESSINS DES TROIS ROUES XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'xxxxxxxxxxxxxxxxxxxx A chaque segment des roues correspond un motif xxxxxxxxx
PDevice.SetTexture 0, texture1 ' motif 1
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(0), Len(vertexrouecentre(0)) ' on dessine 2 triangles à partir du no 0
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(0), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(0), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture2
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(6), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(6), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(6), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture3
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(12), Len(vertexrouecentre(0)) ' on dessine 2 triangles à partir du no 12
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(12), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(12), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture4
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(18), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(18), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(18), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture5
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(24), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(24), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(24), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture6
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(30), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(30), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(30), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture7
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(36), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(36), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(36), Len(vertexrouedroite(0))
PDevice.SetTexture 0, texture8
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouecentre(42), Len(vertexrouecentre(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouegauche(42), Len(vertexrouegauche(0))
PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexrouedroite(42), Len(vertexrouedroite(0))
'xxxxxxxxxxxxx AFFICHAGE DU TABLEAU DES GAINS POSSIBLE 1000 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 160 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 300
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=1000", textrect, DT_TOP
'PDevice.SetTexture 0, texture3
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 6, vertexgainjeu(0), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE 500 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 205 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 300
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=500", textrect, DT_TOP
'PDevice.SetTexture 0, texture2
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 6, vertexgainjeu(18), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE 100 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 255 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 300
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=100", textrect, DT_TOP
'PDevice.SetTexture 0, texture5
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 4, vertexgainjeu(36), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE 50 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 300 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 400
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=50", textrect, DT_TOP
'PDevice.SetTexture 0, texture8
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 4, vertexgainjeu(48), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE 10 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 350 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 400
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=10", textrect, DT_TOP
'PDevice.SetTexture 0, texture4
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexgainjeu(60), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE 1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 400 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 450
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "=1", textrect, DT_TOP
'PDevice.SetTexture 0, texture6
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertexgainjeu(66), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'xxxxxxxxxxxxx AFFICHAGE GAIN POSSIBLE BONUS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'initfont
'textrect.Top = 450 ' y
'textrect.Left = 150 ' x
'textrect.bottom = 500
'textrect.Right = 500
'Pd3dx.DrawText mainfont, &HFFFF0000, "BONUS", textrect, DT_TOP
'PDevice.SetTexture 0, texture7
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 4, vertexgainjeu(72), Len(vertexgainjeu(0)) ' le 2=nbre de triangles pour l'objet 2
'XXXXXXXXXXXXXXXXXXXXX AFFICHAGE FOND POUR LES GAINS , LE CAPITAL , LES MISES XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'PDevice.SetTexture 0, Nothing ' sinon tout est noir
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 14, vertexplacegain(0), Len(vertexplacegain(0))
'initfont2 ' grande taille
'textrect.Top = 70 ' y
'textrect.Left = 280 ' x
'textrect.bottom = 200
'textrect.Right = 400
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "GAINS", textrect, DT_TOP
'textrect.Top = 70 ' y
'textrect.Left = 550 ' x
'textrect.bottom = 550
'textrect.Right = 700
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "CAPITAL", textrect, DT_TOP
'textrect.Left = 580 ' x
'textrect.Top = 115 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, capital, textrect, DT_TOP
'initfont
'textrect.Top = 450 ' y
'textrect.Left = 270 ' x
'textrect.bottom = 600
'textrect.Right = 650
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "Touche A=MISE 10 euros , Gain X1", textrect, DT_TOP
'textrect.Top = 500 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "Touche Z=MISE 50 euros , Gain X2", textrect, DT_TOP
'textrect.Top = 545 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "Touche E=MISE 100 euros , Gain X3", textrect, DT_TOP
'textrect.Left = 540 ' x
'textrect.Top = 480 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "VOTRE MISE", textrect, DT_TOP
'textrect.Left = 30 ' x
'textrect.Top = 30 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "Pour sortir du jeu , tapez sur P", textrect, DT_TOP
'textrect.Left = 560 ' x
'textrect.Top = 500 ' y
'Pd3dx.DrawText mainfont, &HFFFFFFFF, mise, textrect, DT_TOP
'textrect.Left = 665 ' x
'textrect.Top = 540 ' y
'Pd3dx.DrawText mainfont, &HFF00FF00, "Touche S", textrect, DT_TOP ' couleur verte
'initfont2
'textrect.Top = 490 ' y
'textrect.Left = 665 ' x
'textrect.bottom = 800
'textrect.Right = 750
'Pd3dx.DrawText mainfont, &HFF00FF00, "SPIN", textrect, DT_TOP
initfont
textrect.Top = 90 ' y
textrect.Left = 50 ' x
textrect.bottom = 130
textrect.Right = 40
'Pd3dx.DrawText mainfont, &HFFFFFFFF, "X", textrect, DT_TOP
Pd3dx.DrawText mainfont, &HFFFFFFFF, Hex(couleur(1)), textrect, DT_TOP
textrect.Top = 70 ' y
Pd3dx.DrawText mainfont, &HFFFFFFFF, Hex(couleurtest), textrect, DT_TOP
textrect.Top = 110 ' y
Pd3dx.DrawText mainfont, &HFFFFFFFF, gaindumilieu(0) & gaindumilieu(1) & gaindumilieu(2), textrect, DT_TOP
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
'PDevice.DrawPrimitiveUP D3DPT_TRIANGLELIST, 2, vertextriangle(0), Len(vertextriangle(0)) 'les deux flèches sur les cotés
PDevice.EndScene
PDevice.Present ByVal 0, ByVal 0, 0, ByVal 0
End Sub
Private Sub calculgain()
'For X = 0 To 2' pour l'instant je ne teste que la roue du centre celle du bug
If couleur(1) = &H84 Then gaindumilieu(1) = "1"
If couleur(1) = &HFF Then gaindumilieu(1) = "2"
If couleur(1) = &H4282FF Then gaindumilieu(1) = "3"
If couleur(1) = &HFF0000 Then gaindumilieu(1) = "4"
If couleur(1) = &HFF0084 Then gaindumilieu(1) = "5"
If couleur(1) = &HFF00FF Then gaindumilieu(1) = "6"
If couleur(1) = &HFF8200 Then gaindumilieu(1) = "7"
If couleur(1) = &HFFFF00 Then gaindumilieu(1) = "8"
'If X = 1 And gaindumilieu(1) = "" Then gaindumilieu(1) = "xx"
'Next X
End Sub |