Originally posted by confuted
It could be done like you described with OpenGL or DirectX. If you do it with DirectX, you can use DirectX both to display the picture, and to detect the mouse clicks. I think in OpenGL you'd have to handle the windows message for the mouse click (I'm not sure).
The opengl utility library glut handles all kinds of stuff including mouseclicks =)
Code:
#include <gl/glut.h>
#include <gl/gl.h>
void renderScene(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glFlush();
}
void main(int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition(100,100);
glutInitWindowSize(320,320);
glutCreateWindow("3D Tech- GLUT Tutorial");
glutDisplayFunc(renderScene);
glutMainLoop();
}
lol, they use void main =) anyway, what I wanted to say is, you can use glutMouseFunc(processMouse);
where processMouse is void processMouse(int button, int state, int x, int y).
glut has function pointers for all kinds of stuff, like keyboard events, mouse events, window resize, move... bla..
glu32 and glut are parts of a standard opengl installation.
You can find a good glut tutorial here