int main(int argc, char **argv) { int k, N = STD_N, adcNumber = STD_ADCPIN, bench = BENCH_FLAG; float yMax = STD_YMAX, lines = STD_LINES, DELTA = STD_DELTA; mraa_aio_context adc; struct timeval inicio, fim; double tmili; if (argc == 2) { yMax = atof(argv[1]); } else if (argc == 3) { yMax = atof(argv[1]); lines = atof(argv[2]); } adc = mraa_aio_init(adcNumber); if (adc == NULL) return 1; hideCursor(); clear(); while (1) { cplx samples[N]; double deltaFreq; gettimeofday(&inicio, NULL); for (k = 0; k < N; k++) { uint16_t sample = mraa_aio_read(adc); samples[k] = (cplx) 5*sample/(resolution - 1.0); } gettimeofday(&fim, NULL); tmili = (double) (1000 *(fim.tv_sec - inicio.tv_sec) + (fim.tv_usec - inicio.tv_usec) / 1000); deltaFreq = 1000.0 / tmili; if (bench == 1) { printf("\n>>>> Bench with:\n N=%d\n delta=%f\n", N, DELTA); printf(">>>> Sample time : %.2fms\n", tmili); printf(" deltaFreq : %.2fHz\n", deltaFreq); printf(" max freq. : %.2fHz\n", 500*N/tmili); } runFFT(samples, N, DELTA, deltaFreq, bench, yMax, lines); printCoord (N/2, 40); } mraa_aio_close(adc); return 0; }
void BodyTheatreApp::setup() { #ifdef _DEBUG int breakPoint = 0; if (getArgs().size() == 2) { breakPoint = fromString<int>(getArgs()[1]); } enableMemleakCheck(breakPoint); #endif Rand::randomize(); if (!loadConfig("BodyTheatre.xml")) saveConfig("BodyTheatre.xml"); hideCursor(); _listener = shared_ptr<osc::Listener>(new osc::Listener); _listener->setup(7777); _listener->registerMessageReceived(this, &BodyTheatreApp::onOscMessage); players = new Player[N_PLAYERS]; _activeIdx = INVALID_IDX; _routine = shared_ptr<KinectRoutine>(new KinectRoutine); }
int main() { hideCursor(); char title[] = "Simple Game Demo"; setTitle(title); int opt = displayMainMenu(); while (opt != 3) { clrscr(); if (opt == 0) { char msg[] = "Let's play a game\nEat the # to win the game"; displayMsg(0, 0, msg); Sleep(1000); clrscr(); playGame(); } else if (opt == 1) { printf("This is load"); } else if (opt == 2) { printf("This is setting"); } clrscr(); opt = displayMainMenu(); } return 0; }
void Events::loadCursors(const Common::String &filename) { hideCursor(); delete _cursorImages; _cursorImages = new ImageFile(filename); _cursorId = INVALID_CURSOR; }
void LLWindowMacOSX::hideCursorUntilMouseMove() { if (!mHideCursorPermanent) { hideCursor(); mHideCursorPermanent = FALSE; } }
EventsClass::EventsClass() { _currentCursor = CURSOR_NONE; hideCursor(); _frameNumber = 0; _priorFrameTime = 0; _prevDelayFrame = 0; _saver->addListener(this); }
void TestApp::mouseButtonDown(const SDL_MouseButtonEvent &m) { if(m.button==SDL_BUTTON_RIGHT) mouseMode = (mouseMode+1)%MOUSELAST; switch(mouseMode) { case MOUSEFPS: hideCursor(true); grabInput(true); warpMouse(width/2, height/2); break; case MOUSEFREE: grabInput(false); hideCursor(false); break; } }
VideoDock::VideoDock() : isTouch(false), touchEnded(false), iDW(QMPlay2GUI.grad1, QMPlay2GUI.grad2, QMPlay2GUI.qmpTxt), pixels(0), canPopup(true), is_floating(false), touchZoom(0.0) { setWindowTitle(tr("Video")); popupMenu = new QMenu(this); popupMenu->addMenu(QMPlay2GUI.menuBar->window); popupMenu->addMenu(QMPlay2GUI.menuBar->widgets); popupMenu->addMenu(QMPlay2GUI.menuBar->playlist); popupMenu->addMenu(QMPlay2GUI.menuBar->player); popupMenu->addMenu(QMPlay2GUI.menuBar->playback); popupMenu->addMenu(QMPlay2GUI.menuBar->options); popupMenu->addMenu(QMPlay2GUI.menuBar->help); /* Menu actions which will be available in fullscreen or compact mode */ for (QAction *act : QMPlay2GUI.menuBar->window->actions()) addAction(act); for (QAction *act : QMPlay2GUI.menuBar->playlist->actions()) addAction(act); for (QAction *act : QMPlay2GUI.menuBar->player->actions()) addAction(act); for (QAction *act : QMPlay2GUI.menuBar->playback->actions()) addAction(act); for (QAction *act : QMPlay2GUI.menuBar->options->actions()) addAction(act); for (QAction *act : QMPlay2GUI.menuBar->help->actions()) addAction(act); /**/ setMouseTracking(true); setAcceptDrops(true); grabGesture(Qt::PinchGesture); setContextMenuPolicy(Qt::CustomContextMenu); setWidget(&iDW); hideCursorTim.setSingleShot(true); leftButtonPlayTim.setSingleShot(true); connect(&hideCursorTim, SIGNAL(timeout()), this, SLOT(hideCursor())); connect(&leftButtonPlayTim, SIGNAL(timeout()), QMPlay2GUI.menuBar->player->togglePlay, SLOT(trigger())); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(popup(const QPoint &))); connect(&iDW, SIGNAL(resized(int, int)), this, SLOT(resizedIDW(int, int))); connect(&iDW, SIGNAL(hasCoverImage(bool)), this, SLOT(hasCoverImage(bool))); connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(visibilityChanged(bool))); connect(&QMPlay2Core, SIGNAL(dockVideo(QWidget *)), &iDW, SLOT(setWidget(QWidget *))); if ((isBreeze = QApplication::style()->objectName() == "breeze")) setStyle(&commonStyle); canHideIDWCursor = false; doubleClicked = false; }
KoCursorPrivateAutoHideEventFilter::KoCursorPrivateAutoHideEventFilter( QWidget* widget ) : m_widget( widget ) , m_wasMouseTracking( m_widget->hasMouseTracking() ) , m_isCursorHidden( false ) , m_isOwnCursor( false ) { mouseWidget()->setMouseTracking( true ); connect( &m_autoHideTimer, SIGNAL(timeout()), this, SLOT(hideCursor()) ); }
void OSScreenManager::loadCursors() { if (_mouseCursor) { hideCursor(); delete _mouseCursor; } _mouseCursor = new CMouseCursor(this); if (!_textCursor) { _textCursor = new CTextCursor(this); } }
void PartyMenu::closeAnimation() { hideCursor(); for(int variation=0;variation<200;variation+=10) { menuPaneYVariation+=40; charPaneXVariation+=60; SDL_Delay(1000/60); } }
void Mouse::detach() { if (!m_cursorVisible) { hideCursor(false); // Save the cursor visibility state in case attach() is called later. m_cursorVisible = false; } m_hWnd = 0; }
B9Projector::B9Projector(bool bPrintWindow, QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags) { hideCursor(); setMouseTracking(true); m_bGrid = true; mStatusMsg = "B9Creator - www.b9creator.com"; mpCPJ = NULL; m_xOffset = m_yOffset = 0; m_bIsPrintWindow = bPrintWindow; m_iLevel = -1; }
void SimpleParticlesApp::keyDown( KeyEvent event ) { switch ( event.getCode() ) { case KeyEvent::KEY_f: if ( !isFullScreen() ) { setFullScreen( true ); if ( mParams.isVisible() ) showCursor(); else hideCursor(); } else { setFullScreen( false ); showCursor(); } break; case KeyEvent::KEY_s: mParams.show( !mParams.isVisible() ); if ( isFullScreen() ) { if ( mParams.isVisible() ) showCursor(); else hideCursor(); } break; case KeyEvent::KEY_ESCAPE: quit(); break; default: break; } }
void fsExperiments::keyDown( KeyEvent event ) { switch ( event.getCode() ) { case KeyEvent::KEY_f: if ( !isFullScreen() ) { setFullScreen( true ); if ( GlobalData::get().mParams.isVisible() ) showCursor(); else hideCursor(); } else { setFullScreen( false ); showCursor(); } break; case KeyEvent::KEY_s: GlobalData::get().mParams.show( !GlobalData::get().mParams.isVisible() ); if ( isFullScreen() ) { if ( GlobalData::get().mParams.isVisible() ) showCursor(); else hideCursor(); } break; case KeyEvent::KEY_ESCAPE: quit(); break; default: break; } }
void DebugUI::toggle(){ isVisible = !isVisible; if(isVisible){ show(); showCursor(); } else{ hide(); if(!bShowCursor) hideCursor(); } }
void Events::loadCursors(const Common::String &filename) { hideCursor(); delete _cursorImages; if (!IS_3DO) { // PC _cursorImages = new ImageFile(filename); } else { // 3DO _cursorImages = new ImageFile3DO(filename, kImageFile3DOType_RoomFormat); } _cursorId = INVALID_CURSOR; }
int main() { system("mode con cols=48 lines=23"); SetConsoleTitle(L"2048"); hideCursor(); int data[ROW][COL]; bool isInitial = true; bool isChanged = false; bool isEnded = false; int haveWinned = FALSE; int score = 0; initialNumber(data); randNumber(data, isInitial); printColor(data, score); do { isChanged = false; int key; getKeyPress(key); numberMove(data, key, isChanged); numberAdd(data, key, isChanged, score); numberMove(data, key, isChanged); if (isChanged) { randNumber(data, isInitial); } printColor(data, score); isEnded = isFinished(data); isWinned(data, haveWinned); if (haveWinned == JUSTWINNED) { if (MessageBox(NULL, TEXT("ÄãÓ®ÁË£¡ÊÇ·ñ¼ÌÐø£¿"), TEXT("2048"), MB_YESNO | MB_SYSTEMMODAL) == IDNO) { while (1) { _getch(); } } } } while (!isEnded); if (isEnded) { MessageBox(NULL, TEXT("ÓÎÏ·½áÊø"), TEXT("2048"), MB_OK | MB_SYSTEMMODAL); } while (1) { _getch(); } return 0; }
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { switch (mode) { case GLFW_CURSOR_NORMAL: showCursor(window); break; case GLFW_CURSOR_HIDDEN: hideCursor(window); break; case GLFW_CURSOR_CAPTURED: captureCursor(window); break; } }
void _glfwPlatformApplyCursorMode(_GLFWwindow* window) { switch (window->cursorMode) { case GLFW_CURSOR_NORMAL: restoreCursor(window); break; case GLFW_CURSOR_HIDDEN: hideCursor(window); break; case GLFW_CURSOR_DISABLED: disableCursor(window); break; } }
void COSXScreen::enable() { // watch the clipboard m_clipboardTimer = m_events->newTimer(1.0, NULL); m_events->adoptHandler(CEvent::kTimer, m_clipboardTimer, new TMethodEventJob<COSXScreen>(this, &COSXScreen::handleClipboardCheck)); if (m_isPrimary) { // FIXME -- start watching jump zones // kCGEventTapOptionDefault = 0x00000000 (Missing in 10.4, so specified literally) m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0, kCGEventMaskForAllEvents, handleCGInputEvent, this); } else { // FIXME -- prevent system from entering power save mode if (m_autoShowHideCursor) { hideCursor(); } // warp the mouse to the cursor center fakeMouseMove(m_xCenter, m_yCenter); // there may be a better way to do this, but we register an event handler even if we're // not on the primary display (acting as a client). This way, if a local event comes in // (either keyboard or mouse), we can make sure to show the cursor if we've hidden it. m_eventTapPort = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0, kCGEventMaskForAllEvents, handleCGInputEventSecondary, this); } if (!m_eventTapPort) { LOG((CLOG_ERR "failed to create quartz event tap")); } m_eventTapRLSR = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, m_eventTapPort, 0); if (!m_eventTapRLSR) { LOG((CLOG_ERR "failed to create a CFRunLoopSourceRef for the quartz event tap")); } CFRunLoopAddSource(CFRunLoopGetCurrent(), m_eventTapRLSR, kCFRunLoopDefaultMode); }
// Capture cursor // static void captureCursor(_GLFWwindow* window) { hideCursor(window); if (!window->x11.cursorGrabbed) { if (XGrabPointer(_glfw.x11.display, window->x11.handle, True, ButtonPressMask | ButtonReleaseMask | PointerMotionMask, GrabModeAsync, GrabModeAsync, window->x11.handle, None, CurrentTime) == GrabSuccess) { window->x11.cursorGrabbed = GL_TRUE; } } }
void ImageArea::onTimer( void ) { ScreenBase * w = getCurrentViewer(); if ( w ) w->onTimer(); if ( _hide_cursor_timer > 0 ) { _hide_cursor_timer -= g_config.timer_duration; if ( _hide_cursor_timer <= 0 ) { _hide_cursor_timer = 0; emit hideCursor(); } } _cleanOldViewers(); }
void SplatTestApp::keyDown(KeyEvent event) { switch (event.getCode()) { case KeyEvent::KEY_ESCAPE: { setFullScreen(!isFullScreen()); if (isFullScreen()) hideCursor(); else showCursor(); } break; } switch (event.getChar()) { case 's': { saveGrab(copyWindowSurface(), getAppPath().parent_path() / "grabs"); } break; } }
void DebugUI::setup(DeviceController * _devices, BookController * _book, LanguageController * _lang, BookView * _bookView, BookLoader * _loader, ofxQuadCrop * _cropper, ofxQuadImage * _quadImage){ quadImage = _quadImage; cropper = _cropper; devices = _devices; book = _book; lang = _lang; bookView = _bookView; loader = _loader; tfield.setup(); tfield.update("Magic Book", 16,760); gui.hide(); gui.addTitle("Image Crop").setNewColumn(true); gui.addToggle("EDIT IMAGE",bQuadImageEdit); gui.addToggle("Loose Dragging",bLooseDrag); gui.addButton("LOAD IMAGE",loadQuadImageBtn); gui.addButton("SAVE IMAGE",saveQuadImageBtn); gui.addTitle("Quad Crop").setNewColumn(true); gui.addToggle("EDIT CROP",bQuadCropperEdit); gui.addButton("LOAD CROP",loadCropBtn); gui.addButton("SAVE CROP",saveCropBtn); gui.addTitle("Magic Book"); gui.addToggle("EDIT BOOK",bDragUIcheckbox); gui.addButton("DEFAULT BOOK", defaultXMLbtn); gui.addButton("LOAD BOOK", loadXMLbtn); gui.addButton("SAVE BOOK", saveXMLbtn); gui.addTitle("View").setNewColumn(true); gui.addToggle("FULLSCREEN", bFullScreencheckbox); gui.addToggle("SHOW CURSOR", bShowCursor); gui.setAlignRight(true); gui.loadFromXML(); if(!bShowCursor) hideCursor(); if(bFullScreencheckbox) ofSetFullscreen(true); }
void runGame() { hideCursor(); initWorld(); unsigned long curtime = ccTimeMilliseconds(); double acctime = 0.0; while(true){ ccEvent event = updateWindow(); if(event.type == CC_EVENT_WINDOW_QUIT){ break; }else if(event.type == CC_EVENT_KEY_DOWN){ handleKeyDownWorld(event.keyCode); }else if(event.type == CC_EVENT_KEY_UP){ handleKeyUpWorld(event.keyCode); } unsigned long newtime = ccTimeMilliseconds(); double frametime = (newtime - curtime) * 0.001; curtime = newtime; if(frametime > FRAME_CAP){ frametime = FRAME_CAP; } acctime += frametime; bool redraw = false; while(acctime >= FRAME_DELTA){ acctime -= FRAME_DELTA; redraw = updateWorld(); } if(redraw){ renderWorld(2, 1, getWidth() - getGuiWidth() - 3, getHeight() - 8); renderGui(getWidth() - getGuiWidth(), 0); } renderWindow(2); } }
void SimplePuzzleApp::keyDown( KeyEvent event ) { switch ( event.getCode() ) { case KeyEvent::KEY_f: if ( !isFullScreen() ) { setFullScreen( true ); hideCursor(); } else { setFullScreen( false ); showCursor(); } break; default: break; } }
MediaWidget::MediaWidget(MediaSource &source, QWidget &parent) : QObject(&parent) , blitterContainer_(new BlitterContainer(&parent)) , audioEngines_(makeAudioEngines(parent.winId())) , blitters_(makeBlitterWidgets(VideoBufferLocker(vbmut_), DwmControlHwndChange(dwmControl_))) , fullModeToggler_(getFullModeToggler(parent.winId())) , workerCallback_(new WorkerCallback(*this)) , worker_(new MediaWorker(source, *audioEngines_.back(), 48000, 100, 1, *workerCallback_, this)) , frameRateControl_(*worker_, blitters_.back()) , cursorTimer_(new QTimer(this)) , jsTimer_(new QTimer(this)) , dwmControl_(blitters_.get()) , focusPauseBit_(0) , running_(false) { for (auto_vector<BlitterWidget>::const_iterator it = blitters_.begin(); it != blitters_.end(); ++it) { (*it)->setVisible(false); (*it)->setParent(blitterContainer_); } worker_->setSamplesPerFrame(Rational(48000 / 60)); blitterContainer_->setBlitter(blitters_.back()); blitterContainer_->blitter()->setPaused(false); blitterContainer_->setMinimumSize(QSize(320, 240)); blitterContainer_->setSourceSize(QSize(320, 240)); blitterContainer_->setAspectRatio(QSize(320, 240)); connect(fullModeToggler_.get(), SIGNAL(rateChange(int)), this, SLOT(refreshRateChange(int))); fullModeToggler_->emitRate(); cursorTimer_->setSingleShot(true); cursorTimer_->setInterval(2000); connect(cursorTimer_, SIGNAL(timeout()), this, SLOT(hideCursor())); jsTimer_->setInterval(200); connect(jsTimer_, SIGNAL(timeout()), this, SLOT(updateJoysticks())); dwmControl_.setDwmTripleBuffer(true); }
bool KoCursorPrivateAutoHideEventFilter::eventFilter( QObject *o, QEvent *e ) { Q_UNUSED(o); // o is m_widget or its viewport //Q_ASSERT( o == m_widget ); switch ( e->type() ) { case QEvent::Leave: case QEvent::FocusOut: case QEvent::WindowDeactivate: unhideCursor(); break; case QEvent::KeyPress: case QEvent::ShortcutOverride: hideCursor(); break; case QEvent::Enter: case QEvent::FocusIn: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::MouseMove: case QEvent::Show: case QEvent::Hide: case QEvent::Wheel: unhideCursor(); if ( m_widget->hasFocus() ) { m_autoHideTimer.setSingleShot( true ); m_autoHideTimer.start( KoCursorPrivate::self()->hideCursorDelay ); } break; default: break; } return false; }
int main(int argc, char* argv[]) { SDL_Event e; // Un eveniment care s-a intamplat. Folosit pentru a detecta inchiderea programului char quit; Mix_Music *backgroundMusic; int option; if(!init()) { // Daca nu s-a petrecut nici o eroare la initializare quit = 0; hideCursor(); // Cursorul dispare //system("color 37"); // Seteaza culoarea de fundal fillBackgroundCollor(BG_CYAN + WHITE); if(!DEBUG) { putStr((getConsoleWidth() - 13) / 2, getConsoleHeight() / 2, "Se incarca..."); Sleep(2500); putStr((getConsoleWidth() - 10) / 2, getConsoleHeight() / 2 + 1, "Degeaba..."); Sleep(500); } clearScreen(); backgroundMusic = Mix_LoadMUS(BACKGROUND_MUSIC_PATH); if(backgroundMusic == NULL) error("Nu s-a putut accesa fisierul cu melodia de fundal."); else Mix_PlayMusic(backgroundMusic, -1); option = buildMenu(); if(option == 2) quit = 1; while(!quit) { while(SDL_PollEvent(&e) != 0) { if(e.type == SDL_QUIT) quit = 1; } if(getKey(VK_ESCAPE)) quit = 1; Sleep(SLEEPCONST); } freeData(); } return 0; }