Using Multiple Resources and sio2 files

View previous topic View next topic Go down

Using Multiple Resources and sio2 files

Post  monkeys on Wed Aug 05, 2009 11:07 pm

I am trying to figure out how to use multiple resources for loading different levels in my sio2 project, and I have looked over all of the other discussions on this forum about how to implement multiple resources but I still cant seem to get it working.

As I understand it the necessary parts of code are:

Code:


//Declaration of the SIO2resource names

SIO2resource *monkey = NULL;
SIO2resource *box= NULL;
...
...
sio2WindowEnterLandscape3D();
   {
               
//Rendering of appropriate resources at appropriate times
 if (monkey)
      {
         sio2ResourceRender( monkey,
                        sio2->_SIO2window,
                        _SIO2camera,
                        SIO2_RENDER_SOLID_OBJECT );
      }
                else
 {
                        sio2ResourceRender( cube,
                        sio2->_SIO2window,
                        _SIO2camera,
                        SIO2_RENDER_SOLID_OBJECT );
}
...
...
void templateLoading( void )
{  ...... 
unsigned int i = 0;

sio2->_SIO2resource = monkey = sio2ResourceInit();
sio2ResourceCreateDictionary( monkey );
sio2ResourceOpen( monkey,
                "tutorial02.sio2", 1 );
   while( i != monkey->gi.number_entry )
   {
      sio2ResourceExtract( monkey, NULL );
      ++i;
   }

i =0;

sio2->_SIO2resource = cube = sio2ResourceInit();
sio2ResourceCreateDictionary( cube );
sio2ResourceOpen( cube,
                "tutorial02.sio2", 1 );
   while( i != cube->gi.number_entry )
   {
      sio2ResourceExtract( cube, NULL );
      ++i;
   }


   // We are done with the file so close the stream.
   sio2ResourceClose( monkey );
        sio2ResourceClose( cube );

void templateShutdown( void )
{.....

   sio2ResourceUnloadAll( monkey );

   sio2->_SIO2resource = sio2ResourceFree( monkey );
}



But it doesn't work obvoiusly. I get an 'error at this point in file' at '
sio2->_SIO2resource = monkey = sio2ResourceInit();' but I think there are more problems than that.

Could anyone else supply some code that they might have used to implement multiple resources? I feel like I am so close to having worked it out but just dont know where I am going wrong.

Any help is greatly appreciated, SIO2 is amazing =)

monkeys

Posts : 8
Join date : 2009-07-22

View user profile

Back to top Go down

Re: Using Multiple Resources and sio2 files

Post  sio2interactive on Wed Aug 05, 2009 11:11 pm

Check the iZenGarden source... you will have a concrete example on that... everything is independent, the garden, the ui, bird, fish etc...

_________________
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 : 37
Location : Shanghai

View user profile http://sio2interactive.com

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