Page 1 sur 1

Le pendu a Micoute

Publié : lun. 08/sept./2014 14:18
par MLD
@ Micoute
Bonjour
J'ai une hallucination, j'ai vu ton jeu de pendu, et je ne le vois plus :?: :?:
Pour la question posée il faut dans la comparaison, ajouter la longuer du mot avec len(xxx)

J'ai un peu simplifié et pris un peu moin de mémoire je pense. regarde

Code : Tout sélectionner

;Pendu
;
;Utilisation de FindString
;Utilisation de BindGadgetEvent

UseJPEGImageDecoder()

Enumeration Fenetre
  #Fenetre_principale
EndEnumeration

Enumeration Gadgets
  #Txt_1
  #Txt_2
  #Txt_3
  #Txt_4
  #Txt_5
  #Txt_6
  #Txt_7
  #Txt_8
  #Txt_9
  #Txt_10
  #Txt_11
  #Txt_12
  #Txt_13
  #Txt_14
  #Txt_15
  #Txt_16
  #Btn_A = 17
  #Btn_B = 18
  #Btn_C = 19
  #Btn_D = 20
  #Btn_E = 21
  #Btn_F = 22
  #Btn_G = 23
  #Btn_H = 24
  #Btn_I = 25
  #Btn_J = 26
  #Btn_K = 27
  #Btn_L = 28
  #Btn_M = 29
  #Btn_N = 30
  #Btn_O = 31
  #Btn_P = 32
  #Btn_Q = 33
  #Btn_R = 34
  #Btn_S = 35
  #Btn_T = 36
  #Btn_U = 37
  #Btn_V = 38
  #Btn_W = 39
  #Btn_X = 40
  #Btn_Y = 41
  #Btn_Z = 42
  #Btn_Continuer
  #Image_0
EndEnumeration

Enumeration Fonte
  #Police
;   #Police_A
;   #Police_B
;   #Police_C
;   #Police_D
;   #Police_E
;   #Police_F
;   #Police_G
;   #Police_H
;   #Police_I
;   #Police_J
;   #Police_K
;   #Police_L
;   #Police_M
;   #Police_N
;   #Police_O
;   #Police_P
;   #Police_Q
;   #Police_R
;   #Police_S
;   #Police_T
;   #Police_U
;   #Police_V
;   #Police_W
;   #Police_X
;   #Police_Y
;   #Police_Z
EndEnumeration  
Global Evenement, X, Nombre, Longueur, FontTitre = LoadFont(#PB_Any,"Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality)
Global.s FichierImage_0 = #PB_Compiler_FilePath + "\Images\Pendu 0.jpg",
FichierImage_1 = #PB_Compiler_FilePath + "\Images\Pendu 1.jpg",
FichierImage_2 = #PB_Compiler_FilePath + "\Images\Pendu 2.jpg",
FichierImage_3 = #PB_Compiler_FilePath + "\Images\Pendu 3.jpg",
FichierImage_4 = #PB_Compiler_FilePath + "\Images\Pendu 4.jpg",
FichierImage_5 = #PB_Compiler_FilePath + "\Images\Pendu 5.jpg",
FichierImage_6 = #PB_Compiler_FilePath + "\Images\Pendu 6.jpg",
FichierImage_7 = #PB_Compiler_FilePath + "\Images\Pendu 7.jpg",
FichierImage_8 = #PB_Compiler_FilePath + "\Images\Pendu 8.jpg",
FichierImage_9 = #PB_Compiler_FilePath + "\Images\Pendu 9.jpg"

Global Dim Mot_a_trouver.s(19)
Global Mot$, Erreur = 0, I, Trouve = 0

SetGadgetFont(#PB_Default,FontID(FontTitre))

Restore Debut

Procedure Changement_Image()
  If Erreur = 1
    original = LoadImage(#Image_0, FichierImage_1,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 2
    original = LoadImage(#Image_0, FichierImage_2,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 3
    original = LoadImage(#Image_0, FichierImage_3,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 4
    original = LoadImage(#Image_0, FichierImage_4,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 5
    original = LoadImage(#Image_0, FichierImage_5,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 6
    original = LoadImage(#Image_0, FichierImage_6,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 7
    original = LoadImage(#Image_0, FichierImage_7,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 8
    original = LoadImage(#Image_0, FichierImage_8,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 9
    original = LoadImage(#Image_0, FichierImage_9,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  Else
    MessageRequester("ERREUR","Vous avez perdu",#MB_ICONERROR)
  EndIf  
EndProcedure

Procedure contient(Chaine1$, Chaine2$, Position = 0)
  ProcedureReturn FindString(Chaine1$, Chaine2$, Position + 1)
EndProcedure

Procedure Lire_les_donnees()
  X = 0
  Read.s Mot$
  Restore Debut
  While Mot$ <> "999"
    Read.s Mot$
    If Mot$ <> "999"
      Mot_a_trouver(X) = UCase(Mot$)
      X + 1
    EndIf
  Wend
  RandomizeArray(Mot_a_trouver())
EndProcedure

Procedure.s Tirage_au_sort()
  Mot$ = Mot_a_trouver(Random(19))
EndProcedure

Procedure Clic_Btn_Suivant()
  For X = 0 To Longueur - 1
    SetGadgetColor(X,#PB_Gadget_BackColor,GetWindowColor(#Fenetre_principale))
    SetGadgetText(X,"")
  Next
  Tirage_au_sort()
  
  Longueur = Len(Mot$)
  
  For X = 0 To Longueur - 1
    SetGadgetColor(X,#PB_Gadget_BackColor,$B9FFB9)
  Next
  
;  original = LoadImage(#Image_0, FichierImage_0,0)
  ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
 ; ResizeImage(#Image_0,250,350)
  
  Erreur = 0
  
EndProcedure

Procedure Clic_Btn_A()
  I = 0
  Repeat
    Position = contient(Mot$, "A", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"A")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_B()
  I = 0
  Repeat
    Position = contient(Mot$, "B", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"B")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_C()
  I = 0
  Repeat
    Position = contient(Mot$, "C", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"C")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_D()
  I = 0
  Repeat
    Position = contient(Mot$, "D", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"D")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_E()
  I = 0
  Repeat
    Position = contient(Mot$, "E", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"E")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_F()
  I = 0
  Repeat
    Position = contient(Mot$, "F", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"F")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_G()
  I = 0
  Repeat
    Position = contient(Mot$, "G", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"G")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_H()
  I = 0
  Repeat
    Position = contient(Mot$, "H", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"H")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_I()
  I = 0
  Repeat
    Position = contient(Mot$, "I", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"I")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_J()
  I = 0
  Repeat
    Position = contient(Mot$, "J", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"J")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_K()
  I = 0
  Repeat
    Position = contient(Mot$, "K", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"K")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_L()
  I = 0
  Repeat
    Position = contient(Mot$, "L", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"L")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_M()
  I = 0
  Repeat
    Position = contient(Mot$, "M", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"M")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_N()
  I = 0
  Repeat
    Position = contient(Mot$, "N", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"N")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_O()
  I = 0
  Repeat
    Position = contient(Mot$, "O", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"O")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_P()
  I = 0
  Repeat
    Position = contient(Mot$, "P", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"P")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_Q()
  I = 0
  Repeat
    Position = contient(Mot$, "Q", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Q")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_R()
  I = 0
  Repeat
    Position = contient(Mot$, "R", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"R")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_S()
  I = 0
  Repeat
    Position = contient(Mot$, "S", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"S")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_T()
  I = 0
  Repeat
    Position = contient(Mot$, "T", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"T")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_U()
  I = 0
  Repeat
    Position = contient(Mot$, "U", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"U")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_V()
  I = 0
  Repeat
    Position = contient(Mot$, "V", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"V")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_W()
  I = 0
  Repeat
    Position = contient(Mot$, "W", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"W")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_X()
  I = 0
  Repeat
    Position = contient(Mot$, "X", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"X")
    EndIf
  Until Position = 0
  If i = 0
    Changement_Image()
  EndIf
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_Y()
  I = 0
  Repeat
    Position = contient(Mot$, "Y", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Y")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Clic_Btn_Z()
  I = 0
  Repeat
    Position = contient(Mot$, "Z", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Z")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
EndProcedure

Procedure Fermer_Fenetre_principale()  
  CloseWindow(#Fenetre_principale) 
  End
EndProcedure

Procedure Ouvrir_Fenetre_principale()
  If OpenWindow(#Fenetre_principale, 494, 201, 825, 450, "PENDU © 07/09/2014 MICOUTE", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    BindEvent(#PB_Event_CloseWindow, @Fermer_Fenetre_principale(), #Fenetre_principale)
    
    ButtonGadget(#Btn_A, 15, 15, 45, 45, "A")
    ButtonGadget(#Btn_B, 65, 15, 45, 45, "B")
    ButtonGadget(#Btn_C, 115, 15, 45, 45, "C")
    ButtonGadget(#Btn_D, 165, 15, 45, 45, "D")
    ButtonGadget(#Btn_E, 215, 15, 45, 45, "E")
    ButtonGadget(#Btn_F, 265, 15, 45, 45, "F")
    ButtonGadget(#Btn_G, 315, 15, 45, 45, "G")
    ButtonGadget(#Btn_H, 365, 15, 45, 45, "H")
    ButtonGadget(#Btn_I, 415, 15, 45, 45, "I")
    ButtonGadget(#Btn_J, 465, 15, 45, 45, "J")
    ButtonGadget(#Btn_K, 15, 65, 45, 45, "K")
    ButtonGadget(#Btn_L, 65, 65, 45, 45, "L")
    ButtonGadget(#Btn_M, 115, 65, 45, 45, "M")
    ButtonGadget(#Btn_N, 165, 65, 45, 45, "N")
    ButtonGadget(#Btn_O, 215, 65, 45, 45, "O")
    ButtonGadget(#Btn_P, 265, 65, 45, 45, "P")
    ButtonGadget(#Btn_Q, 315, 65, 45, 45, "Q")
    ButtonGadget(#Btn_R, 365, 65, 45, 45, "R")
    ButtonGadget(#Btn_S, 415, 65, 45, 45, "S")
    ButtonGadget(#Btn_T, 465, 65, 45, 45, "T")
    ButtonGadget(#Btn_U, 15, 115, 45, 45, "U")
    ButtonGadget(#Btn_V, 65, 115, 45, 45, "V")
    ButtonGadget(#Btn_W, 115, 115, 45, 45, "W")
    ButtonGadget(#Btn_X, 165, 115, 45, 45, "X")
    ButtonGadget(#Btn_Y, 215, 115, 45, 45, "Y")
    ButtonGadget(#Btn_Z, 265, 115, 45, 45, "Z")
    
 ;   original = LoadImage(#Image_0, FichierImage_0,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
 ;   ResizeImage(#Image_0,250,350)
    
    TextGadget(#Txt_1, 15, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_2, 65, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_3, 115, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_4, 165, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_5, 215, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_6, 265, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_7, 315, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_8, 365, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_9, 415, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_10, 465, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_11, 515, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_12, 565, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_13, 615, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_14, 665, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_15, 715, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_16, 765, 385, 45, 45, "",#PB_Text_Center)
    
    ButtonGadget(#Btn_Continuer, 211, 300, 120, 30, "Continuer")
    
    BindGadgetEvent(#Btn_A, @Clic_Btn_A())
    BindGadgetEvent(#Btn_B, @Clic_Btn_B())    
    BindGadgetEvent(#Btn_C, @Clic_Btn_C())
    BindGadgetEvent(#Btn_D, @Clic_Btn_D())
    BindGadgetEvent(#Btn_E, @Clic_Btn_E())
    BindGadgetEvent(#Btn_F, @Clic_Btn_F())
    BindGadgetEvent(#Btn_G, @Clic_Btn_G())
    BindGadgetEvent(#Btn_H, @Clic_Btn_H())
    BindGadgetEvent(#Btn_I, @Clic_Btn_I())
    BindGadgetEvent(#Btn_J, @Clic_Btn_J())
    BindGadgetEvent(#Btn_K, @Clic_Btn_K())
    BindGadgetEvent(#Btn_L, @Clic_Btn_L())
    BindGadgetEvent(#Btn_M, @Clic_Btn_M())
    BindGadgetEvent(#Btn_N, @Clic_Btn_N())
    BindGadgetEvent(#Btn_O, @Clic_Btn_O())
    BindGadgetEvent(#Btn_P, @Clic_Btn_P())
    BindGadgetEvent(#Btn_Q, @Clic_Btn_Q())
    BindGadgetEvent(#Btn_R, @Clic_Btn_R())
    BindGadgetEvent(#Btn_S, @Clic_Btn_S())
    BindGadgetEvent(#Btn_T, @Clic_Btn_T())
    BindGadgetEvent(#Btn_U, @Clic_Btn_U())
    BindGadgetEvent(#Btn_V, @Clic_Btn_V())
    BindGadgetEvent(#Btn_W, @Clic_Btn_W())   
    BindGadgetEvent(#Btn_X, @Clic_Btn_X())
    BindGadgetEvent(#Btn_Y, @Clic_Btn_Y())
    BindGadgetEvent(#Btn_Z, @Clic_Btn_Z())
    
    BindGadgetEvent(#Btn_Continuer, @Clic_Btn_Suivant())
    
;     SetGadgetFont(#Btn_A,LoadFont(#Police_A, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_B,LoadFont(#Police_B, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_C,LoadFont(#Police_C, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_D,LoadFont(#Police_D, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_E,LoadFont(#Police_E, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_F,LoadFont(#Police_F, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_G,LoadFont(#Police_G, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_H,LoadFont(#Police_H, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_I,LoadFont(#Police_I, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_J,LoadFont(#Police_J, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_K,LoadFont(#Police_K, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_L,LoadFont(#Police_L, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_M,LoadFont(#Police_M, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_N,LoadFont(#Police_N, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_O,LoadFont(#Police_O, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_P,LoadFont(#Police_P, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_Q,LoadFont(#Police_Q, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_R,LoadFont(#Police_R, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_S,LoadFont(#Police_S, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_T,LoadFont(#Police_T, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_U,LoadFont(#Police_U, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_V,LoadFont(#Police_V, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_W,LoadFont(#Police_W, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_X,LoadFont(#Police_X, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_Y,LoadFont(#Police_Y, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
;     SetGadgetFont(#Btn_Z,LoadFont(#Police_Z, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    LoadFont(5,"Verdana",30 ,#PB_Font_Bold|#PB_Font_HighQuality)
    For BTp = 17 To 42
      SetGadgetFont(BTp,FontID(5)) 
    Next
    SetGadgetFont(#Btn_Continuer,LoadFont(#Police, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
    
  EndIf
EndProcedure

Lire_les_donnees()
Tirage_au_sort()
Ouvrir_Fenetre_principale()


;Mot$ = "ABRACADABRA" ; pour l'essai

Longueur = Len(Mot$)
For X = 0 To Longueur - 1
  SetGadgetColor(X,#PB_Gadget_BackColor,$B9FFB9)
Next

If Trouve = Longueur
  MessageRequester("BRAVO","Vous avez gagné !",#MB_ICONEXCLAMATION)
EndIf  

;- Boucle principale
Repeat
  WaitWindowEvent()
ForEver

DataSection
  Debut:
  Data.s "helicoptere","arrosoir","tracteur","telephone","ordinateur","dentifrice","cartable","mammy"
  Data.s "ecole","saxophone","accrobate","voiture","colis","ascenseur","tourniquet","bougie","ecritoire"
  Data.s "velocipede","artichaud","moustique","999"
EndDataSection  


a+ :lol: :lol:

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 14:39
par Micoute
Bonjour mon très cher voisin MLD,

en effet, j'ai enlevé mon code, car j'ai pensé que ça n'intéresserait personne et là, du coup je me sens un peu coupable d'avoir eut des arrières pensées, voilà, j'ai fait mon méa culpa et on recommence à zéro.

Donc, comme on repart de zéro et qu'en plus, j'ai très légèrement modifié mon code, en fait quand on presse un bouton, celui-ci se cache pour ne plus réapparaître que quand on presse le bouton continuer.

J'ai vu que tu as utilisé une astuce pour les police de caractères, ça raccourci pas mal le programme. J'ai vu aussi que tu charge mieux les images que moi, je manque surement d'entrainement. Merci pour ton aide. Je te mets ma nouvelle version

Code : Tout sélectionner

;Pendu
;
;Utilisation de contient en remplacement de FindString
;Utilisation de BindGadgetEvent

UseJPEGImageDecoder()

Enumeration Fenetre
  #Fenetre_principale
EndEnumeration

Enumeration Gadgets
  #Txt_1
  #Txt_2
  #Txt_3
  #Txt_4
  #Txt_5
  #Txt_6
  #Txt_7
  #Txt_8
  #Txt_9
  #Txt_10
  #Txt_11
  #Txt_12
  #Txt_13
  #Txt_14
  #Txt_15
  #Txt_16
  #Btn_A
  #Btn_B
  #Btn_C
  #Btn_D
  #Btn_E
  #Btn_F
  #Btn_G
  #Btn_H
  #Btn_I
  #Btn_J
  #Btn_K
  #Btn_L
  #Btn_M
  #Btn_N
  #Btn_O
  #Btn_P
  #Btn_Q
  #Btn_R
  #Btn_S
  #Btn_T
  #Btn_U
  #Btn_V
  #Btn_W
  #Btn_X
  #Btn_Y
  #Btn_Z
  #Btn_Continuer
  #Image_0
EndEnumeration

Enumeration Fonte
  #Police
  #Police_A
  #Police_B
  #Police_C
  #Police_D
  #Police_E
  #Police_F
  #Police_G
  #Police_H
  #Police_I
  #Police_J
  #Police_K
  #Police_L
  #Police_M
  #Police_N
  #Police_O
  #Police_P
  #Police_Q
  #Police_R
  #Police_S
  #Police_T
  #Police_U
  #Police_V
  #Police_W
  #Police_X
  #Police_Y
  #Police_Z
EndEnumeration  

Global Evenement, X, Nombre, Longueur, FontTitre = LoadFont(#PB_Any,"Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality)
Global.s FichierImage_0 = #PB_Compiler_FilePath + "\Images\Pendu 0.jpg",
FichierImage_1 = #PB_Compiler_FilePath + "\Images\Pendu 1.jpg",
FichierImage_2 = #PB_Compiler_FilePath + "\Images\Pendu 2.jpg",
FichierImage_3 = #PB_Compiler_FilePath + "\Images\Pendu 3.jpg",
FichierImage_4 = #PB_Compiler_FilePath + "\Images\Pendu 4.jpg",
FichierImage_5 = #PB_Compiler_FilePath + "\Images\Pendu 5.jpg",
FichierImage_6 = #PB_Compiler_FilePath + "\Images\Pendu 6.jpg",
FichierImage_7 = #PB_Compiler_FilePath + "\Images\Pendu 7.jpg",
FichierImage_8 = #PB_Compiler_FilePath + "\Images\Pendu 8.jpg",
FichierImage_9 = #PB_Compiler_FilePath + "\Images\Pendu 9.jpg"

Global Dim Mot_a_trouver.s(19)
Global Mot$, Erreur = 0, I, Trouve = 0

SetGadgetFont(#PB_Default,FontID(FontTitre))

Restore Debut

Procedure Changement_Image()
  If Erreur = 1
    original = LoadImage(#Image_0, FichierImage_1,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 2
    original = LoadImage(#Image_0, FichierImage_2,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 3
    original = LoadImage(#Image_0, FichierImage_3,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 4
    original = LoadImage(#Image_0, FichierImage_4,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 5
    original = LoadImage(#Image_0, FichierImage_5,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 6
    original = LoadImage(#Image_0, FichierImage_6,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 7
    original = LoadImage(#Image_0, FichierImage_7,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 8
    original = LoadImage(#Image_0, FichierImage_8,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  ElseIf Erreur = 9
    original = LoadImage(#Image_0, FichierImage_9,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
  Else
    MessageRequester("ERREUR","Vous avez perdu",#MB_ICONERROR)
  EndIf  
EndProcedure

Procedure contient(Chaine1$, Chaine2$, Position = 0)
  ProcedureReturn FindString(Chaine1$, Chaine2$, Position + 1)
EndProcedure

Procedure Lire_les_donnees()
  X = 0
  Read.s Mot$
  Restore Debut
  While Mot$ <> "999"
    Read.s Mot$
    If Mot$ <> "999"
      Mot_a_trouver(X) = UCase(Mot$)
      X + 1
    EndIf
  Wend
  RandomizeArray(Mot_a_trouver())
EndProcedure

Procedure.s Tirage_au_sort()
  Mot$ = Mot_a_trouver(Random(19))
EndProcedure

Procedure Clic_Btn_Suivant()
  For X = 0 To Longueur - 1
    SetGadgetColor(X,#PB_Gadget_BackColor,GetWindowColor(#Fenetre_principale))
    SetGadgetText(X,"")
  Next
  Tirage_au_sort()
  
  Longueur = Len(Mot$)
  
  For X = 0 To Longueur - 1
    SetGadgetColor(X,#PB_Gadget_BackColor,$B9FFB9)
  Next
  
  original = LoadImage(#Image_0, FichierImage_0,0)
  ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
  ResizeImage(#Image_0,250,350)
  
  Erreur = 0
  
  
  HideGadget(#Btn_A, 0)
  HideGadget(#Btn_B, 0)
  HideGadget(#Btn_C, 0)
  HideGadget(#Btn_D, 0)
  HideGadget(#Btn_E, 0)
  HideGadget(#Btn_F, 0)
  HideGadget(#Btn_G, 0)
  HideGadget(#Btn_H, 0)
  HideGadget(#Btn_I, 0)
  HideGadget(#Btn_J, 0)
  HideGadget(#Btn_K, 0)
  HideGadget(#Btn_L, 0)
  HideGadget(#Btn_M, 0)
  HideGadget(#Btn_N, 0)
  HideGadget(#Btn_O, 0)
  HideGadget(#Btn_P, 0)
  HideGadget(#Btn_Q, 0)
  HideGadget(#Btn_R, 0)
  HideGadget(#Btn_S, 0)
  HideGadget(#Btn_T, 0)
  HideGadget(#Btn_U, 0)
  HideGadget(#Btn_V, 0)
  HideGadget(#Btn_W, 0)
  HideGadget(#Btn_X, 0)
  HideGadget(#Btn_Y, 0)
  HideGadget(#Btn_Z, 0)
EndProcedure

Procedure Clic_Btn_A()
  I = 0
  Repeat
    Position = contient(Mot$, "A", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"A")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_A, 1)
EndProcedure

Procedure Clic_Btn_B()
  I = 0
  Repeat
    Position = contient(Mot$, "B", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"B")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
 HideGadget(#Btn_B, 1)
EndProcedure

Procedure Clic_Btn_C()
  I = 0
  Repeat
    Position = contient(Mot$, "C", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"C")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_C, 1)
EndProcedure

Procedure Clic_Btn_D()
  I = 0
  Repeat
    Position = contient(Mot$, "D", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"D")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_D, 1)
EndProcedure

Procedure Clic_Btn_E()
  I = 0
  Repeat
    Position = contient(Mot$, "E", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"E")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_E, 1)
EndProcedure

Procedure Clic_Btn_F()
  I = 0
  Repeat
    Position = contient(Mot$, "F", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"F")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_F, 1)
EndProcedure

Procedure Clic_Btn_G()
  I = 0
  Repeat
    Position = contient(Mot$, "G", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"G")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_G, 1)
EndProcedure

Procedure Clic_Btn_H()
  I = 0
  Repeat
    Position = contient(Mot$, "H", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"H")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_H, 1)
EndProcedure

Procedure Clic_Btn_I()
  I = 0
  Repeat
    Position = contient(Mot$, "I", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"I")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_I, 1)
EndProcedure

Procedure Clic_Btn_J()
  I = 0
  Repeat
    Position = contient(Mot$, "J", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"J")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_J, 1)
EndProcedure

Procedure Clic_Btn_K()
  I = 0
  Repeat
    Position = contient(Mot$, "K", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"K")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_K, 1)
EndProcedure

Procedure Clic_Btn_L()
  I = 0
  Repeat
    Position = contient(Mot$, "L", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"L")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_L, 1)
EndProcedure

Procedure Clic_Btn_M()
  I = 0
  Repeat
    Position = contient(Mot$, "M", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"M")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_M, 1)
EndProcedure

Procedure Clic_Btn_N()
  I = 0
  Repeat
    Position = contient(Mot$, "N", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"N")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_N, 1)
EndProcedure

Procedure Clic_Btn_O()
  I = 0
  Repeat
    Position = contient(Mot$, "O", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"O")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_O, 1)
EndProcedure

Procedure Clic_Btn_P()
  I = 0
  Repeat
    Position = contient(Mot$, "P", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"P")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_P, 1)
EndProcedure

Procedure Clic_Btn_Q()
  I = 0
  Repeat
    Position = contient(Mot$, "Q", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Q")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_Q, 1)
EndProcedure

Procedure Clic_Btn_R()
  I = 0
  Repeat
    Position = contient(Mot$, "R", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"R")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_R, 1)
EndProcedure

Procedure Clic_Btn_S()
  I = 0
  Repeat
    Position = contient(Mot$, "S", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"S")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_S, 1)
EndProcedure

Procedure Clic_Btn_T()
  I = 0
  Repeat
    Position = contient(Mot$, "T", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"T")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_T, 1)
EndProcedure

Procedure Clic_Btn_U()
  I = 0
  Repeat
    Position = contient(Mot$, "U", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"U")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_U, 1)
EndProcedure

Procedure Clic_Btn_V()
  I = 0
  Repeat
    Position = contient(Mot$, "V", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"V")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_V, 1)
EndProcedure

Procedure Clic_Btn_W()
  I = 0
  Repeat
    Position = contient(Mot$, "W", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"W")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_W, 1)
EndProcedure

Procedure Clic_Btn_X()
  I = 0
  Repeat
    Position = contient(Mot$, "X", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"X")
    EndIf
  Until Position = 0
  If i = 0
    Changement_Image()
  EndIf
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_X, 1)
EndProcedure

Procedure Clic_Btn_Y()
  I = 0
  Repeat
    Position = contient(Mot$, "Y", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Y")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_Y, 1)
EndProcedure

Procedure Clic_Btn_Z()
  I = 0
  Repeat
    Position = contient(Mot$, "Z", Position)
    If Position <> 0
      i+1
      SetGadgetText(Position-1,"Z")
    EndIf
  Until Position = 0
  If i = 0
    Erreur + 1
    Changement_Image()
  EndIf
  Trouve + I
  HideGadget(#Btn_Z, 1)
EndProcedure

Procedure Fermer_Fenetre_principale()  
  CloseWindow(#Fenetre_principale) 
  End
EndProcedure

Procedure Ouvrir_Fenetre_principale()
  If OpenWindow(#Fenetre_principale, 494, 201, 825, 450, "PENDU © 07/09/2014 MICOUTE", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
    BindEvent(#PB_Event_CloseWindow, @Fermer_Fenetre_principale(), #Fenetre_principale)
    
    ButtonGadget(#Btn_A, 15, 15, 45, 45, "A")
    ButtonGadget(#Btn_B, 65, 15, 45, 45, "B")
    ButtonGadget(#Btn_C, 115, 15, 45, 45, "C")
    ButtonGadget(#Btn_D, 165, 15, 45, 45, "D")
    ButtonGadget(#Btn_E, 215, 15, 45, 45, "E")
    ButtonGadget(#Btn_F, 265, 15, 45, 45, "F")
    ButtonGadget(#Btn_G, 315, 15, 45, 45, "G")
    ButtonGadget(#Btn_H, 365, 15, 45, 45, "H")
    ButtonGadget(#Btn_I, 415, 15, 45, 45, "I")
    ButtonGadget(#Btn_J, 465, 15, 45, 45, "J")
    ButtonGadget(#Btn_K, 15, 65, 45, 45, "K")
    ButtonGadget(#Btn_L, 65, 65, 45, 45, "L")
    ButtonGadget(#Btn_M, 115, 65, 45, 45, "M")
    ButtonGadget(#Btn_N, 165, 65, 45, 45, "N")
    ButtonGadget(#Btn_O, 215, 65, 45, 45, "O")
    ButtonGadget(#Btn_P, 265, 65, 45, 45, "P")
    ButtonGadget(#Btn_Q, 315, 65, 45, 45, "Q")
    ButtonGadget(#Btn_R, 365, 65, 45, 45, "R")
    ButtonGadget(#Btn_S, 415, 65, 45, 45, "S")
    ButtonGadget(#Btn_T, 465, 65, 45, 45, "T")
    ButtonGadget(#Btn_U, 15, 115, 45, 45, "U")
    ButtonGadget(#Btn_V, 65, 115, 45, 45, "V")
    ButtonGadget(#Btn_W, 115, 115, 45, 45, "W")
    ButtonGadget(#Btn_X, 165, 115, 45, 45, "X")
    ButtonGadget(#Btn_Y, 215, 115, 45, 45, "Y")
    ButtonGadget(#Btn_Z, 265, 115, 45, 45, "Z")
    
    original = LoadImage(#Image_0, FichierImage_0,0)
    ImageGadget(#Image_0, 555, 20, 230, 290, original, #PB_Image_Border)
    ResizeImage(#Image_0,250,350)
    
    TextGadget(#Txt_1, 15, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_2, 65, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_3, 115, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_4, 165, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_5, 215, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_6, 265, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_7, 315, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_8, 365, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_9, 415, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_10, 465, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_11, 515, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_12, 565, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_13, 615, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_14, 665, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_15, 715, 385, 45, 45, "",#PB_Text_Center)
    TextGadget(#Txt_16, 765, 385, 45, 45, "",#PB_Text_Center)
    
    ButtonGadget(#Btn_Continuer, 211, 300, 120, 30, "Continuer")
    
    BindGadgetEvent(#Btn_A, @Clic_Btn_A())
    BindGadgetEvent(#Btn_B, @Clic_Btn_B())    
    BindGadgetEvent(#Btn_C, @Clic_Btn_C())
    BindGadgetEvent(#Btn_D, @Clic_Btn_D())
    BindGadgetEvent(#Btn_E, @Clic_Btn_E())
    BindGadgetEvent(#Btn_F, @Clic_Btn_F())
    BindGadgetEvent(#Btn_G, @Clic_Btn_G())
    BindGadgetEvent(#Btn_H, @Clic_Btn_H())
    BindGadgetEvent(#Btn_I, @Clic_Btn_I())
    BindGadgetEvent(#Btn_J, @Clic_Btn_J())
    BindGadgetEvent(#Btn_K, @Clic_Btn_K())
    BindGadgetEvent(#Btn_L, @Clic_Btn_L())
    BindGadgetEvent(#Btn_M, @Clic_Btn_M())
    BindGadgetEvent(#Btn_N, @Clic_Btn_N())
    BindGadgetEvent(#Btn_O, @Clic_Btn_O())
    BindGadgetEvent(#Btn_P, @Clic_Btn_P())
    BindGadgetEvent(#Btn_Q, @Clic_Btn_Q())
    BindGadgetEvent(#Btn_R, @Clic_Btn_R())
    BindGadgetEvent(#Btn_S, @Clic_Btn_S())
    BindGadgetEvent(#Btn_T, @Clic_Btn_T())
    BindGadgetEvent(#Btn_U, @Clic_Btn_U())
    BindGadgetEvent(#Btn_V, @Clic_Btn_V())
    BindGadgetEvent(#Btn_W, @Clic_Btn_W())   
    BindGadgetEvent(#Btn_X, @Clic_Btn_X())
    BindGadgetEvent(#Btn_Y, @Clic_Btn_Y())
    BindGadgetEvent(#Btn_Z, @Clic_Btn_Z())
    
    BindGadgetEvent(#Btn_Continuer, @Clic_Btn_Suivant())
    
    SetGadgetFont(#Btn_A,LoadFont(#Police_A, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_B,LoadFont(#Police_B, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_C,LoadFont(#Police_C, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_D,LoadFont(#Police_D, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_E,LoadFont(#Police_E, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_F,LoadFont(#Police_F, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_G,LoadFont(#Police_G, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_H,LoadFont(#Police_H, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_I,LoadFont(#Police_I, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_J,LoadFont(#Police_J, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_K,LoadFont(#Police_K, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_L,LoadFont(#Police_L, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_M,LoadFont(#Police_M, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_N,LoadFont(#Police_N, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_O,LoadFont(#Police_O, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_P,LoadFont(#Police_P, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_Q,LoadFont(#Police_Q, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_R,LoadFont(#Police_R, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_S,LoadFont(#Police_S, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_T,LoadFont(#Police_T, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_U,LoadFont(#Police_U, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_V,LoadFont(#Police_V, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_W,LoadFont(#Police_W, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_X,LoadFont(#Police_X, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_Y,LoadFont(#Police_Y, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    SetGadgetFont(#Btn_Z,LoadFont(#Police_Z, "Verdana", 30, #PB_Font_Bold|#PB_Font_HighQuality))
    
    SetGadgetFont(#Btn_Continuer,LoadFont(#Police, "Verdana", 12, #PB_Font_Bold|#PB_Font_HighQuality))
    
  EndIf
EndProcedure

Lire_les_donnees()
Tirage_au_sort()
Ouvrir_Fenetre_principale()


;Mot$ = "ABRACADABRA" ; pour l'essai

Longueur = Len(Mot$)
For X = 0 To Longueur - 1
  SetGadgetColor(X,#PB_Gadget_BackColor,$B9FFB9)
Next

If Trouve = Longueur
  MessageRequester("BRAVO","Vous avez gagné !",#MB_ICONEXCLAMATION)
EndIf  

;- Boucle principale
Repeat
  WaitWindowEvent()
ForEver

DataSection
  Debut:
  Data.s "helicoptere","arrosoir","tracteur","telephone","ordinateur","dentifrice","cartable","mammy"
  Data.s "ecole","saxophone","accrobate","voiture","colis","ascenseur","tourniquet","bougie","ecritoire"
  Data.s "velocipede","artichaud","moustique","999"
EndDataSection  

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 15:03
par MLD
@Micoute

Le fait de faire disparaitrte les boutons est une solution;
Heu! j'ai rien fait pour les images. 8O
Mais ne charge pas 26 fois la même police. Ce n'est pas rationnel :mrgreen:
A+ :lol:

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 15:46
par majikeyric
Bonjour Micoute,

J'aime bien tes petits programmes éducatifs,
tes petits enfants doivent être contents :mrgreen:

Tu as la possibilité de mettre à disposition les images qui vont avec ton pendu ?

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 16:37
par Micoute
Bonjour majikeyric,

oui, bien entendu, le seul problème c'est que je ne sais pas encore comment on fait !

on m'avait dit que pour déposer une image, qu'il me suffisait de sélectionner le bouton Img, qui me donnerait 2 balise [ Img]adresse_de_l_image[ /Img].

J'ai essayé, mais ça n'a pas marché, j'ai du loupé un épisode !

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 16:40
par Micoute
MLD a écrit :ne charge pas 26 fois la même police. Ce n'est pas rationnel
J'avais pourtant fait une boucle, mais n'a fonctionné que le dernier gadget !

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 16:54
par Micoute

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 17:33
par majikeyric
Merci Micoute, ça fonctionne bien :)

Tu te serais moins embeté en postant un seul fichier .zip.

Re: Le pendu a Micoute

Publié : lun. 08/sept./2014 19:22
par Micoute
Je serais plus intelligent, la prochaine fois !