Load a texture directly from a .sio2 file

View previous topic View next topic Go down

Load a texture directly from a .sio2 file

Post  mterlecki on Sun May 17, 2009 3:36 pm

I am building a 2D game that uses many textures to hold sprites. I would like store my "sprite textures" along with all of the other images, i.e. in the "image" directory.

When I add my textures to the image directory they end up in the .sio2 file, but I can't not figure out how to load them from the game. The tutorial05 does not load textures from the .sio2 file - but rather adds the font textures directly to the resources folder.

If I add my texture to the resource folder of the xcode project - then I can load the texture like so:
waterTexture = sio2ImageInit( "water.JPG" );

How would I load this texture from the resource file (.sio2)

mterlecki

Posts : 5
Join date : 2009-05-17

View user profile

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  sio2interactive on Sun May 17, 2009 4:02 pm

sio2ResourceExtractFile( _UDgamecontrol->_SIO2resource, _SIO2stream, "gamepad_frame.tga", UD_GAME_PASSWORD );

sio2ImageLoad( _SIO2image, _SIO2stream );

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Doesn''t seem to work

Post  mterlecki on Fri May 22, 2009 6:02 pm

The call to sio2ResourceExtractFile fails - I have opened up the .sio2 file with a zip viewer to verify that the water.JPG file is in the image directory - but the call still fails.

By the way - how come image is not automatically added when the dictionary is created?

mterlecki

Posts : 5
Join date : 2009-05-17

View user profile

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  sio2interactive on Fri May 22, 2009 6:16 pm

The call to sio2ResourceExtractFile fails - I have opened up the .sio2 file with a zip viewer to verify that the water.JPG file is in the image directory - but the call still fails.

>> Are you calling:

sio2ResourceExtractFile( sio2->_SIO2resource, _SIO2stream, "image/water.JPG", NULL );


By the way - how come image is not automatically added when the dictionary is created?

>> Are you loading the .sio2? If yes it will be available in the SIO2resource, simply call sio2ResourceGetImage( "image/water.JPG" );

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  mterlecki on Fri May 22, 2009 6:25 pm

Actually it turns out that the main ".sio2" file is failing to load - I don't know why.

mterlecki

Posts : 5
Join date : 2009-05-17

View user profile

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  mterlecki on Fri May 22, 2009 6:38 pm

How exactly are you adding the .sio2 files to a project? What are the check box setting etc.

mterlecki

Posts : 5
Join date : 2009-05-17

View user profile

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  sio2interactive on Fri May 22, 2009 6:50 pm

Check the video tutorials...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  mterlecki on Sat May 23, 2009 10:45 am

OK I found the problem. The tool that I was using to create my zip file was actually creating a ".rar" file. I changed the options to make sure it produced a ".zip" file and now it loads just fine.

Thanks

mterlecki

Posts : 5
Join date : 2009-05-17

View user profile

Back to top Go down

Re: Load a texture directly from a .sio2 file

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum