Skip to content

Instantly share code, notes, and snippets.

@ryanzec
Created May 29, 2018 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanzec/3f047b37a5c7b784588392b9862212a1 to your computer and use it in GitHub Desktop.
Save ryanzec/3f047b37a5c7b784588392b9862212a1 to your computer and use it in GitHub Desktop.
c++ / sdl / etc examples
// @example scrolling example
case SDL_MOUSEMOTION:
{
bool mouseInUiNow = isInRect(sideUiBackground, event.motion.x, event.motion.y);
if (mouseInUiNow && !mouseInUi) {
mouseInUi = true;
} else if (!mouseInUiNow && mouseInUi) {
mouseInUi = false;
}
break;
}
case SDL_MOUSEWHEEL:
{
yUiOffset += event.wheel.y;
std::cout << event.wheel.x << "x" << event.wheel.y << std::endl;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment