comment inserer un fichier dan sun exe

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
scaraber
Messages : 362
Inscription : ven. 15/juil./2005 17:32

comment inserer un fichier dan sun exe

Message par scaraber »

samlut j aimeria metre mes image de mon petit jeu dans le.exe ej c plus comment faire SVP un code merci
Backup
Messages : 14526
Inscription : lun. 26/avr./2004 0:40

Message par Backup »

Doc ---> image ---->CatchImage(#Image, MemoryAddress)
Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Message par Droopy »

Code : Tout sélectionner

Restore Label1
Id=CatchImage(0,?Label1)

If OpenWindow(0,0,0,245,105,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ImageGadget") And CreateGadgetList(WindowID(0))
  ImageGadget(0, 10,10,100,83,Id)
EndIf
  
Repeat 
Until WaitWindowEvent()=#PB_Event_CloseWindow


DataSection
Label1:
IncludeBinary "c:\purearea.bmp"
EndDataSection
scaraber
Messages : 362
Inscription : ven. 15/juil./2005 17:32

Message par scaraber »

merci amsi pour ce que je veut en faire sa ne marche pas je veut men servir pour des sprite
c'est pour meter que l'exe en dl
kelly
Messages : 176
Inscription : jeu. 09/sept./2004 16:15

Message par kelly »

scaraber a écrit :merci amsi pour ce que je veut en faire sa ne marche pas je veut men servir pour des sprite
c'est pour meter que l'exe en dl
Avant, apprend a ecrire. On dirais que tu ne cherches pas a etre aidé tellement tu ne fais aucun effort a ce niveau.
Franchement, pour transformer le mot "mais" en "amsi", il faut le faire expres, je ne vois pas d'autres ecsplikatoin !!!!
scaraber
Messages : 362
Inscription : ven. 15/juil./2005 17:32

Message par scaraber »

non ce sont que des erreur de frape je tape trop vite ...
jai pas bcp de temps d econexion car je sui en vacance al donc je vasi vite .... voila bon si quelqun pouvait me dire coment faire pour metre les image dans le exe et que les images soit utilisale en sprite
merci a++
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Tu fais ton message au bloc-notes, et tu fais un copier/coller dans le forum.
Comme ça, ta connexion dure mois d'une minute.
scaraber
Messages : 362
Inscription : ven. 15/juil./2005 17:32

Message par scaraber »

merci de ta remarque mais sa ne resoud pas mon probleme SVP de l'aide merci
Avatar de l’utilisateur
Chris
Messages : 3731
Inscription : sam. 24/janv./2004 14:54
Contact :

Message par Chris »

Change CatchImage() par CatchSprite()
Gillou
Messages : 373
Inscription : sam. 28/août/2004 17:35
Localisation : Bretagne, 22
Contact :

Message par Gillou »

Bon voilà si ça peut aider

Un petit code que tu compiles et que met en lien dans les outils personnalisés
avec comme paramètre ton fichier "%FILE" avec les guillemets

Il me permet d'insérer rapidement des fichiers images ou non dans un executables avec la possibilité de les extraire

Voila @+

Code : Tout sélectionner

typefile = MessageRequester("Quel est le type du fichier", "Les fichiers à inclure sont-ils des images?", #MB_ICONQUESTION | #PB_MessageRequester_YesNo)
NewList fich.s()
param$ = ProgramParameter()
;- IMAGE A INCLURE
If typefile = 6
  file$ = OpenFileRequester("Ouvrez des images", GetPathPart(param$), "Images (BMP, JPG, PNG, TIFF, TGA, ICO)|*.ico;*.bmp;*.jpg;*.jpeg;*.tga;*.tiff;*.png", 0, #PB_Requester_MultiSelection)
  If file$
  Repeat
      AddElement(fich())
      fich() = file$
      file$ = NextSelectedFileName()
    Until file$ = ""
    res = MessageRequester("?", "Inclure le module d'extraction des images", #PB_MessageRequester_YesNo)
    pathc = MessageRequester("Adresse des fichiers", "Chemin relatif 'Oui', Chemin complet'Non'", #PB_MessageRequester_YesNo)
    If pathc = 6
      AdressRef$ = OpenFileRequester("Fichier référence", param$, "Tous les fichiers|*.*", 0)
      If AdressRef$
      Else
        pathc = 7
      EndIf
    EndIf
    CreateFile(1, GetPathPart(AdressRef$) + "IMG.pb")
    WriteStringN("Enumeration")
    For a = 0 To CountList(fich()) - 1
      WriteStringN("#Image_" + Str(a+1))
    Next
    WriteStringN("EndEnumeration")
    WriteStringN("")
    WriteStringN("UsePNGImageDecoder()")
    WriteStringN("UseJPEGImageDecoder()")
    WriteStringN("UseTIFFImageDecoder()")
    WriteStringN("UseTGAImageDecoder()")
    WriteStringN("")
    WriteStringN(";- Les images peuvent etre utilisees dans une procedure")
    WriteStringN("")
    ;- INCLURE LE MODULE D EXTRACTION DE L IMAGE
    If res = 6
      For a = 0 To CountList(fich()) - 1
        WriteStringN("Global Image" + Str(a+1))
      Next
      WriteStringN("")
      WriteStringN(";- Mise en memoire des images")
      WriteStringN("")
      For a = 0 To CountList(fich()) - 1
        WriteStringN("Image" + Str(a+1) + " = CatchImage(#Image_" + Str(a+1) + ", ?Image" + Str(a+1) + ")")
      Next
      WriteStringN("")
      WriteStringN(";- Les images seront inclus dans le programmes lors de la compilation")
      WriteStringN("")
      WriteStringN("Procedure ExpandBinaryfile(Fichier.s,binaire)")
      WriteStringN("If CreateFile(0, Fichier)")
      WriteStringN("UseFile(0)")
      WriteStringN("LON=?FNU-binaire")
      WriteStringN("WriteData(binaire,LON)")
      WriteStringN("CloseFile(0)")
      WriteStringN("EndIf")
      WriteStringN("ProcedureReturn 1")
      For a = 0 To CountList(fich()) - 1
        SelectElement(fich(), a)
        If pathc = 6
          AdressFich$ = ReplaceString(fich(), GetPathPart(AdressRef$), "")
        Else
          AdressFich$ = fich()
        EndIf
        WriteStringN("Image" + Str(a+1) + ":")
        WriteStringN("IncludeBinary " + Chr(34) + AdressFich$ + Chr(34))
      Next
      WriteStringN("FNU:")
      WriteStringN("EndProcedure")
      WriteStringN("")
      WriteStringN("Dim Images.s(" + Str(CountList(fich())) + ") : Dim AdressLabel.l(" + Str(CountList(fich())) + ")")
      For a = 0 To CountList(fich()) - 1
        SelectElement(fich(), a)
        If pathc = 6
          AdressFich$ = ReplaceString(fich(), GetPathPart(AdressRef$), "")
        Else
          AdressFich$ = fich()
        EndIf
        WriteStringN("Images(" + Str(a + 1) + ")=" + Chr(34) + AdressFich$ + Chr(34) + " : AdressLabel(" + Str(a + 1) + ")=?Image" + Str(a+1))
      Next
      ;- EXCLURE LE MODULE D EXTRACTION DE L IMAGE
    Else
      For a = 0 To CountList(fich()) - 1
        WriteStringN("Global Image" + Str(a+1))
      Next
      WriteStringN("")
      WriteStringN(";- Mise en memoire des images")
      WriteStringN("")
      For a = 0 To CountList(fich()) - 1
        WriteStringN("Image" + Str(a+1) + " = CatchImage(#Image_" + Str(a+1) + ", ?Image" + Str(a+1) + ")")
      Next
      WriteStringN("")
      WriteStringN(";- Les images seront inclus dans le programmes lors de la compilation")
      WriteStringN("")
      WriteStringN("DataSection")
      For a = 0 To CountList(fich()) - 1
        SelectElement(fich(), a)
        If pathc = 6
          AdressFich$ = ReplaceString(fich(), GetPathPart(AdressRef$), "")
        Else
          AdressFich$ = fich()
        EndIf
        WriteStringN("Image" + Str(a+1) + ":")
        WriteStringN("IncludeBinary " + Chr(34) + AdressFich$ + Chr(34))
      Next
      WriteStringN("EndDataSection")
    EndIf
    CloseFile(1)
    SelectElement(fich(), 0)
    RunProgram(GetPathPart(AdressRef$) + "IMG.pb")
  EndIf
  ;- FCIHIER A INCLURE
Else
  file$ = OpenFileRequester("Ouvrez des fichiers", GetPathPart(param$), "Tous les fichiers)|*.*", 0, #PB_Requester_MultiSelection)
  If file$
  Repeat
      AddElement(fich())
      fich() = file$
      file$ = NextSelectedFileName()
    Until file$ = ""
    pathc = MessageRequester("Adresse des fichiers", "Chemin relatif 'Oui', Chemin complet 'Non'", #PB_MessageRequester_YesNo)
    If pathc = 6
      AdressRef$ = OpenFileRequester("Fichier référence", param$, "Tous les fichiers|*.*", 0)
      If AdressRef$
      Else
        pathc = 7
      EndIf
    EndIf
    CreateFile(1, GetPathPart(AdressRef$) + "FICH.pb")
    WriteStringN("Procedure ExpandBinaryfile(Fichier.s,binaire)")
    WriteStringN("If CreateFile(0, Fichier)")
    WriteStringN("UseFile(0)")
    WriteStringN("LON=?FNU-binaire")
    WriteStringN("WriteData(binaire,LON)")
    WriteStringN("CloseFile(0)")
    WriteStringN("EndIf")
    WriteStringN("ProcedureReturn 1")
    For a = 0 To CountList(fich()) - 1
      SelectElement(fich(), a)
      WriteStringN("Fichier" + Str(a+1) + ":")
      If pathc = 6
        AdressFich$ = ReplaceString(fich(), GetPathPart(AdressRef$), "")
      Else
        AdressFich$ = fich()
      EndIf
      WriteStringN("IncludeBinary " + Chr(34) + AdressFich$ + Chr(34))
    Next
    WriteStringN("FNU:")
    WriteStringN("EndProcedure")
    WriteStringN("")
    WriteStringN("Dim Fichiers.s(" + Str(CountList(fich())) + ") : Dim AdressLabel.l(" + Str(CountList(fich())) + ")")
    
    For a = 0 To CountList(fich()) - 1
      SelectElement(fich(), a)
      If pathc = 6
        AdressFich$ = ReplaceString(fich(), GetPathPart(AdressRef$), "")
      Else
        AdressFich$ = fich()
      EndIf
      WriteStringN("Fichiers(" + Str(a + 1) + ")=" + Chr(34) + AdressFich$ + Chr(34) + " : AdressLabel(" + Str(a + 1) + ")=?Fichier" + Str(a+1))
    Next
    RunProgram(GetPathPart(AdressRef$) + "FICH.pb")
  EndIf
EndIf
scaraber
Messages : 362
Inscription : ven. 15/juil./2005 17:32

Message par scaraber »

merci beaucoup je vais essayer ce code des que jai un peu de temps .
A++
scaraber
Répondre