Load a texture directly from a .sio2 file
2 posters
Load a texture directly from a .sio2 file
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)
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
Re: Load a texture directly from a .sio2 file
sio2ResourceExtractFile( _UDgamecontrol->_SIO2resource, _SIO2stream, "gamepad_frame.tga", UD_GAME_PASSWORD );
sio2ImageLoad( _SIO2image, _SIO2stream );
sio2ImageLoad( _SIO2image, _SIO2stream );
Doesn''t seem to work
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?
By the way - how come image is not automatically added when the dictionary is created?
mterlecki- Posts : 5
Join date : 2009-05-17
Re: Load a texture directly from a .sio2 file
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" );
>> 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" );
Re: Load a texture directly from a .sio2 file
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
Re: Load a texture directly from a .sio2 file
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
Re: Load a texture directly from a .sio2 file
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
Thanks
mterlecki- Posts : 5
Join date : 2009-05-17
Similar topics
» How to convert a .blend file to a .sio2 file.
» tutorial 15 texture file missing?
» EXC_BAD_ACCESS - Can't Load My .SIO2 Object-Scene?!
» Where is the sio2.cc file?
» How to Create .sio2 file???
» tutorial 15 texture file missing?
» EXC_BAD_ACCESS - Can't Load My .SIO2 Object-Scene?!
» Where is the sio2.cc file?
» How to Create .sio2 file???
Permissions in this forum:
You cannot reply to topics in this forum