Prettify and embetter the mouse callback in scene.cpp

This commit is contained in:
2019-03-21 23:58:28 +01:00
parent 8801414e34
commit 8f7f0313f5
3 changed files with 28 additions and 27 deletions

View File

@@ -155,16 +155,19 @@ void init_scene(CommandLineOptions options) {
hudNode->children.push_back(textNode);
}
void mouse_position_cb(double x, double y, int winw, int winh) {
float mousePositionX = x / double(winw); // like the hudNode space
float mousePositionY = y / double(winh);
// returns true if mouse should be centered and invisible
bool mouse_position_handler(double mx, double my, int scale) {
//cout << mx << "\t" << my << endl;
return false;
}
void step_scene(double timeDelta) {
static double timeAcc = 0; // shrug
timeAcc += timeDelta;
cout << "td: " << timeDelta << " " << 1/timeDelta << endl;
plainNode->uvOffset.x += timeDelta*0.5;
plainNode->uvOffset.y -= timeDelta*0.5;
if (boxNode) boxNode->rotation.z += timeDelta;