able to click with cursor, button detect clicking event
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "Cursor.h"
|
||||
|
||||
void configureOpenGL(void);
|
||||
|
||||
CrystalPoint* app;
|
||||
@@ -53,6 +55,17 @@ int main(int argc, char* argv[])
|
||||
glutPassiveMotionFunc(mousemotion);
|
||||
glutMotionFunc(mousemotion);
|
||||
|
||||
auto mouseclick = [](int button, int state,
|
||||
int x, int y)
|
||||
{
|
||||
if (button == GLUT_LEFT_BUTTON)
|
||||
Cursor::getInstance()->state = state;
|
||||
|
||||
//std::cout << "Left button is down" << std::endl;
|
||||
};
|
||||
|
||||
glutMouseFunc(mouseclick);
|
||||
|
||||
CrystalPoint::height = GLUT_WINDOW_HEIGHT;
|
||||
CrystalPoint::width = GLUT_WINDOW_WIDTH;
|
||||
|
||||
@@ -67,6 +80,7 @@ void configureOpenGL()
|
||||
//Init window and glut display mode
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitWindowSize(800, 600);
|
||||
//glutInitWindowPosition(1000,800);
|
||||
glutCreateWindow("Crystal Point");
|
||||
glutFullScreen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user