Texture to surface

Is there a way of converting a texture to a surface ? I do all my manipulation onto the current renderer and not a surface, but want to be able to save the texture data into a file, rather than having to manipulate surfaces, and then update textures

Dude I think this place is dead. I can’t help you but I think I know a site that t can.

http://www.gamedev.net/index

Could you help me? I’ve been going at this tic tac toe game for a month 1/2. I’m starting to run out of solutions actually.

Yes, this place isn’t as lively as it should be :slight_smile:

For your noughts and crosses game, I would assume the following :

A) Clipping is not correct because the clipping rectangle is incorrect - you could see how it is by displaying a filled rectangle on the area you want to clip.
B) For the buttons, there does need to be some sort of flag to denote when they are pressed (and you would then deactivate all others). You would activate them by doing a simple rectangle collision detection over each.

I did the measurement in MSpaint. My O seem to be good but my X seem to pull in the third clip named “blink” when I press a button.

You would activate them by doing a simple rectangle collision detection over each.

But I did I think? I made all my button, attached them to events and displayed them. Shouldn’t that be enough?

  //Make the buttons 
    OX myButton(1, 0, 26, 31); 
       OX myButton1 (28, 0, 54, 31);          
          OX myButton2 (56, 0, 82, 31); 
             OX myButton3 (1, 33, 26, 64); 
    OX myButton4 (28, 33, 54, 64); 
       OX myButton5 (56, 33, 82, 64); 
          OX myButton6 (1, 66, 26, 97); 
             OX myButton7 (28, 66, 54, 97); 
                OX myButton8 (56, 66, 82, 97); 
           

     

    //While the user hasn't quit 
     while( quit == false ) 
     { 
         //If there's events to handle 
         if( SDL_PollEvent( &event ) ) 
         { 
             //Handle button events 
             myButton.handle_events(); 
          myButton1.handle_events(); 
          myButton2.handle_events(); 
          myButton3.handle_events(); 
          myButton4.handle_events(); 
          myButton5.handle_events(); 
          myButton6.handle_events(); 
          myButton7.handle_events(); 
          myButton8.handle_events(); 
           

             //If the user has Xed out the window 
             if( event.type == SDL_QUIT ) 
             { 
                 //Quit the program 
                 quit = true; 
             } 
         } 

         //Show the button 
         myButton.show(); 
       myButton1.show(); 
       myButton2.show(); 
       myButton3.show(); 
       myButton4.show(); 
       myButton5.show(); 
       myButton6.show(); 
       myButton7.show(); 
       myButton8.show();

There is also no reset if this previously was executed :

if( ( x > box.x ) && ( x < box.x + box.w ) && ( y > box.y ) && ( y < box.y + box.h ) )
            {
               clip = &clips[CLIP_O];
         } 

As far as I can tell, it wont reset to BLINK (I think it was)

Hmm thanks. I guess I’ll start thinking about how to make this function reset. Well this thread was for you so I think I’m done asking questions. I just really wanting something hint/tip/or idea how I should approach this and I think I got it now. Thanks dude

No problem!