GUI

Started by
4 comments, last by HomerSp 15 years, 4 months ago
Hello, As a test on controls I wish to write a sprite that renders on screen and can be clicked on. I just have no idea how I would add the click event handler to a sprite. Any incite would be appreciated.
Advertisement
which graphic library do you use?
You might add the click event handler to the canvas widget and then search for if the point you clicked on is on a sprite that is drawn by the canvas widget.
I use DirectX as my library.
I use DirectX as my library. And I'll try that!
I'm just not sure how I would execute it. I have my sprite which I render on screen. But I'm not sure where I should check for the mouse position. In the main msg loop for the window or in a custom one. I also don't know how to get the mouseposition without DI.(I don't want to rely on DI for mouse input yet.
Just check if the mouse position is inside the sprite rectangle. Check GD's article section for collision techniques; http://www.gamedev.net/reference/list.asp?categoryid=199

This topic is closed to new replies.

Advertisement