Jeff78

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Jeff78

  • Rank
    Newbie
  1. Mouse Events for a Board Game in SDL

    I use something like this for doing Mouse events is this is what you mean. All this does is catch any times the mouse is moved over the image area. This only works for rectanges though. Haven't gotten round to writing something for different shapes yet. for the rest of the code look at sourceforge and search for newdawn. [code]void OnHover() { // whilst mouse is over any of list items if(event.type ==SDL_MOUSEMOTION) { int xoff; int yoff; xoff = event.motion.x; yoff = event.motion.y; //Get the mouse offsets bool hover_first = false; if((xoff > tileterrain[0].getX()) && (xoff < tileterrain[0].getX() + tileterrain[0].box.w) && (yoff > tileterrain[0].getY()) && (yoff < tileterrain[0].getY() + tileterrain[0].box.h)) { hover_first = true; } if(hover_first) { // Only after has inital focus hover_first = false; } } }[/code]