[SDL] tips for a beginner

Kaya Oğuz kaya at kuzeykutbu.org
Fri Sep 29 02:05:51 PDT 2006


On Sun, Sep 03, 2006 at 05:51:03PM -0700, jonathan racioppo wrote:
> Hi, 
>    
>   I have a simple question about SDL_MOUSEBUTTONDOWN (UP).  I couldnt find anything on how you can use that command on an image such as a button.  Lets say I made an update button and placed it in the middle of the screen using the command apply_surface (280, 350, update, screen);.  How would I make it so when someone clicks there it does something like update a bunch files from a specific location?  Thx in advance.
>    

if (event.type == SDL_MOUSEBUTTONDOWN)
{
  if (event.button.x >= 280 && event.button.x < 280 + ButtonImage->w &&
      event.button.y >= 350 && event.button.y < 350 + ButtonImage->h)
  {
    update_a_bunch_of_files_from_a_specific_location();
    /* You're weclome ;^) */
  }
}

-bill!




More information about the SDL mailing list