Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool View::contains(Int32 x, Int32 y, const bool ignoreTransparent) {
- //Adjust the coordinates from screen to view
- x -= Int32(m_sprite.getPosition().x);
- y -= Int32(m_sprite.getPosition().y);
- if (x >= 0 && y >= 0 && x < m_size.x && y < m_size.y) {
- if (ignoreTransparent) {
- //Mouse is in the view. Make sure it is not over a fully transparent area.
- Uint32 pixelCoordinate = x * 4 + y * 4 * m_size.x;
- if (m_buffer[pixelCoordinate + 3] > 0) {
- return true;
- }
- } else {
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement