Advertisement
Guest User

Awesomium Click-through

a guest
Apr 12th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. bool View::contains(Int32 x, Int32 y, const bool ignoreTransparent) {
  2.     //Adjust the coordinates from screen to view
  3.     x -= Int32(m_sprite.getPosition().x);
  4.     y -= Int32(m_sprite.getPosition().y);
  5.     if (x >= 0 && y >= 0 && x < m_size.x && y < m_size.y) {
  6.         if (ignoreTransparent) {
  7.             //Mouse is in the view. Make sure it is not over a fully transparent area.
  8.             Uint32 pixelCoordinate = x * 4 + y * 4 * m_size.x;
  9.             if (m_buffer[pixelCoordinate + 3] > 0) {
  10.                 return true;
  11.             }
  12.         } else {
  13.             return true;
  14.         }
  15.     }
  16.     return false;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement