void nextState() { // If moving bar at edge of board, change direction if (currX + currWidth == 8) currDirection = -1; else if (currX == 0) currDirection = 1; currX += currDirection; // Move bar 1 px in current direction // Mash currState with the level bar to print state int newCurrState[8][16] = {}; // Current state for (int y = 0; y < 16; y++) { for (int x = 0; x < 8; x++) { newCurrState[x][y] = currState[x][y]; } } // Level bar for (int x = 0; x < currWidth; x++) { newCurrState[currX + x][currY] = 1; } displayFunc(newCurrState); // Display board to leds }
void displayfunc_(double (*F)(double*),double *x1,double *x2,char *fmess,int len) { char cmess[200]; fName2c(fmess,cmess, len); dFdF_displayFunc=F; displayFunc(dFdC_displayFunc,*x1,*x2,cmess); }
void specialFunc(int key, int x, int y) { switch (key) { default: break; } displayFunc(); }
static void reshapeFunc(int newWidth, int newHeight) { if (!inFullScreenMode) { configuration.windowWidth = newWidth; configuration.windowHeight = newHeight; } Target_resized(newWidth, newHeight); #ifndef __APPLE__ displayFunc(); #endif }
void keyFunc(unsigned char key, int x, int y) { switch (key) { case 27: // Escape key cerr << "Done." << endl; exit(0); break; default: break; } displayFunc(); }
void Stacker::displayLoss() { gameState = Lost; int lossImage[8][16] = { { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0 }, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0 }, { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 } }; displayFunc(lossImage); }
void Stacker::displayWin() { gameState = Won; int winImage[8][16] = { { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0 }, { 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0 } }; displayFunc(winImage); }
void specialFunc(int key, int x, int y) { switch (key) { case GLUT_KEY_UP: session->BeginEdit(); session->renderConfig->scene->camera->RotateUp(ROTATE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; case GLUT_KEY_DOWN: session->BeginEdit(); session->renderConfig->scene->camera->RotateDown(ROTATE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; case GLUT_KEY_LEFT: session->BeginEdit(); session->renderConfig->scene->camera->RotateLeft(ROTATE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; case GLUT_KEY_RIGHT: session->BeginEdit(); session->renderConfig->scene->camera->RotateRight(ROTATE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; default: break; } displayFunc(); }
void calc_and_publish_BWMask(const ros::Time time_stamp, const std::string frame_id) { robmod->updateRobotLinks(time_stamp); #ifdef USE_GLUT_RENDERING glutPostRedisplay(); glutMainLoopEvent(); #else displayFunc(); #endif // USE_GLUT_RENDERING cvCvtColor(ipl_maskBGRA, ipl_maskBW, CV_BGRA2GRAY); cvFlip(ipl_maskBW); if (inverted) cvNot(ipl_maskBW,ipl_maskBW); if(publish_mask){ sensor_msgs::ImagePtr img_msg = sensor_msgs::CvBridge::cvToImgMsg(ipl_maskBW); img_msg->header.frame_id = frame_id; img_msg->header.stamp = time_stamp; mask_publisher.publish(img_msg); } }
static void motionFunc(int x, int y) { const double minInterval = 0.2; if (mouseButton0) { // Check elapsed time since last update if (WallClockTime() - lastMouseUpdate > minInterval) { const int distX = x - mouseGrabLastX; const int distY = y - mouseGrabLastY; session->BeginEdit(); if (mouseGrabMode) { session->renderConfig->scene->camera->RotateUp(0.04f * distY * ROTATE_STEP); session->renderConfig->scene->camera->RotateLeft(0.04f * distX * ROTATE_STEP); } else { session->renderConfig->scene->camera->RotateDown(0.04f * distY * ROTATE_STEP); session->renderConfig->scene->camera->RotateRight(0.04f * distX * ROTATE_STEP); }; session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); mouseGrabLastX = x; mouseGrabLastY = y; displayFunc(); lastMouseUpdate = WallClockTime(); } } else if (mouseButton2) { // Check elapsed time since last update if (WallClockTime() - lastMouseUpdate > minInterval) { const int distX = x - mouseGrabLastX; const int distY = y - mouseGrabLastY; session->BeginEdit(); if (mouseGrabMode) { session->renderConfig->scene->camera->TranslateLeft(0.04f * distX * MOVE_STEP); session->renderConfig->scene->camera->TranslateForward(0.04f * distY * MOVE_STEP); } else { session->renderConfig->scene->camera->TranslateRight(0.04f * distX * MOVE_STEP); session->renderConfig->scene->camera->TranslateBackward(0.04f * distY * MOVE_STEP); } session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); mouseGrabLastX = x; mouseGrabLastY = y; displayFunc(); lastMouseUpdate = WallClockTime(); } } }
void keyFunc(unsigned char key, int x, int y) { switch (key) { case 'p': { session->SaveFilmImage(); break; } case 27: { // Escape key delete session; SLG_LOG("Done."); exit(EXIT_SUCCESS); break; } case ' ': // Restart rendering session->Stop(); session->Start(); break; case 'a': { session->BeginEdit(); session->renderConfig->scene->camera->TranslateLeft(MOVE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; } case 'd': { session->BeginEdit(); session->renderConfig->scene->camera->TranslateRight(MOVE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; } case 'w': { session->BeginEdit(); session->renderConfig->scene->camera->TranslateForward(MOVE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; } case 's': { session->BeginEdit(); session->renderConfig->scene->camera->TranslateBackward(MOVE_STEP); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; } case 'r': session->BeginEdit(); session->renderConfig->scene->camera->Translate(Vector(0.f, 0.f, MOVE_STEP)); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; case 'f': session->BeginEdit(); session->renderConfig->scene->camera->Translate(Vector(0.f, 0.f, -MOVE_STEP)); session->renderConfig->scene->camera->Update( session->film->GetWidth(), session->film->GetHeight()); session->editActions.AddAction(CAMERA_EDIT); session->EndEdit(); break; case 'h': OSDPrintHelp = (!OSDPrintHelp); break; case 'n': { const unsigned int screenRefreshInterval = session->renderConfig->GetScreenRefreshInterval(); if (screenRefreshInterval > 1000) session->renderConfig->SetScreenRefreshInterval(max(1000u, screenRefreshInterval - 1000)); else session->renderConfig->SetScreenRefreshInterval(max(50u, screenRefreshInterval - 50)); break; } case 'm': { const unsigned int screenRefreshInterval = session->renderConfig->GetScreenRefreshInterval(); if (screenRefreshInterval >= 1000) session->renderConfig->SetScreenRefreshInterval(screenRefreshInterval + 1000); else session->renderConfig->SetScreenRefreshInterval(screenRefreshInterval + 50); break; } case 't': // Toggle tonemap type if (session->film->GetToneMapParams()->GetType() == TONEMAP_LINEAR) { Reinhard02ToneMapParams params; session->film->SetToneMapParams(params); } else { LinearToneMapParams params; session->film->SetToneMapParams(params); } break; /*case '0': config->SetRenderingEngineType(PATHOCL); glutTimerFunc(config->GetScreenRefreshInterval(), timerFunc, 0); break;*/ case 'o': { #if defined(WIN32) std::wstring ws; ws.assign(SLG_LABEL.begin (), SLG_LABEL.end()); HWND hWnd = FindWindowW(NULL, ws.c_str()); if (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) SetWindowPos(hWnd, HWND_NOTOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE); else SetWindowPos(hWnd, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE); #endif break; } default: break; } displayFunc(); }
int main(int argc,char** argv) { displayFunc(hProfileStd,0.001, 30,"STD"); displayFunc(hProfileEinasto,0.001, 30,"Einasto"); }