bool VideoRecordDialog::onEvent(const GEvent& event) { if (GuiWindow::onEvent(event)) { // Base class handled the event return true; } if (enabled()) { // Video const bool buttonClicked = (event.type == GEventType::GUI_ACTION) && (event.gui.control == m_recordButton); const bool hotKeyPressed = (event.type == GEventType::KEY_DOWN) && (event.key.keysym.sym == m_hotKey) && (event.key.keysym.mod == m_hotKeyMod); if (buttonClicked || hotKeyPressed) { if (m_video) { stopRecording(); } else { startRecording(); } return true; } const bool ssHotKeyPressed = (event.type == GEventType::KEY_DOWN) && (event.key.keysym.sym == m_ssHotKey) && (event.key.keysym.mod == m_ssHotKeyMod); if (ssHotKeyPressed) { takeScreenshot(); return true; } } return false; }
int Menu::handleKeyPressed(sf::Event& event) { switch (event.key.code) { case sf::Keyboard::Return: return selection; break; case sf::Keyboard::Down: if(selection < (int)menuOptions.size()) selection++; else selection = 1; break; case sf::Keyboard::Up: if(selection > 1) selection--; else selection = menuOptions.size(); break; case sf::Keyboard::Key::F1: takeScreenshot(*window); break; default: break; } return 0; }
// Browse Image void ScreenshotDialog::BrowseBackgroundImage() { // Set Image filter QList<QByteArray> imageFormat(QImageReader::supportedImageFormats()); const int numberOfFormat= imageFormat.size(); QString filter(tr("All Images (")); for (int i= 0; i < numberOfFormat; ++i) { filter.append(QString(" *.") + QString(imageFormat[i])); } filter.append(")"); QString imageFileName= QFileDialog::getOpenFileName(this, tr("Image File Name"), m_CurrentBackgroundImageName, filter); if (!imageFileName.isEmpty() && QFile(imageFileName).exists()) { // Test if the Image is Loadable QImage testBackgroundLoading(imageFileName); if (!testBackgroundLoading.isNull()) { m_CurrentBackgroundImageName= imageFileName; m_BackGroundMode= BackGroundImage; // Take the ScreenShot takeScreenshot(); // Update the preview image updatePreviewImage(); } else { QString message(tr("Unable to load image :") + QString("\n")); message+= imageFileName; QMessageBox::critical(this->parentWidget(), tr("Backround Image"), message); } } }
// The size off the target image changed void ScreenshotDialog::targetImageSizeChanged() { // Compute image aspect ratio m_TargetImageSize.setWidth(spinBoxWidth->value()); m_TargetImageSize.setHeight(spinBoxHeight->value()); m_ImageAspectRatio= static_cast<double>(m_TargetImageSize.width()) / static_cast<double>(m_TargetImageSize.height()); // Take the ScreenShot takeScreenshot(); // Update the preview image updatePreviewImage(); // Update predifined Combo box comboBoxPredifinedSize->blockSignals(true); const int currentIndex= m_PredefinedSizes.indexOf(m_TargetImageSize); if (currentIndex != -1) { comboBoxPredifinedSize->setCurrentIndex(currentIndex); } else { comboBoxPredifinedSize->setCurrentIndex(0); } comboBoxPredifinedSize->blockSignals(false); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); MainWindow mw; mw.setStyleSheet("background-color: transparent"); mw.setAttribute(Qt::WA_TranslucentBackground); mw.setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); //mw.setWindowFlags(Qt::FramelessWindowHint); mw.show(); ScreenshotTaker st; st.haveNewImage = mw.haveNewImage; QObject::connect(&st, SIGNAL(takeScreenshot(QString)), &mw, SLOT(saveScreenshot(QString)), Qt::BlockingQueuedConnection); QObject::connect(&st, SIGNAL(sendOCRText(QString)), &mw, SLOT(setOCRText(QString)), Qt::BlockingQueuedConnection); //st.view = mw.getView(); st.start(); QObject::connect(&app, SIGNAL(aboutToQuit()), &st, SLOT(stopRunning())); /* QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/liveocr/main.qml")); viewer.showExpanded(); viewer.setStyleSheet("background:transparent"); viewer.setAttribute(Qt::WA_TranslucentBackground); //viewer.setWindowFlags(Qt::FramelessWindowHint); */ return app.exec(); }
static void playTrace(PlayerState* state) { /* Start timing after the first actually rendered frame */ if (!state->startTime /*&& state->frame == 2*/) { state->startTime = getTimeStamp(); } if (!state->done) { state->done = (playFrame(state, state->frame) == 0); printf("Frame %d\n", state->frame); ASSERT_EGL; ASSERT_GL; if (state->frame > 0) { #if defined(TAKE_SCREENSHOTS) takeScreenshot(state->frame, 0); #endif } state->frame++; if (state->done) { int diff = getTimeStamp() - state->startTime; if (diff) { float fps = (1000000.0f * state->frame) / diff; printf("Average FPS: %.02f\n", fps); } } } }
void PhoneInfoWidget::refreshScreenshot() { this->rotation = 0; QSize scaledSize = QSize(this->widthScreen, this->heightScreen); scaledSize.scale(this->ui->labelRgb565->size(), Qt::KeepAspectRatio); QPixmap pix = QPixmap::fromImage(noScreenshotImage(scaledSize.width(), scaledSize.height()), Qt::AutoColor); this->ui->labelRgb565->setPixmap(pix); takeScreenshot(); }
void Recorder::onTimerTimeout() { if (m_throttle) { setTimer(); m_throttle = false; } m_time_take_screenshot.start(); emit takeScreenshot(); }
void Screen::runCommand(const std::string &command, const std::string &args) { if (Screenshot == command) { //just take a screen shot takeScreenshot(); } else if (ToggleRendermode == command) { toggleRenderMode(); } else if (Record == command) { mRecorder->startRecording(); } else if (Record.getInverseCommand() == command) { mRecorder->stopRecording(); } }
void EventRecorder::processMillis(uint32 &millis, bool skipRecord) { if (!_initialized) { return; } if (skipRecord) { millis = _fakeTimer; return; } if (_recordMode == kRecorderPlaybackPause) { millis = _fakeTimer; } uint32 millisDelay; Common::RecorderEvent timerEvent; switch (_recordMode) { case kRecorderRecord: updateSubsystems(); millisDelay = millis - _lastMillis; _lastMillis = millis; _fakeTimer += millisDelay; _controlPanel->setReplayedTime(_fakeTimer); timerEvent.recordedtype = Common::kRecorderEventTypeTimer; timerEvent.time = _fakeTimer; _playbackFile->writeEvent(timerEvent); takeScreenshot(); _timerManager->handler(); break; case kRecorderPlayback: updateSubsystems(); if (_nextEvent.recordedtype == Common::kRecorderEventTypeTimer) { _fakeTimer = _nextEvent.time; _nextEvent = _playbackFile->getNextEvent(); _timerManager->handler(); } else { if (_nextEvent.type == Common::EVENT_RTL) { error("playback:action=stopplayback"); } else { uint32 seconds = _fakeTimer / 1000; Common::String screenTime = Common::String::format("%.2d:%.2d:%.2d", seconds / 3600 % 24, seconds / 60 % 60, seconds % 60); error("playback:action=error reason=\"synchronization error\" time = %s", screenTime.c_str()); } } millis = _fakeTimer; _controlPanel->setReplayedTime(_fakeTimer); break; case kRecorderPlaybackPause: millis = _fakeTimer; break; default: break; } }
// Edit background color void ScreenshotDialog::editBackgroundColor() { QColor color = QColorDialog::getColor(m_CurrentBackgroundColor, this); if (color.isValid()) { m_CurrentBackgroundColor= color; // Take the ScreenShot takeScreenshot(); // Update the preview image updatePreviewImage(); } }
void Engine::handleEvent() { //Events while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); //Handle state manager's events state_manager.handleEvents(); //Screenshot takeScreenshot(); } }
// Activate default background void ScreenshotDialog::activateDefaultBackground() { if (m_BackGroundMode != BackGroundDefault) { editColorButton->setEnabled(false); browseImageButton->setEnabled(false); m_BackGroundMode= BackGroundDefault; // Take the ScreenShot takeScreenshot(); // Update the preview image updatePreviewImage(); } }
// Initialize the dialog void ScreenshotDialog::initScreenshotDialog(const QString& fileName) { m_DefaultImageName= fileName; // Compute image aspect ratio const int width= spinBoxWidth->value(); const int height= spinBoxHeight->value(); m_ImageAspectRatio= static_cast<double>(width) / static_cast<double>(height); m_ScreenshotAspectRatio= m_pOpenglView->viewportHandle()->aspectRatio(); // Take the ScreenShot takeScreenshot(); // Update the preview image updatePreviewImage(); }
void MainCamera::runCommand(const std::string &command, const std::string &args) { if(Screenshot == command) { //just take a screen shot takeScreenshot(); } else if (ToggleFullscreen == command){ SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); } else if (ToggleRendermode == command) { toggleRenderMode(); } else if (Record == command) { mRecorder->startRecording(); } else if (Record.getInverseCommand() == command) { mRecorder->stopRecording(); } }
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: openFile(); break; case 1: takeScreenshot(); break; case 2: print(); break; default: ; } _id -= 3; } return _id; }
//solves the grid from phone. void Window::adb_start() { restart(); xpanel->setText(QString::number(4)); ypanel->setText(QString::number(4)); gridChange(); auto adbscr = ADBScreenshot(path.toStdString()); bool success = adbscr.takeScreenshot("grid.png"); if(!success){ QMessageBox::information(this, tr("Error"), QString("There was a problem with connecting to the phone via ADB.")); return; } if (library_path->text().isEmpty() || library_path->text().isNull()) { QMessageBox::information(this, tr("Error"), QString("You need to specify the library to use!")); return; } OCR ocr; ocr.init("auto-generated_files/grid.png"); if(ocr.findDots()) ocr.getGridSize(); else{ QMessageBox::information(this, tr("Error"), QString("There was a problem identifying the grid.")); return; } for (int a = 0; a < 16; a++) tiles.at(a)->setText(QString::fromStdString(ocr.identifyLetter(a%4-1, a/4-1))); solve(); thread.init(ocr, result, path.toStdString()); thread.start(); connect(&thread, SIGNAL(showMB()), this, SLOT(showMonkeyRunnerError())) ; }
//----------------------------------------------------------------------------- // Member functions //----------------------------------------------------------------------------- LLFloaterReporter::LLFloaterReporter( const std::string& name, const LLRect& rect, const std::string& title, EReportType report_type) : LLFloater(name, rect, title), mReportType(report_type), mObjectID(), mScreenID(), mAbuserID(), mDeselectOnClose( FALSE ), mPicking( FALSE), mPosition(), mCopyrightWarningSeen( FALSE ), mResourceDatap(new LLResourceData()) { if (report_type == BUG_REPORT) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_bug.xml"); } else { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); } childSetText("abuse_location_edit", gAgent.getSLURL() ); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0a if (rlv_handler_t::isEnabled()) { // Can't filter these since they get sent as part of the report so just hide them instead if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) { childSetVisible("abuse_location_edit", false); childSetVisible("pos_field", false); } if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { childSetVisible("owner_name", false); childSetVisible("abuser_name_edit", false); } } // [/RLVa:KB] LLButton* pick_btn = getChild<LLButton>("pick_btn"); if (pick_btn) { // XUI: Why aren't these in viewerart.ini? pick_btn->setImages( std::string("UIImgFaceUUID"), std::string("UIImgFaceSelectedUUID") ); childSetAction("pick_btn", onClickObjPicker, this); } if (report_type != BUG_REPORT) { // abuser name is selected from a list LLLineEditor* le = getChild<LLLineEditor>("abuser_name_edit"); le->setEnabled( FALSE ); } childSetAction("select_abuser", onClickSelectAbuser, this); childSetAction("send_btn", onClickSend, this); childSetAction("cancel_btn", onClickCancel, this); enableControls(TRUE); // convert the position to a string LLVector3d pos = gAgent.getPositionGlobal(); LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { pos -= regionp->getOriginGlobal(); } setPosBox(pos); gReporterInstances.addData(report_type, this); // Take a screenshot, but don't draw this floater. setVisible(FALSE); takeScreenshot(); setVisible(TRUE); // Default text to be blank childSetText("object_name", LLStringUtil::null); childSetText("owner_name", LLStringUtil::null); childSetFocus("summary_edit"); mDefaultSummary = childGetText("details_edit"); gDialogVisible = TRUE; // only request details for abuse reports (not BUG reports) if (report_type != BUG_REPORT) { // send a message and ask for information about this region - // result comes back in processRegionInfo(..) LLMessageSystem* msg = gMessageSystem; msg->newMessage("RequestRegionInfo"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); gAgent.sendReliableMessage(); }; }
// virtual BOOL LLFloaterReporter::postBuild() { LLSLURL slurl; LLAgentUI::buildSLURL(slurl); getChild<LLUICtrl>("abuse_location_edit")->setValue(slurl.getSLURLString()); enableControls(TRUE); // convert the position to a string LLVector3d pos = gAgent.getPositionGlobal(); LLViewerRegion *regionp = gAgent.getRegion(); if (regionp) { getChild<LLUICtrl>("sim_field")->setValue(regionp->getName()); pos -= regionp->getOriginGlobal(); } setPosBox(pos); // Take a screenshot, but don't draw this floater. setVisible(FALSE); takeScreenshot(); setVisible(TRUE); // Default text to be blank getChild<LLUICtrl>("object_name")->setValue(LLStringUtil::null); getChild<LLUICtrl>("owner_name")->setValue(LLStringUtil::null); mOwnerName = LLStringUtil::null; getChild<LLUICtrl>("summary_edit")->setFocus(TRUE); mDefaultSummary = getChild<LLUICtrl>("details_edit")->getValue().asString(); // send a message and ask for information about this region - // result comes back in processRegionInfo(..) LLMessageSystem* msg = gMessageSystem; msg->newMessage("RequestRegionInfo"); msg->nextBlock("AgentData"); msg->addUUID("AgentID", gAgent.getID()); msg->addUUID("SessionID", gAgent.getSessionID()); gAgent.sendReliableMessage(); // abuser name is selected from a list LLUICtrl* le = getChild<LLUICtrl>("abuser_name_edit"); le->setEnabled( false ); LLButton* pick_btn = getChild<LLButton>("pick_btn"); // XUI: Why aren't these in viewerart.ini? pick_btn->setImages(std::string("UIImgFaceUUID"), std::string("UIImgFaceSelectedUUID") ); childSetAction("pick_btn", onClickObjPicker, this); childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this)); childSetAction("send_btn", onClickSend, this); childSetAction("cancel_btn", onClickCancel, this); // grab the user's name std::string reporter; gAgent.buildFullname(reporter); getChild<LLUICtrl>("reporter_field")->setValue(reporter); center(); return TRUE; }
bool Screen::screenshotToBuffer(char **buffer, DWORD &size) { return takeScreenshot(3, 0, buffer, size); }
int gravityTest(int argc, char *argv[]) { SDL_Event event; const Uint32 time_per_frame = 1000/50; SDL_Init(SDL_INIT_VIDEO); atexit(stop); SDL_WM_SetCaption("SDL GL Application", NULL); SDL_SetVideoMode(1024, 768, 32, SDL_OPENGL); glEnable(GL_DEPTH_TEST); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); gluPerspective(70,(double)1024/768,1,1000); SDL_EnableKeyRepeat(10,10); // Dessiner(); camera = new TrackBallCamera(); camera->setScrollSensivity(0.5); Uint32 start_time, stop_time; Uint32 last_time = SDL_GetTicks(); Uint32 current_time,ellapsed_time; glEnable(GL_DEPTH_TEST); glEnable(GL_TEXTURE_2D); texture1 = loadTexture("/home/phvera/projects/testopengl/crate.jpg"); texture2 = loadTexture("/home/phvera/projects/testopengl/ground.jpg"); texture3 = loadTexture("/home/phvera/projects/testopengl/sky.jpeg"); texture4 = loadTexture("/home/phvera/projects/testopengl/earth.jpg"); // if (texture1 == NULL || texture2 == NULL || texture3 == NULL) // { // std::cout<<"fail"<<std::endl; // } // for (;;) // { // while (SDL_PollEvent(&event)) // { // // switch(event.type) // { // case SDL_QUIT: // exit(0); // break; // case SDLK_UP: // case SDL_KEYDOWN: // switch (event.key.keysym.sym) // { // case SDLK_UP: // angleX += 1; // break; // // case SDLK_DOWN: // angleX -= 1; // break; // // case SDLK_RIGHT: // angleZ += 1; // break; // // case SDLK_LEFT: // angleZ -= 1; // break; // // case SDLK_INSERT: // angleY += 1; // break; // // case SDLK_DELETE: // angleY -= 1; // break; // } // break; // } // } // current_time = SDL_GetTicks(); // ellapsed_time = current_time - last_time; // last_time = current_time; // // // angleZ += 0.05 * ellapsed_time; // // angleX += 0.05 * ellapsed_time; // // angleY += 0.05 * ellapsed_time; // // ellapsed_time = SDL_GetTicks() - start_time; // if (ellapsed_time < 10) // { // SDL_Delay(10 - ellapsed_time); // } // } int cubeHeight = 50; for (;;) { start_time = SDL_GetTicks(); while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: exit(0); break; case SDL_KEYDOWN: switch (event.key.keysym.sym) { case SDLK_p: takeScreenshot("test.bmp"); break; case SDLK_ESCAPE: exit(0); break; default : camera->OnKeyboard(event.key); } break; case SDL_MOUSEMOTION: camera->OnMouseMotion(event.motion); break; case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONDOWN: camera->OnMouseButton(event.button); break; } } current_time = SDL_GetTicks(); ellapsed_time = current_time - last_time; last_time = current_time; cubeHeight -= 0.01; Dessiner(cubeHeight); stop_time = SDL_GetTicks(); if ((stop_time - last_time) < time_per_frame) { //SDL_Delay(time_per_frame - (stop_time - last_time)); } } return 0; }
bool Screen::screenshot(const char *filename) { DWORD i = 0; return takeScreenshot(2, filename, 0, i); }
bool Screen::screenshotToConsole() { DWORD i = 0; return takeScreenshot(1, 0, 0, i); }
void Viewer::keyPressedEvent(sf::Event& e) { switch (e.key.code) { case sf::Keyboard::C: changeCameraMode(); break; case sf::Keyboard::F1: m_helpDisplayed = !m_helpDisplayed; break; case sf::Keyboard::F2: takeScreenshot(); break; case sf::Keyboard::F3: reloadShaderPrograms(); break; case sf::Keyboard::F4: if( m_animationIsStarted ) stopAnimation(); else startAnimation(); break; case sf::Keyboard::F5: resetAnimation(); for(RenderablePtr r : m_renderables) r->keyPressedEvent(e); break; case sf::Keyboard::W: if( e.key.control ) m_applicationRunning = false; break; case sf::Keyboard::Q: keyboard.left = true; keyboard.direction.x = -1; break; case sf::Keyboard::S: keyboard.backward = true; keyboard.direction.z = -1; break; case sf::Keyboard::D: keyboard.right = true; keyboard.direction.x = 1; break; case sf::Keyboard::Z: keyboard.forward = true; keyboard.direction.z = 1; break; case sf::Keyboard::Space: keyboard.fast = true; break; case sf::Keyboard::LShift: keyboard.slow = true; break; default: for(RenderablePtr r : m_renderables) r->keyPressedEvent(e); break; } }
void Logstalgia::draw(float t, float dt) { if(appFinished) return; if(!settings.disable_progress) slider.logic(dt); display.setClearColour(background); display.clear(); glDisable(GL_FOG); display.mode2D(); glDisable(GL_DEPTH_TEST); glDisable(GL_CULL_FACE); glDisable(GL_LIGHTING); profile_start("draw ip summarizer"); ipSummarizer->draw(dt, font_alpha); profile_stop(); profile_start("draw groups"); drawGroups(dt, font_alpha); profile_stop(); profile_start("draw balls"); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBindTexture(GL_TEXTURE_2D, balltex->textureid); for(RequestBall* ball : balls) { ball->draw(); } profile_stop(); profile_start("draw response codes"); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { RequestBall* r = *it; if(!settings.hide_response_code && r->hasBounced()) { r->drawResponseCode(); } } profile_stop(); glDisable(GL_TEXTURE_2D); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); if(settings.paddle_mode != PADDLE_NONE) { //draw paddles shadows for(auto& it: paddles) { it.second->drawShadow(); } //draw paddles for(auto& it: paddles) { it.second->draw(); } } if(settings.paddle_mode > PADDLE_SINGLE && !settings.hide_paddle_tokens) { glEnable(GL_TEXTURE_2D); //draw paddle tokens for(auto& it: paddles) { it.second->drawToken(); } } if(!settings.disable_glow) { glBlendFunc (GL_ONE, GL_ONE); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, glowtex->textureid); for(std::list<RequestBall*>::iterator it = balls.begin(); it != balls.end(); it++) { (*it)->drawGlow(); } } infowindow.draw(); glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_TEXTURE_2D); if(!take_screenshot && uimessage_timer>0.1f) { fontLarge.setColour(vec4(1.0f,1.0f,uimessage_timer/3.0f,uimessage_timer/3.0f)); int mwidth = fontLarge.getWidth(uimessage.c_str()); fontLarge.draw(display.width/2 - mwidth/2, display.height/2 - 20, uimessage.c_str()); uimessage_timer-=dt; } if(settings.splash > 0.0f) { int logowidth = fontLarge.getWidth("Logstalgia"); int logoheight = 105; int cwidth = fontMedium.getWidth("Website Access Log Viewer"); int awidth = fontMedium.getWidth("(C) 2008 Andrew Caudwell"); vec2 corner(display.width/2 - logowidth/2 - 30.0f, display.height/2 - 45); float logo_alpha = std::min(1.0f, settings.splash/3.0f); float logo_bg = std::min(0.2f, settings.splash/10.0f); glDisable(GL_TEXTURE_2D); glColor4f(0.0f, 0.5f, 1.0f, logo_bg); glBegin(GL_QUADS); glVertex2f(0.0f, corner.y); glVertex2f(0.0f, corner.y + logoheight); glVertex2f(display.width, corner.y + logoheight); glVertex2f(display.width, corner.y); glEnd(); glEnable(GL_TEXTURE_2D); fontLarge.alignTop(true); fontLarge.dropShadow(true); fontLarge.setColour(vec4(1.0f,1.0f,1.0f,logo_alpha)); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Logstalgia"); fontLarge.setColour(vec4(0.0f,1.0f,1.0f,logo_alpha)); fontLarge.draw(display.width/2 - logowidth/2,display.height/2 - 30, "Log"); fontMedium.setColour(vec4(1.0f,1.0f,1.0f,logo_alpha)); fontMedium.draw(display.width/2 - cwidth/2,display.height/2 + 17, "Website Access Log Viewer"); fontMedium.draw(display.width/2 - awidth/2,display.height/2 + 37, "(C) 2008 Andrew Caudwell"); settings.splash -= dt; } fontMedium.setColour(vec4(1.0f,1.0f,1.0f,font_alpha)); if(info) { fontMedium.print(2,2, "FPS %d", (int) fps); fontMedium.print(2,19,"Balls: %d", balls.size()); fontMedium.print(2,36,"Queue: %d", queued_entries.size()); fontMedium.print(2,53,"Paddles: %d", paddles.size()); fontMedium.print(2,70,"Simulation Speed: %.2f", settings.simulation_speed); fontMedium.print(2,87,"Pitch Speed: %.2f", settings.pitch_speed); } else { fontMedium.draw(2,2, displaydate.c_str()); fontMedium.draw(2,19, displaytime.c_str()); } fontLarge.setColour(vec4(1.0f,1.0f,1.0f,font_alpha)); int counter_width = fontLarge.getWidth("00000000"); fontLarge.alignTop(false); fontLarge.print(display.width-10-counter_width,display.height-10, "%08d", highscore); if(!settings.disable_progress) slider.draw(dt); if(take_screenshot) { takeScreenshot(); take_screenshot = false; } }
static char keyToASCII(KEY_t key) { uint8_t retchar = 0; // The character that returns the scan code to ASCII code bool shift = pressedKeys[KEY_LSHIFT] || pressedKeys[KEY_RSHIFT]; if(capsLock) shift = !shift; // Fallback mechanism if (pressedKeys[KEY_ALTGR]) { if (shift) { retchar = keyToASCII_shiftAltGr[key]; } if (!shift || retchar == 0) // if shift is not pressed or if there is no key specified for ShiftAltGr (so retchar is still 0) { retchar = keyToASCII_altGr[key]; } } if (!pressedKeys[KEY_ALTGR] || retchar == 0) // if AltGr is not pressed or if retchar is still 0 { if (shift) { retchar = keyToASCII_shift[key]; } if (!shift || retchar == 0) // if shift is not pressed or if retchar is still 0 { retchar = keyToASCII_default[key]; } } // filter special key combinations if (pressedKeys[KEY_LALT]) // Console-Switching { if (retchar == 'm') { console_display(KERNELCONSOLE_ID); return (0); } if (ctoi(retchar) != -1) { console_display(1+ctoi(retchar)); return (0); } } if (pressedKeys[KEY_RCTRL] || pressedKeys[KEY_LCTRL]) { if(key == KEY_ESC || retchar == 'e') { list_t* list = console_displayed->tasks; for(dlelement_t* e = list->head; e != 0;) { task_t* task = e->data; if(task->pid != 0) { kill(task); e = list->head; // Restart at beginning, because list has been modified by kill() } else { e = e->next; } } return (0); } } if (key == KEY_PRINT || key == KEY_F12) // Save content of video memory. F12 is alias for PrintScreen due to problems in some emulators { takeScreenshot(); } return (retchar); }
void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event ) { int id = event.GetId(); bool isChecked = event.IsChecked(); wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::Process_Special_Functions id:%d isChecked:%d" ), id, isChecked ); if( m_canvas == NULL ) return; switch( id ) { case ID_RENDER_CURRENT_VIEW: m_canvas->RenderRaytracingRequest(); break; case ID_RELOAD3D_BOARD: ReloadRequest(); m_canvas->Request_refresh(); break; case ID_ROTATE3D_X_POS: m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_ROTATE3D_X_NEG: m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_ROTATE3D_Y_POS: m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_ROTATE3D_Y_NEG: m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_ROTATE3D_Z_POS: m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_ROTATE3D_Z_NEG: m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) ); m_canvas->Request_refresh(); break; case ID_MOVE3D_LEFT: m_canvas->SetView3D( WXK_LEFT ); return; case ID_MOVE3D_RIGHT: m_canvas->SetView3D( WXK_RIGHT ); return; case ID_MOVE3D_UP: m_canvas->SetView3D( WXK_UP ); return; case ID_MOVE3D_DOWN: m_canvas->SetView3D( WXK_DOWN ); return; case ID_ORTHO: m_settings.CameraGet().ToggleProjection(); m_canvas->Request_refresh(); return; case ID_TOOL_SCREENCOPY_TOCLIBBOARD: case ID_MENU_SCREENCOPY_PNG: case ID_MENU_SCREENCOPY_JPEG: takeScreenshot( event ); return; case ID_MENU3D_BGCOLOR_BOTTOM_SELECTION: if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ) ) ) { if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY ) m_canvas->Request_refresh(); else ReloadRequest(); } return; case ID_MENU3D_BGCOLOR_TOP_SELECTION: if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ) ) ) { if( m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY ) m_canvas->Request_refresh(); else ReloadRequest(); } return; case ID_MENU3D_SILKSCREEN_COLOR_SELECTION: Set3DSilkScreenColorFromUser(); return; case ID_MENU3D_SOLDERMASK_COLOR_SELECTION: Set3DSolderMaskColorFromUser(); return; case ID_MENU3D_SOLDERPASTE_COLOR_SELECTION: Set3DSolderPasteColorFromUser(); return; case ID_MENU3D_COPPER_COLOR_SELECTION: Set3DCopperColorFromUser(); break; case ID_MENU3D_PCB_BODY_COLOR_SELECTION: Set3DBoardBodyColorFromUser(); break; case ID_MENU3D_MOUSEWHEEL_PANNING: m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, isChecked ); break; case ID_MENU3D_REALISTIC_MODE: m_settings.SetFlag( FL_USE_REALISTIC_MODE, isChecked ); SetMenuBarOptionsState(); ReloadRequest( ); return; case ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL: m_settings.MaterialModeSet( MATERIAL_MODE_NORMAL ); ReloadRequest( ); return; case ID_MENU3D_FL_RENDER_MATERIAL_MODE_DIFFUSE_ONLY: m_settings.MaterialModeSet( MATERIAL_MODE_DIFFUSE_ONLY ); ReloadRequest( ); return; case ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE: m_settings.MaterialModeSet( MATERIAL_MODE_CAD_MODE ); ReloadRequest( ); return; case ID_MENU3D_FL_OPENGL_RENDER_COPPER_THICKNESS: m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, isChecked ); ReloadRequest(); return; case ID_MENU3D_FL_OPENGL_RENDER_SHOW_MODEL_BBOX: m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_FL_RAYTRACING_RENDER_SHADOWS: m_settings.SetFlag( FL_RENDER_RAYTRACING_SHADOWS, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_FL_RAYTRACING_PROCEDURAL_TEXTURES: m_settings.SetFlag( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, isChecked ); ReloadRequest( ); return; case ID_MENU3D_FL_RAYTRACING_BACKFLOOR: m_settings.SetFlag( FL_RENDER_RAYTRACING_BACKFLOOR, isChecked ); ReloadRequest( ); return; case ID_MENU3D_FL_RAYTRACING_REFRACTIONS: m_settings.SetFlag( FL_RENDER_RAYTRACING_REFRACTIONS, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_FL_RAYTRACING_REFLECTIONS: m_settings.SetFlag( FL_RENDER_RAYTRACING_REFLECTIONS, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_FL_RAYTRACING_POST_PROCESSING: m_settings.SetFlag( FL_RENDER_RAYTRACING_POST_PROCESSING, isChecked ); ReloadRequest( ); return; case ID_MENU3D_FL_RAYTRACING_ANTI_ALIASING: m_settings.SetFlag( FL_RENDER_RAYTRACING_ANTI_ALIASING, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_SHOW_BOARD_BODY: m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked ); ReloadRequest( ); return; case ID_MENU3D_AXIS_ONOFF: m_settings.SetFlag( FL_AXIS, isChecked ); m_canvas->Request_refresh(); return; case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL: m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, isChecked ); ReloadRequest( ); return; case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_NORMAL_INSERT: m_settings.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, isChecked ); ReloadRequest( ); return; case ID_MENU3D_MODULE_ONOFF_ATTRIBUTES_VIRTUAL: m_settings.SetFlag( FL_MODULE_ATTRIBUTES_VIRTUAL, isChecked ); ReloadRequest( ); return; case ID_MENU3D_ZONE_ONOFF: m_settings.SetFlag( FL_ZONE, isChecked ); ReloadRequest( ); return; case ID_MENU3D_ADHESIVE_ONOFF: m_settings.SetFlag( FL_ADHESIVE, isChecked ); ReloadRequest( ); return; case ID_MENU3D_SILKSCREEN_ONOFF: m_settings.SetFlag( FL_SILKSCREEN, isChecked ); ReloadRequest( ); return; case ID_MENU3D_SOLDER_MASK_ONOFF: m_settings.SetFlag( FL_SOLDERMASK, isChecked ); ReloadRequest( ); return; case ID_MENU3D_SOLDER_PASTE_ONOFF: m_settings.SetFlag( FL_SOLDERPASTE, isChecked ); ReloadRequest( ); return; case ID_MENU3D_COMMENTS_ONOFF: m_settings.SetFlag( FL_COMMENTS, isChecked ); ReloadRequest( ); return; case ID_MENU3D_ECO_ONOFF: m_settings.SetFlag( FL_ECO, isChecked ); ReloadRequest( ); return; case ID_MENU3D_RESET_DEFAULTS: { // Reload settings with a dummy config, so it will load the defaults wxConfig *fooconfig = new wxConfig("FooBarApp"); LoadSettings( fooconfig ); delete fooconfig; // Refresh menu option state SetMenuBarOptionsState(); // Tell canvas that we (may) changed the render engine RenderEngineChanged(); ReloadRequest(); } return; case ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST: { DisplayHotKeys(); } return; default: wxLogMessage( wxT( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d" ), id ); return; } }
FieldWidget::FieldWidget(QWidget *parent) : QGraphicsView(parent), m_geometryUpdated(true), m_rotation(0.0f), m_worldStateUpdated(false), m_visualizationsUpdated(false), m_hasTouchInput(false), m_dragType(DragNone), m_dragItem(NULL) { m_touchStatusType = QGestureRecognizer::registerRecognizer(new TouchStatusRecognizer); grabGesture(m_touchStatusType); grabGesture(Qt::PanGesture); grabGesture(Qt::PinchGesture); geometrySetDefault(&m_geometry); // setup context menu m_contextMenu = new QMenu(this); QAction *actionHorizontal = m_contextMenu->addAction("Horizontal"); connect(actionHorizontal, SIGNAL(triggered()), SLOT(setHorizontal())); QAction *actionVertical = m_contextMenu->addAction("Vertical"); connect(actionVertical, SIGNAL(triggered()), SLOT(setVertical())); QAction *actionFlip = m_contextMenu->addAction("Flip"); connect(actionFlip, SIGNAL(triggered()), SLOT(flip())); m_contextMenu->addSeparator(); // add actions to allow hiding visualizations of a team m_actionShowBlueVis = m_contextMenu->addAction("Show blue visualizations"); m_actionShowBlueVis->setCheckable(true); m_actionShowBlueVis->setChecked(true); connect(m_actionShowBlueVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility())); m_actionShowYellowVis = m_contextMenu->addAction("Show yellow visualizations"); m_actionShowYellowVis->setCheckable(true); m_actionShowYellowVis->setChecked(true); connect(m_actionShowYellowVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility())); m_actionShowControllerVis = m_contextMenu->addAction("Show controller visualizations"); m_actionShowControllerVis->setCheckable(true); m_actionShowControllerVis->setChecked(true); connect(m_actionShowControllerVis, SIGNAL(triggered()), SLOT(updateVisualizationVisibility())); updateVisualizationVisibility(); // update the visibility map m_contextMenu->addSeparator(); // other actions QAction *actionShowAOI = m_contextMenu->addAction("Enable custom vision area"); actionShowAOI->setCheckable(true); connect(actionShowAOI, SIGNAL(toggled(bool)), SLOT(setAOIVisible(bool))); m_actionAntialiasing = m_contextMenu->addAction("Anti-aliasing"); m_actionAntialiasing->setCheckable(true); connect(m_actionAntialiasing, SIGNAL(toggled(bool)), SLOT(setAntialiasing(bool))); m_actionGL = m_contextMenu->addAction("OpenGL"); m_actionGL->setCheckable(true); connect(m_actionGL, SIGNAL(toggled(bool)), SLOT(setOpenGL(bool))); m_contextMenu->addSeparator(); QAction *actionScreenshot = m_contextMenu->addAction("Take screenshot"); connect(actionScreenshot, SIGNAL(triggered()), SLOT(takeScreenshot())); QAction *actionSaveSituation = m_contextMenu->addAction("Save Situation"); connect(actionSaveSituation, SIGNAL(triggered()), SLOT(saveSituation())); // create graphics scene m_scene = new QGraphicsScene(this); setScene(m_scene); // ball object const float ballRadius = 0.02133f; m_ball = new QGraphicsEllipseItem; m_ball->setPen(Qt::NoPen); m_ball->setBrush(QColor(255, 66, 0)); m_ball->setZValue(100.0f); m_ball->setRect(QRectF(-ballRadius, -ballRadius, ballRadius * 2.0f, ballRadius * 2.0f)); m_ball->hide(); m_scene->addItem(m_ball); // rectangle for area of interest m_aoiItem = new QGraphicsPathItem; m_aoiItem->setPen(Qt::NoPen); m_aoiItem->setBrush(QColor(0, 0, 0, 128)); m_aoiItem->setZValue(10000.0f); m_aoiItem->hide(); m_scene->addItem(m_aoiItem); m_aoi = QRectF(-1, -1, 2, 2); updateAOI(); m_scene->setBackgroundBrush(Qt::black); m_scene->setItemIndexMethod(QGraphicsScene::NoIndex); // should improve the performance setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // transforms are centered on the mouse cursor setTransformationAnchor(QGraphicsView::NoAnchor); setOptimizationFlag(QGraphicsView::DontSavePainterState); setCacheMode(QGraphicsView::CacheBackground); setHorizontal(); // view update timer QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(updateAll())); timer->start(30); setMouseTracking(true); // create label to show field coordinates m_lblMousePos = new QLabel(this); m_lblMousePos->setAutoFillBackground(true); // solid background // draw frame m_lblMousePos->setFrameStyle(QFrame::StyledPanel | QFrame::Raised); m_lblMousePos->setMargin(2); // some space m_lblMousePos->hide(); // ensure that the label is hidden on startup // load settings QSettings s; s.beginGroup("Field"); m_actionGL->setChecked(s.value("OpenGL").toBool()); m_actionAntialiasing->setChecked(s.value("AntiAliasing").toBool()); s.endGroup(); }
int main() { initProgram(); #ifdef PROFILING int counter = 0; irqSet(IRQ_HBLANK, hblank_handler); irqEnable(IRQ_HBLANK); cygprofile_begin(); cygprofile_enable(); #endif while(1) { updateStreamLoop(); if(!checkHelp()) { if(getLCDState() == LCD_ON) { updateStreamLoop(); clearHelpScreen(); } updateStreamLoop(); drawControls(getLCDState() != LCD_ON); updateStreamLoop(); checkKeys(); executeQueuedControls(); // Split here because the state can change in checkKeys if(getLCDState() == LCD_ON) { #ifdef SCREENSHOT_MODE takeScreenshot(); #endif updateStreamLoop(); drawToScreen(); } else { updateStreamLoop(); checkEndSound(); } updateStreamLoop(); checkSleepState(); } #ifdef PROFILING counter++; if(counter == 700) { cygprofile_disable(); cygprofile_end(); } #endif } }
void ScreenShotPage::screenshotDelay() { QTimer::singleShot((entrySeconds->text().toInt() * 1000), this, SLOT(takeScreenshot())); }