Loading files from a Zip File.

Windows specific forum
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by shdancer.

Can some one help me on this one.

InitEngine3D()
InitSprite()
OpenWindow(0, 100, 100, 500, 500, #PB_Window_SystemMenu, "Load Img from Zip File")
CreateGadgetList(WindowID())
FileBase$ = OpenFileRequester("Select file", "", "Zip File|*.zip", 0)
If FileBase$ = "" : End : EndIf
Add3DArchive(FileBase$, #PB_3DArchive_Zip)
If LoadImage(0, "image.bmp") 0
ImageGadget(1,120,25,32,32,UseImage(0))
EndIf

Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow

CloseWindow(0)

it can't find the image inside the zip.
What's wrong.

Thanks in advance.


ShDancer
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.

From the manual:

Add3DArchive("MyData.zip", #PB_3DArchive_Zip) ; Add the .zip as a directory in the path
LoadTexture(0, "MyTexture.jpg") ; load the MyTexture.jpg from the zip

You can't use LoadImage to load an image inside a ZIP file, only from disk. You use LoadTexture instead and I am assuming here that it supports BMP files as standard

We are Dyslexic of Borg, prepare to have your ass laminated!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by shdancer.

Fangbeast, sorry i was testing and forgot to change that, but with "LoadTexture" it does not work.
It gives a windows general protection error, with this code.

InitEngine3D()
InitSprite()
OpenWindow(0, 100, 100, 500, 500, #PB_Window_SystemMenu, "Load Img from Zip File")
CreateGadgetList(WindowID())
FileBase$ = OpenFileRequester("Select file", "", "Zip File|*.zip", 0)
If FileBase$ = "" : End : EndIf
Add3DArchive(FileBase$, #PB_3DArchive_Zip)
If LoadTexture(0, "image.jpg") 0
ImageGadget(1,120,25,32,32,UseImage(0))
EndIf

Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow

CloseWindow(0)

Thanks

ShDancer
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Thorsten.

You can use RAR files. Create it with WinRAR and use it with PB
like the example shows.

Here a example from PB Resource Site:
http://www.reelmediaproductions.com/pb/ ... _unRAR.zip

Inside your program you can unrar your image, load it and
delete it. If you select a code for the RAR file, you can
good protect your data's.

I use this in my program too - no problems, all fine :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

Hi, Thorsten. Welcome to the forums :)

El_Choni
Post Reply