//-------------------------------------------------------------- void ofxFileDialog::drawNewFolder() { bool drawnCursor = false; int x = 0, y = s_charHeight; s_font->setColor(m_settings->getTextColor(), m_settings->getAlpha()); s_font->setShadowColor(m_settings->getTextShadowColor(), m_settings->getAlpha()); ofTranslate(0, m_visibleLines*0.5*s_charHeight); // info text s_font->drawString(s_newFolderText, x, y, s_textShadow); // new folder name with cursor y += s_charHeight*2; for(unsigned int i = 0; i < m_text.size(); ++i) { // draw cursor if(m_saveAsState == FILENAME && i == m_position) { drawCursor(x, y); drawnCursor = true; } // text x = s_font->drawCharacter(m_text[i], x, y, s_textShadow); } // draw cursor if we have no text, or if we're at the end of the buffer if(!drawnCursor) { drawCursor(x, y); } }
// we swallow the draw frames mouse moves and process here void Editor::drawFrameMouseMovedEvent( QMouseEvent* e ){ POSITION mPos; transformPointToPosition(e->pos(), mPos, (mode == remove)); if ((mPos.x==currPos.x) && (mPos.y==currPos.y) && (mPos.e==currPos.e)) return; currPos = mPos; statusChanged(); switch(mode) { case insert: { POSITION next; next = currPos; if (next.e == 100) next.e = 0; else next.e += 1; drawCursor(next, canInsert(next)); break; } case remove: drawCursor(currPos, 1); break; case move: break; } }
//-------------------------------------------------------------- void ofxFileDialog::drawSaveAs() { bool drawnCursor = false; int x = 0, y = s_charHeight; s_font->setColor(m_settings->getTextColor(), m_settings->getAlpha()); s_font->setShadowColor(m_settings->getTextShadowColor(), m_settings->getAlpha()); if(m_saveAsState == FOLDER_DIALOG) { drawNewFolder(); } else { ofPushMatrix(); ofTranslate(0, s_charHeight*2); // info text s_font->drawString(s_saveAsText, x, y, s_textShadow); // new file name with cursor y += s_charHeight*2; for(unsigned int i = 0; i < m_text.size(); ++i) { // draw cursor if(m_saveAsState == FILENAME && i == m_position) { drawCursor(x, y); drawnCursor = true; } // text x = s_font->drawCharacter(m_text[i], x, y, s_textShadow); } // draw cursor if we have no text, or if we're at the end of the buffer if(m_saveAsState == FILENAME && !drawnCursor) { drawCursor(x, y); } drawFilenames(5, 2, m_saveAsState == BROWSER); ofPopMatrix(); y = m_height-s_charHeight; if(m_saveAsState == FOLDER) { int width = s_font->stringWidth(s_newFolderButtonText); ofSetColor(m_settings->getCursorColor().r, m_settings->getCursorColor().g, m_settings->getCursorColor().b, m_settings->getCursorColor().a * m_settings->getAlpha()); ofRectMode rectMode = ofGetRectMode(); ofSetRectMode(OF_RECTMODE_CORNER); ofDrawRectangle(x, y-s_charWidth, width, s_charHeight); ofSetRectMode(rectMode); } s_font->drawString(s_newFolderButtonText, 0, y, s_textShadow); } }
void UBGraphicsCompass::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { if (UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Selector && UBDrawingController::drawingController ()->stylusTool() != UBStylusTool::Play) return; mShowButtons = shape().contains(event->pos()); mCloseSvgItem->setVisible(mShowButtons); mResizeSvgItem->setVisible(mShowButtons); if (mShowButtons) { if (hingeRect().contains(event->pos())) setCursor(rotateCursor()); else if (event->pos().x() > rect().right() - sPencilLength - sPencilBaseLength) setCursor(drawCursor()); else if (resizeButtonRect().contains(event->pos())) setCursor(resizeCursor()); else if (closeButtonRect().contains(event->pos())) setCursor(closeCursor()); else setCursor(moveCursor()); } else { setCursor(mOuterCursor); } event->accept(); update(); }
void TextBox::redrawSelf() { if (!keyFocus) isHighlighted = false; glBindTexture(GL_TEXTURE_2D, 0); glColor4ub(30, 30, 30, 100); glBegin(GL_QUADS); glVertex2f(x, y); glVertex2f(x+width, y); glVertex2f(x+width, y+height); glVertex2f(x, y+height); glEnd(); if (isHighlighted) drawHighlight(); drawOutline(); screenPrintf(x, y, *textParams, text.c_str()); if (keyFocus) drawCursor(); }
void displayPreGame() { glLoadIdentity(); drawPreGameBack(); drawText(); drawCursor(); curtain.drawCurtain(); }
void mgsCooperSymbols::drawGrid(float x, float y) { ofPushStyle(); clearCell(shiftCounter-1,rowCounter,gw+2,gh); drawCursor(); ofSetColor(symbolColor); ofNoFill(); if(randomStrokeP) randomStroke(); if (!singleShapesP) { switch((int)ofRandom(1, numberOfShapes+1)) { case 1: drawSquare(x+shiftCounter, y+rowCounter, gw); break; case 2: drawTri(x+shiftCounter, y+rowCounter, gw); break; case 3: drawCircle(x+shiftCounter+gw/2, y+rowCounter+gh/2, gw/2); break; } } else { switch(numberOfShapes) { case 1: drawSquare(x+shiftCounter, y+rowCounter, gw); break; case 2: drawTri(x+shiftCounter, y+rowCounter, gw); break; case 3: drawCircle(x+shiftCounter+gw/2, y+rowCounter+gw/2, gw/2); break; } } ofPopStyle(); }
void drawCells() { uchar x,y; for(y=0; y<9; y++) for(x=0; x<9; x++) drawCell(x,y); drawCursor(); }
// Draw the cursor and the cube. In a real application, // this function would be much more complex. void drawGraphics() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); drawCursor(); glutSolidCube(gCubeEdgeLength); }
void drawGame(void) { if (state == STATE_LEAVE) return; if (isInvalid) { arduboy.clear(); if (state == STATE_ISSUES) { drawIssues(); } else if (state == STATE_RESULT) { drawResult(); } else { drawField(); if (state == STATE_PLAYING) { drawStrings(); drawCursor(); } if (blinkFrameFrames > 0 && blinkFlg) arduboy.drawRect(0, 0, WIDTH, HEIGHT, WHITE); } isInvalid = false; } if (state == STATE_MENU || state == STATE_RESULT) { drawMenuItems(false); arduboy.setRGBled(0, 0, 0); } else { if (state == STATE_OVER) drawOverAnimation(); arduboy.setRGBled(ledRGB[0] * vanishFlashFrames, ledRGB[1] * vanishFlashFrames, ledRGB[2] * vanishFlashFrames); } }
void render() { if (NULL != pd3dDevice) { pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); pd3dDevice->BeginScene(); // create the camera createCamera(0.1f, 10.0f); // near clip plane, far clip plane // Position camera so cube is same projected size as in OpenGL version moveCamera(D3DXVECTOR3(0.0f, 0.0f, -1.6f)); pointCamera(D3DXVECTOR3(0.0f, 0.0f, 0.0f)); // draw the objects drawCube(); drawCursor(); pd3dDevice->EndScene(); pd3dDevice->Present(NULL, NULL, NULL, NULL); } }
void UrlBar::drawUrlBar() { XClearWindow(m_display, m_window); drawBackground(); drawText(); drawCursor(); }
void drawPuzzle(void) { bool isPlaying = (state == STATE_FREE || state == STATE_PICKED); if (toDrawAll) { arduboy.clear(); drawBoard(0); drawPieces(); toDrawAll = false; } else if (isPlaying && focusPieceIdx >= 0) { drawPiece(focusPieceIdx); } if (state == STATE_FREE) { drawCursor(); } if (state == STATE_CLEAR) { drawClearEffect(); } if (isHelpVisible && isPlaying) { HELP_T idx; if (state == STATE_FREE) { idx = HELP_FREE; } else { idx = (arduboy.buttonPressed(A_BUTTON)) ? HELP_HOLD : HELP_PICK; } drawHelp(idx, helpX, helpY); } }
void gameStep() { uchar nx1,ny1,nx2,ny2,o; // Ищем готовые линии if(!check()) { // Добавляем три шарика newBall(newBall1); nx1=nx; ny1=ny; newBall(newBall2); nx2=nx; ny2=ny; newBall(newBall3); // Рисуем анимацию for(o=0; o<5; o++) { if(nx1!=-1) drawSpriteNew(nx1, ny1, newBall1, o); if(nx2!=-1) drawSpriteNew(nx2, ny2, newBall2, o); if(nx !=-1) drawSpriteNew(nx, ny, newBall3, o); delay(ANIMATION_SPEED); } // Загадываем три новых шарика randNewBall(); redrawNewBalls1(); if(!gameOver) { // Ищем готовые линии check(); // Считаем кол во свободных клеток if(calcFreeCell()==0) gameOver=1; } } drawCursor(); }
void TextEdit::onExpose(XEvent& /* event */) { // Draw a status line drawStatusLine(); // Erase a window setForeground(bgColor); fillRectangle(I2Rectangle(0, topMargin - statusLineMargin, m_IWinRect.width(), m_IWinRect.height())); // Draw a text in a window setForeground(fgColor); int x = leftMargin; int y = topMargin + ascent; for (int screenY = 0; screenY < windowHeight; screenY++, y += dy) { int textY = windowY + screenY; const TextLine* currentLine; if (textY > text.size()) { break; } else if (textY == text.size()) { currentLine = &(endOfText); } else { currentLine = &(text.getLine(textY)); } int len = currentLine->length(); if (len > windowX) { int restrictedLen = len - windowX; if (restrictedLen > windowWidth) restrictedLen = windowWidth; drawString(x, y, currentLine->getString() + windowX, restrictedLen); } } // Draw cursor if (!inputDisabled) { drawCursor(cursorX, cursorY, true); } }
void BleWindowsCaptureSource::run() { // TODO make could select screen // QGuiApplication::screens(); while (!m_stop) { QElapsedTimer elapsedTimer; elapsedTimer.start(); QScreen *screen = QGuiApplication::primaryScreen(); if (screen) { QPixmap pixmap = screen->grabWindow(m_wid, m_x, m_y, m_width, m_height); #if 1 // TODO to draw cursor to image QRect desktopRect = QRect(QPoint(0, 0), screen->size()); if (desktopRect.contains(QCursor::pos())) { drawCursor(&pixmap); } #endif QImage image = pixmap.toImage(); m_modifyMutex.lock(); // Start lock BleImage be; be.width = image.width(); be.height = image.height(); int imageSize = be.width * be.height * 3; be.data = new char[imageSize]; IplImage *oriImage = cvCreateImageHeader(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 4); cvSetData(oriImage, image.bits(), image.bytesPerLine()); IplImage *dstImage = cvCreateImageHeader(cvSize(image.width(), image.height()), IPL_DEPTH_8U, 3); cvSetData(dstImage, be.data, be.width * 3); cvCvtColor(oriImage, dstImage, CV_BGRA2BGR); be.dataSize = imageSize; be.format = BleImage_Format_BGR24; m_image = be; cvReleaseImageHeader(&oriImage); cvReleaseImageHeader(&dstImage); m_modifyMutex.unlock(); // End unlock } int elapsedMs = elapsedTimer.elapsed(); int needSleepMs = m_interval - elapsedMs; if (needSleepMs < 0) { needSleepMs = 0; } msleep(needSleepMs); } log_trace("BleWindowsCaptureSource exit normally."); }
void eTextInputField::updated() { if ( editLabel ) editLabel->setText(convertDVBUTF8((unsigned char*)isotext.c_str(),isotext.length(), table)); else text=convertDVBUTF8((unsigned char*)isotext.c_str(),isotext.length(), table); drawCursor(); }
void NYView::guiPaintEvent(const YSelection& drawMap) { if(!editor) { // Avoid segfaults and infinite recursion. return ; } YView::guiPaintEvent(drawMap); drawCursor(); }
void eTextInputField::setState(int enable, int cancel) { nextCharTimer.stop(); if (!enable) { editLabel->hide(); if (!cancel) setText(editLabel->getText()); else setText(oldText); delete editLabel; editLabel=0; setHelpText(oldHelpText); while ( text.length() && text[text.length()-1] == ' ' ) text.erase( text.length()-1 ); editMode=false; if (!cancel) /* emit */ selected(); eRCInput::getInstance()->setKeyboardMode(eRCInput::kmNone); eWindow::globalCancel(eWindow::ON); } else { oldText=text; editMode=true; /* emit */ selected(); capslock=0; while(scroll.size()) scroll.pop(); eRect tmp = deco_selected?crect_selected:deco?crect:clientrect; editLabel=new eLabel(this,0,0); editLabel->hide(); editLabel->move(tmp.topLeft()); scroll.push( std::pair<int,int>(0,tmp.width()) ); eSize tmpSize=tmp.size(); tmpSize.setWidth( tmp.width()*5 ); editLabel->resize(tmpSize); editLabel->setText(text.removeChars('\x86'). removeChars('\x87').removeChars('\xC2'). removeChars('\x05')); oldHelpText=helptext; setText(""); editLabel->show(); setHelpText(editHelpText); curPos=0; drawCursor(); eRCInput::getInstance()->setKeyboardMode(eRCInput::kmAscii); eWindow::globalCancel(eWindow::OFF); } }
void UIManager::draw() { setupDisplay(); std::list<pp::Widget*>::iterator it; for(it=widgets.begin();it!=widgets.end();it++){ (*it)->draw(); } drawCursor(); }
/******************************************************************************* The main routine for displaying the scene. Gets the latest snapshot of state from the haptic thread and uses it for displaying a 3D cursor. Draws the anchor visual if the anchor is presently active. *******************************************************************************/ void drawSceneGraphics() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); drawCursor(); drawSphere(); drawTorus(); drawTeapot(); }
void My3DCursor::cc3dDrawInSP(const CGPoint &minus, const float &scale) { refleshBuffer(); for (int n = 0; n < 6; n++) { drawBufferPoint[n] -= minus; drawBufferPoint[n] /= scale; } drawCursor(); }
void NYView::guiSetFocusMainWindow() { if(statusbarHasCommand) { werase(statusbar); wrefresh(statusbar); } m_focus = w_editor; drawCursor(); }
void VisualNavbar::fillData() { graphicsScene->clear(); cursorGraphicsItem = nullptr; // Do not try to draw if no sections are available. if (mappedSegments.length() == 0) { return; } int w = this->graphicsView->width(); int h = this->graphicsView->height(); double width_per_byte = (double)w / (double)totalMappedSize; xToAddress.clear(); double current_x = 0; for (auto mappedSegment : mappedSegments) { RVA segment_size = mappedSegment.address_to - mappedSegment.address_from; double segment_width = (double)segment_size * width_per_byte; QGraphicsRectItem *rect = new QGraphicsRectItem(current_x, 0, segment_width, h); rect->setBrush(QBrush(Config()->getColor("gui.navbar.empty"))); graphicsScene->addItem(rect); drawMetadata(mappedSegment.strings, mappedSegment.address_from, current_x, width_per_byte, h, Config()->getColor("gui.navbar.str")); drawMetadata(mappedSegment.symbols, mappedSegment.address_from, current_x, width_per_byte, h, Config()->getColor("gui.navbar.sym")); drawMetadata(mappedSegment.functions, mappedSegment.address_from, current_x, width_per_byte, h, Config()->getColor("gui.navbar.code")); // Keep track of where which memory segment is mapped so we are able to convert from // address to X coordinate and vice versa. struct xToAddress x2a; x2a.x_start = current_x; x2a.x_end = current_x + segment_width; x2a.address_from = mappedSegment.address_from; x2a.address_to = mappedSegment.address_to; xToAddress.append(x2a); current_x += segment_width; } // Update scene width graphicsScene->setSceneRect(graphicsScene->itemsBoundingRect()); // Draw cursor drawCursor(); }
void InputControllerErase::wheelEvent(QWheelEvent *event) { int d = m_size + ( event->delta() > 0 ? 4 : -4 ); if ( d > 2 && d < m_max_size ) { m_size = d; drawCursor(); QApplication::restoreOverrideCursor(); QApplication::setOverrideCursor(QCursor( *m_cursor, 0, 0 )); } }
/*virtual*/ void RWindow::update() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); SDL_Event e; while(SDL_PollEvent(&e)) { switch(e.type) { case SDL_QUIT: //User requests quit quit = true; break; case SDL_APP_TERMINATING: quit = true; break; case SDL_MOUSEMOTION: if ((m_cursorType & CURSOR_ARROW) == CURSOR_ARROW) if(m_customCursors[0]) m_customCursors[0]->move(e.motion.x, e.motion.y); if ((m_cursorType & CURSOR_IBEAM) == CURSOR_IBEAM) if(m_customCursors[1]) m_customCursors[1]->move(e.motion.x, e.motion.y); if ((m_cursorType & CURSOR_WAIT) == CURSOR_WAIT) if(m_customCursors[2]) m_customCursors[2]->move(e.motion.x, e.motion.y); if ((m_cursorType & CURSOR_HAND) == CURSOR_HAND) if(m_customCursors[3]) m_customCursors[3]->move(e.motion.x, e.motion.y); } callback(e); if(quit) { close(); return; } } for(unsigned i = 0; i < m_widgets.size(); ++i) m_widgets[i]->update(); drawCursor(); SDL_UpdateWindowSurface(m_window); SDL_GL_SwapWindow(m_window); }
/** * Constructor. */ InputControllerErase::InputControllerErase(QObject *parent): InputController(parent), m_max_size(32), m_size(30), m_isButtonPressed(false), m_isActive(false), m_rect( 0, 0, m_size, m_size ) { m_cursor = new QPixmap(m_max_size,m_max_size); drawCursor(); m_image = new QPixmap(":/PickTools/eraser.png"); }
void KisVisualColorSelectorShape::paintEvent(QPaintEvent*) { QPainter painter(this); //check if old and new colors differ. if (m_d->imagesNeedUpdate) { setMask(getMaskMap()); } drawCursor(); painter.drawImage(0,0,m_d->fullSelector); }
/* moves backwards one character, erasing the last one put down */ void backspace(void) { int x, y; if (numChars > 0) { getPositionForCharNumber(numChars, &x, &y); drawBlank(x, y); numChars--; getPositionForCharNumber(numChars, &x, &y); drawBlank(x, y); drawCursor(); } }
void StaticImageColorSource::updateColor() { QImage displayImage(image); drawCursor(displayImage); imageLabel->setPixmap(QPixmap::fromImage(displayImage)); pickColor(image); //Pass the color on emit colorChanged(lastColor); }