本文整理汇总了C++中drawCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ drawCursor函数的具体用法?C++ drawCursor怎么用?C++ drawCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawCursor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ofTranslate
//--------------------------------------------------------------
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);
}
}
示例2: drawNewFolder
//--------------------------------------------------------------
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);
}
}
示例3: shape
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();
}
示例4: glBindTexture
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();
}
示例5: displayPreGame
void displayPreGame() {
glLoadIdentity();
drawPreGameBack();
drawText();
drawCursor();
curtain.drawCurtain();
}
示例6: ofPushStyle
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();
}
示例7: drawCells
void drawCells() {
uchar x,y;
for(y=0; y<9; y++)
for(x=0; x<9; x++)
drawCell(x,y);
drawCursor();
}
示例8: drawGraphics
// 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);
}
示例9: drawGame
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);
}
}
示例10: render
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);
}
}
示例11: drawPuzzle
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);
}
}
示例12: gameStep
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();
}
示例13: drawStatusLine
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); }
}
示例14: while
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.");
}
示例15: drawCursor
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();
}