void update_input() { while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_KEYDOWN: handleKeyPress(&event.key.keysym); break; case SDL_MOUSEMOTION: handleMouseMove(&event.motion); break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: handleMousePress(); break; case SDL_QUIT: done = TRUE; break; default: break; } } handleKeyDown(); if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)) mouse_left(); if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)) mouse_right(); }
/** * @brief Creates a status bar in the map view. * * The status bar is not made with Qt designer because * one cannot create QStatusBar widgets with Qt designer. */ void MapEditor::build_status_bar() { status_bar = new QStatusBar(); ui.entity_creation_layout->addWidget(status_bar); connect(ui.map_view, SIGNAL(mouse_map_coordinates_changed(QPoint)), this, SLOT(update_status_bar())); connect(ui.map_view, SIGNAL(mouse_left()), this, SLOT(update_status_bar())); }
main() { char textbuff[22]={0}; int i=0; char ch; initGraph(); /*resetmouse(); showmouse();*/ UI(); while(!kbhit()) { ch=mouse_left(); if(ch!='\0') { textbuff[i++]=ch; massage(textbuff); } } endGraph(); }
void mouseevent::leaveEvent(QEvent *) { emit mouse_left(); }