views:

129

answers:

1

Hello Everyone,

I am working on Rubik's Cube iphone application. But i am stuck in the middle of the development.

I am using SIO2 Gaming Engine for the development.

Can anyone please provide some sample source code for Rubik's Cube iphone application.

Thanks & Regards Tariq

A: 

void templateLoading( void ) {

sio2ResourceOpen( sio2->_SIO2resource, "CubePuzzle.sio2", 1 );

// Loop into the archive extracting all the 
// resources compressed within the fileformat.
while( i != sio2->_SIO2resource->gi.number_entry )
{
    // Extract the current file selected within
    // the archive package and put the pointer to 
    // the next one.
    sio2ResourceExtract( sio2->_SIO2resource, NULL );
    ++i;
}

----------------------------------

// ******** Upper Objects *********

 C21 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube21" );
 C22 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube22" );
 C23 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube23" );
 C24 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube24" );
 C25 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube25" );
 C26 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube26" );
 C27 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube27" );
 C28 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube28" );
 C29 = sio2ResourceGetObject( sio2->_SIO2resource, "object/Cube29" );

// ** Rotation Around Upper ***

makeChildOf(C21->_SIO2transform, C25->_SIO2transform);
makeChildOf(C22->_SIO2transform, C25->_SIO2transform);
makeChildOf(C23->_SIO2transform, C25->_SIO2transform);
makeChildOf(C24->_SIO2transform, C25->_SIO2transform);
makeChildOf(C26->_SIO2transform, C25->_SIO2transform);
makeChildOf(C27->_SIO2transform, C25->_SIO2transform);
makeChildOf(C28->_SIO2transform, C25->_SIO2transform);
makeChildOf(C29->_SIO2transform, C25->_SIO2transform);

}

Then under template render i m calling objectmove

void sio2ObjectMove( SIO2object *_SIO2objectp, SIO2window *_SIO2window) { SIO2object *_SIO2object = _SIO2objectp; float speed = 1 * ( camera_speed * sio2->_SIO2window->d_time );

if( sio2->_SIO2window->n_touch )
{
    float d = sio2->_SIO2window->touch[ 0 ]->x - start.x;
    // Check if we get a pointer.
    if( _SIO2object )
    {
        // Apply a rotation based on the
        // touch movement. (basic)
        if( d > 5.0f || d < -5.0f )//     || d1 > 5.0f || d1 <-5.0f)
        { 
            //_SIO2object->_SIO2transform->rot->y +=  1.5;
            _SIO2object->_SIO2transform->rot->z += ( d * 0.025f ); 
        }

}

i have searched everywhere but not able to find out appropriate way of development in iphone.. Some codes are already mentioned in apple forum which is for mac only.

Please anyone provide me sample code.

I would be really thankful

Tariq- iPHONE Programmer
You should edit your question to add this information rather than adding an answer. You've not said what happens when you run the code you've posted.
JosephH
Tariq- iPHONE Programmer