Skip to main content
GameDev.net gamedev.net
🔒 Locked

Image click detection.

Started by leetleo Mar 14, 2007 at 12:22 AM 1 replies 700+ views
Original Post
leetleo
leetleo
Hello! I'm working on a 2D project using C++ and DX9. All of the images being used are partially transparent PNG files with varying levels of opacity. I want to detect mouse clicks on regions of a given image that are not translucent. I guess I'm essentially trying to do a "pixel perfect" collision test between the mouse and an image. Help is appreciated :).
DragonGeo2
DragonGeo2
Quote:
Original post by Anonymous Poster
Ok. I've come to a conceptual understanding of how I'd accomplish what I previously posted, but it requires me to retrieve the alpha values of a given region on the screen. How would I go about retrieving this information? Help is appreciated.
You can obtain that information by locking the backbuffer (it's a screen surface) and reading the pixel data from that surface (make sure to unlock it before you try to render though!)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.