Esempio n. 1
0
void 
AreaSelect::disableSelection()
{
  // stop all the timer 
  killTimers();
  if (showedSF) {
    drawFrame(); // to erase the frame
  }
}
void GLSideCameraView::paintGL()
{
    // Clean the color of the screen.
    glClear( GL_COLOR_BUFFER_BIT );
    glPushMatrix();
    drawFrame();
    glScalef( 0.5, 0.5, 0.0 );
    glPopMatrix();
 }
Esempio n. 3
0
// TODO: Track and display TPS in GUI.
void GuiManager::runCurrentMatch() {
  interrupted_ = false;
  restarting_ = false;
  runnerConsole_->Hide();
  destroyResultsDialog();
  sf::RenderWindow *window = window_;
  try {
    while (window->isOpen() && !interrupted_ && !restarting_ && !quitting_) {
      while (!paused_ && !restarting_ && !engine_->isGameOver()
          && engine_->getGameTime() < nextDrawTime_) {
        engine_->processTick();
      }
      
      while (!interrupted_ && !restarting_ && !quitting_
             && (nextDrawTime_ <= engine_->getGameTime()
                 || engine_->isGameOver())) {
        processMainWindowEvents(window, gfxManager_, viewWidth_, viewHeight_);
        clearTeamErroredForActiveConsoles(engine_);
        drawFrame(window);
        if (!paused_ && !engine_->isGameOver()) {
          nextDrawTime_ += tpsFactor_;
        }
        if (engine_->isGameOver() && !showedResults_) {
          ReplayBuilder *replayBuilder = engine_->getReplayBuilder();
          Team **teams = engine_->getRankedTeams();
          replayBuilder->setResults(teams, engine_->getNumTeams());
          delete teams;
          showResults(replayBuilder);
          showedResults_ = true;
        }
      }
    }
  } catch (EngineException *e) {
    errorConsole_->println(e->what());
    wxMessageDialog errorMessage(NULL, e->what(),
        "BerryBots encountered an error", wxOK | wxICON_EXCLAMATION);
    errorMessage.ShowModal();
    newMatchDialog_->Show();
    delete e;
    return;
  }

  if (!window->isOpen()) {
    listener_->onAllWindowsClosed();
  }

  // TODO: Display CPU usage in GUI

  if (!interrupted_) {
    gfxManager_->destroyBbGfx();
    delete engine_;
    engine_ = 0;
    delete gfxHandler_;
    gfxHandler_ = 0;
  }
}
Esempio n. 4
0
reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect &rect, const Common::String &text, const int16 foreColor, const int16 backColor, const GuiResourceId fontId, const int16 skipColor, const int16 borderColor, const bool dimmed, const bool gc) {
	_borderColor = borderColor;
	_text = text;
	_textRect = rect;
	_foreColor = foreColor;
	_dimmed = dimmed;

	setFont(fontId);

	int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
	int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;

	mulinc(_textRect, Ratio(_xResolution, scriptWidth), Ratio(_yResolution, scriptHeight));

	CelObjView view(celInfo.resourceId, celInfo.loopNo, celInfo.celNo);
	_skipColor = view._skipColor;
	_width = view._width * _xResolution / view._xResolution;
	_height = view._height * _yResolution / view._yResolution;

	Common::Rect bitmapRect(_width, _height);
	if (_textRect.intersects(bitmapRect)) {
		_textRect.clip(bitmapRect);
	} else {
		_textRect = Common::Rect();
	}

	SciBitmap &bitmap = *_segMan->allocateBitmap(&_bitmap, _width, _height, _skipColor, 0, 0, _xResolution, _yResolution, 0, false, gc);

	// NOTE: The engine filled the bitmap pixels with 11 here, which is silly
	// because then it just erased the bitmap using the skip color. So we don't
	// fill the bitmap redundantly here.

	_backColor = _skipColor;
	erase(bitmapRect, false);
	_backColor = backColor;

	view.draw(bitmap.getBuffer(), bitmapRect, Common::Point(0, 0), false, Ratio(_xResolution, view._xResolution), Ratio(_yResolution, view._yResolution));

	if (_backColor != skipColor && _foreColor != skipColor) {
		erase(_textRect, false);
	}

	if (text.size() > 0) {
		if (_foreColor == skipColor) {
			error("TODO: Implement transparent text");
		} else {
			if (borderColor != -1) {
				drawFrame(bitmapRect, 1, _borderColor, false);
			}

			drawTextBox();
		}
	}

	return _bitmap;
}
Esempio n. 5
0
void QLCDNumber::paintEvent(QPaintEvent *)
{
    Q_D(QLCDNumber);
    QPainter p(this);
    drawFrame(&p);
    if (d->smallPoint)
        d->drawString(d->digitStr, p, &d->points, false);
    else
        d->drawString(d->digitStr, p, 0, false);
}
Esempio n. 6
0
void QgsComposerItemGroup::paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget )
{
  Q_UNUSED( option );
  Q_UNUSED( widget );
  drawFrame( painter );
  if ( isSelected() )
  {
    drawSelectionBoxes( painter );
  }
}
Esempio n. 7
0
void Game::RL()
{
    Ptime = Ctime;
    Ctime = SDL_GetTicks();
    deltatime = Ctime - Ptime;
   if (deltatime > 0.15)
    {deltatime = 0.15;}
        composeFrame();
        drawFrame();
}
Esempio n. 8
0
void Digit::paintStatic()
{
    QPainter painter(this);
    painter.fillRect(rect(), Qt::black);
    //Fill the widget rec with black color

    int pad = width() / 10;
    drawFrame(&painter, rect().adjusted(pad, pad, -pad, -pad));
    painter.drawPixmap(0, 0, m_pixmap);
}
void DataRecorderView::draw(QPainter * p)
{
	drawFrame(p);
	
	QFont newFont(QString::fromLatin1("helvetica"),10);
	p->setFont(newFont);
	p->drawText(getDrawingPlace(), AlignCenter, QString::fromLatin1("Data\nRec"));

	CompView::draw(p);
}
Esempio n. 10
0
void WindowManager::init_gameLog(bool firstTime)
{	if (firstTime)
		gameLog = newwin(10,101,27,1);
	else {
		wresize(gameLog,10,101);
		wclear(gameLog);
	}
	drawFrame(26,0,37,102);
	scrollok(gameLog,TRUE);
}
Esempio n. 11
0
void GfxMgr::drawBox(int x1, int y1, int x2, int y2, int color1, int color2, int m) {
	x1 += m;
	y1 += m;
	x2 -= m;
	y2 -= m;

	drawRectangle(x1, y1, x2, y2, color1);
	drawFrame(x1 + 2, y1 + 2, x2 - 2, y2 - 2, color2, color2);
	flushBlock(x1, y1, x2, y2);
}
Esempio n. 12
0
void cInterface:: disMnuHed(char* hed)
	{
	 drawFrame(right,bottom);
	 fillData(right);
	 disTime(right);
	 moveto(300,72);
	 settextstyle(7,0,3);
	 settextjustify(1,1);
	 setcolor(10);
	 outtext(hed);
	}
Esempio n. 13
0
void GameOver(Display *d, int *in)
{
  do{
    splashPhoto(d,GOVER_SCREEN);
    drawString(d, fontdata, (char*)"PRESS SPACE TO PLAY AGAIN", 350, 540, white,1);
    drawString(d, fontdata, (char*)"OR ESC TO QUIT", 350, 580, warning,0);
    drawFrame(d,REFRESH_RATE);
    *in=input(d);
  }while(in==0);

}
Esempio n. 14
0
/* Game play loop */
void  loop(){
  
  if (continueGame){                                                      // If the game is still in play
    drawFrame();                                                          // Draw the frame
    drawScore();                                                          // Draw the score
    movePaddle();                                                         // Update the location of the paddle
    boolean paddleCollision = checkPaddleCollision();                     // Determine if the ball has hit the paddle or block
    boolean blockCollision = checkBlockCollision();
    if(score == numBlocks)                                                // If the score is equivalent to the number of blocks, game is over
      winner();                                                           // Display message to user
    else{                                                                 // The game is still in play
      if(paddleCollision || blockCollision)                               // Redraw screen to draw over any collisions
        drawFrame();
      delay(50);                                                          // Slight delay
      continueGame = updatePos();                                         // Update the position of the ball
    }
  }
  else                                                                    // The game is over, the ball fell off the screen. Display message to user.
    gameOver();
}
Esempio n. 15
0
///
/// reimplemented functions
///
void MemChartPrivate::paintEvent(QPaintEvent *e)
{

    QPainter painter(this);
    drawBackground(&painter);
    drawCaption(&painter);
    drawFrame(&painter);
    drawLegend(&painter);
    drawHistogram(&painter);
    drawSelectedRegion(&painter);
}
Esempio n. 16
0
reg_t GfxText32::createFontBitmap(int16 width, int16 height, const Common::Rect &rect, const Common::String &text, const uint8 foreColor, const uint8 backColor, const uint8 skipColor, const GuiResourceId fontId, const TextAlign alignment, const int16 borderColor, const bool dimmed, const bool doScaling, reg_t *outBitmapObject) {

	_field_22 = 0;
	_borderColor = borderColor;
	_text = text;
	_textRect = rect;
	_width = width;
	_height = height;
	_foreColor = foreColor;
	_backColor = backColor;
	_skipColor = skipColor;
	_alignment = alignment;
	_dimmed = dimmed;

	setFont(fontId);

	if (doScaling) {
		int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
		int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight;

		Ratio scaleX(_scaledWidth, scriptWidth);
		Ratio scaleY(_scaledHeight, scriptHeight);

		_width = (_width * scaleX).toInt();
		_height = (_height * scaleY).toInt();
		mulinc(_textRect, scaleX, scaleY);
	}

	// _textRect represents where text is drawn inside the
	// bitmap; clipRect is the entire bitmap
	Common::Rect bitmapRect(_width, _height);

	if (_textRect.intersects(bitmapRect)) {
		_textRect.clip(bitmapRect);
	} else {
		_textRect = Common::Rect();
	}

	_bitmap = _segMan->allocateHunkEntry("FontBitmap()", _width * _height + BITMAP_HEADER_SIZE);

	byte *bitmap = _segMan->getHunkPointer(_bitmap);
	buildBitmapHeader(bitmap, _width, _height, _skipColor, 0, 0, _scaledWidth, _scaledHeight, 0, false);

	erase(bitmapRect, false);

	if (_borderColor > -1) {
		drawFrame(bitmapRect, 1, _borderColor, false);
	}

	drawTextBox();

	*outBitmapObject = _bitmap;
	return _bitmap;
}
void QgsComposerPicture::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
{
  if ( !painter )
  {
    return;
  }

  if ( mMode == SVG )
  {
    int newDpi = ( painter->device()->logicalDpiX() + painter->device()->logicalDpiY() ) / 2;
    if ( newDpi != mCachedDpi )
    {
      mSvgCacheUpToDate = false;
      mCachedDpi = newDpi;
      mImage = QImage( rect().width() * newDpi / 25.4, rect().height() * newDpi / 25.4, QImage::Format_ARGB32 );
    }

    if ( !mSvgCacheUpToDate )
    {
      updateImageFromSvg();
    }
  }

  painter->save();
  painter->rotate( mRotation );
  drawBackground( painter );

  if ( mMode != Unknown )
  {
    double widthRatio = mImage.width() / rect().width();
    double heightRatio = mImage.height() / rect().height();
    double targetWidth, targetHeight;
    if ( widthRatio > heightRatio )
    {
      targetWidth = rect().width();
      targetHeight = mImage.height() / widthRatio;
    }
    else
    {
      targetHeight = rect().height();
      targetWidth = mImage.width() / heightRatio;
    }
    painter->drawImage( QRectF( 0, 0, targetWidth, targetHeight ), mImage, QRectF( 0, 0, mImage.width(), mImage.height() ) );
  }

  //frame and selection boxes
  drawFrame( painter );
  if ( isSelected() )
  {
    drawSelectionBoxes( painter );
  }

  painter->restore();
}
Esempio n. 18
0
bool UiEditorPanel::init()
{
	auto winSize = CCDirector::sharedDirector()->getWinSize();
	setContentSize(winSize);

	drawFrame();
	addChild(UiEditorBtnsPanel::create());
	addChild(UiEditorAttrsPanel::create());
	//scheduleUpdate();
	return true;
}
Esempio n. 19
0
void ZoneScene::draw()
{
    Zone *zone = m_game->zone();
    vec4 clearColor = zone ? zone->info().fogColor : vec4(0.4, 0.4, 0.6, 0.1);
    if(m_renderCtx->beginFrame(clearColor))
    {
        clearLog();
        drawFrame();
    }
    m_renderCtx->endFrame();
}
Esempio n. 20
0
void QgsComposerLabel::paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget )
{
  Q_UNUSED( itemStyle );
  Q_UNUSED( pWidget );
  if ( !painter )
  {
    return;
  }
  if ( !shouldDrawItem() )
  {
    return;
  }

  drawBackground( painter );
  painter->save();

  //antialiasing on
  painter->setRenderHint( QPainter::Antialiasing, true );

  double penWidth = hasFrame() ? ( pen().widthF() / 2.0 ) : 0;
  double xPenAdjust = mMarginX < 0 ? -penWidth : penWidth;
  double yPenAdjust = mMarginY < 0 ? -penWidth : penWidth;
  QRectF painterRect( xPenAdjust + mMarginX, yPenAdjust + mMarginY, rect().width() - 2 * xPenAdjust - 2 * mMarginX, rect().height() - 2 * yPenAdjust - 2 * mMarginY );

  if ( mHtmlState )
  {
    if ( mFirstRender )
    {
      contentChanged();
      mFirstRender = false;
    }
    painter->scale( 1.0 / mHtmlUnitsToMM / 10.0, 1.0 / mHtmlUnitsToMM / 10.0 );
    mWebPage->setViewportSize( QSize( painterRect.width() * mHtmlUnitsToMM * 10.0, painterRect.height() * mHtmlUnitsToMM * 10.0 ) );
    mWebPage->settings()->setUserStyleSheetUrl( createStylesheetUrl() );
    mWebPage->mainFrame()->render( painter );
  }
  else
  {
    const QString textToDraw = displayText();
    painter->setFont( mFont );
    //debug
    //painter->setPen( QColor( Qt::red ) );
    //painter->drawRect( painterRect );
    QgsComposerUtils::drawText( painter, painterRect, textToDraw, mFont, mFontColor, mHAlignment, mVAlignment, Qt::TextWordWrap );
  }

  painter->restore();

  drawFrame( painter );
  if ( isSelected() )
  {
    drawSelectionBoxes( painter );
  }
}
Esempio n. 21
0
void WindowManager::init_debugLog(bool firstTime)
{
	if (firstTime)
		debugLog = newwin(10,101,39,1);
	else {
		wresize(debugLog,10,101);
		wclear(debugLog);
	}
	drawFrame(38,0,49,102);
	scrollok(debugLog,TRUE);
}
Esempio n. 22
0
void QgsComposerPicture::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
{
  Q_UNUSED( itemStyle );
  Q_UNUSED( pWidget );
  if ( !painter )
  {
    return;
  }

  drawBackground( painter );

  int newDpi = ( painter->device()->logicalDpiX() + painter->device()->logicalDpiY() ) / 2;

  if ( mMode != Unknown )
  {
    double rectPixelWidth = /*rect().width()*/mPictureWidth * newDpi / 25.4;
    double rectPixelHeight = /*rect().height()*/ mPictureHeight * newDpi / 25.4;
    QRectF boundRect;
    if ( mMode == SVG )
    {
      boundRect = boundedSVGRect( rectPixelWidth, rectPixelHeight );
    }
    else if ( mMode == RASTER )
    {
      boundRect = boundedImageRect( rectPixelWidth, rectPixelHeight );
    }

    double boundRectWidthMM = boundRect.width() / newDpi * 25.4;
    double boundRectHeightMM = boundRect.height() / newDpi * 25.4;

    painter->save();
    painter->translate( rect().width() / 2.0, rect().height() / 2.0 );
    painter->rotate( mRotation );
    painter->translate( -boundRectWidthMM / 2.0, -boundRectHeightMM / 2.0 );

    if ( mMode == SVG )
    {
      mSVG.render( painter, QRectF( 0, 0, boundRectWidthMM,  boundRectHeightMM ) );
    }
    else if ( mMode == RASTER )
    {
      painter->drawImage( QRectF( 0, 0, boundRectWidthMM,  boundRectHeightMM ), mImage, QRectF( 0, 0, mImage.width(), mImage.height() ) );
    }

    painter->restore();
  }

  //frame and selection boxes
  drawFrame( painter );
  if ( isSelected() )
  {
    drawSelectionBoxes( painter );
  }
}
Esempio n. 23
0
void WindowManager::init_title(bool firstTime)
{

	if (firstTime)
		title = newwin(1,101,1,1);
	else {
		wresize(title,1,101);
		wclear(title);
	}
	drawFrame(0,0,2,102);
	mvwprintw(title,0,41,"chiasmus");
}
Esempio n. 24
0
 void Animation::run()
 {
     init();
     //~ while(started < 2) taskYIELD();
     for (;;)
     {
         timeUpdate();
         display->clear();
         drawFrame();
         display->flush();
     }
 }
void LegendWidget::paintEvent(QPaintEvent *e)
{
	const int symbolLineLength = line_length + symbolsMaxWidth();
	int width, height, textWidth, textHeight;
	QwtArray<long> heights = itemsHeight(symbolLineLength, width, height, textWidth, textHeight);
    resize(width, height);

    QPainter p(this);
	drawFrame(&p, rect());
	drawText(&p, QRect(0, 0, textWidth, textHeight), heights, symbolLineLength);
	e->accept();
}
Esempio n. 26
0
void PerfMon::paintEvent(QPaintEvent *e)
{
    Q_UNUSED(e);
    QPainter painter(this);

    drawBackground(&painter);
    drawFrame(&painter);
    drawGraph(&painter);

    painter.end();

}
void LegendWidget::print(QPainter *painter, const QwtScaleMap map[QwtPlot::axisCnt])
{
	int x = map[QwtPlot::xBottom].transform(calculateXValue());
	int y = map[QwtPlot::yLeft].transform(calculateYValue());

    const int symbolLineLength = line_length + symbolsMaxWidth();
	int width, height, textWidth, textHeight;
	QwtArray<long> heights = itemsHeight(symbolLineLength, width, height, textWidth, textHeight);
	
	drawFrame(painter, QRect(x, y, width, height));
	drawText(painter, QRect(x, y, textWidth, textHeight), heights, symbolLineLength);
}
Esempio n. 28
0
void QGroupBox::paintEvent( QPaintEvent *event )
{
    QPainter paint( this );

    if ( lenvisible && !isCheckable() ) {	// draw title
        QFontMetrics fm = paint.fontMetrics();
        int h = fm.height();
        int tw = fm.width( str, lenvisible ) + fm.width(QChar(' '));
        int x;
        int marg = bFlat ? 0 : 8;
        if ( align & AlignHCenter )		// center alignment
            x = frameRect().width()/2 - tw/2;
        else if ( align & AlignRight )	// right alignment
            x = frameRect().width() - tw - marg;
        else if ( align & AlignLeft )		 // left alignment
            x = marg;
        else { // auto align
            if( QApplication::reverseLayout() )
                x = frameRect().width() - tw - marg;
            else
                x = marg;
        }
        QRect r( x, 0, tw, h );
        int va = style().styleHint(QStyle::SH_GroupBox_TextLabelVerticalAlignment, this);
        if(va & AlignTop)
            r.moveBy(0, fm.descent());
        QColor pen( (QRgb) style().styleHint(QStyle::SH_GroupBox_TextLabelColor, this )  );
        if (!style().styleHint(QStyle::SH_UnderlineAccelerator, this))
            va |= NoAccel;
        style().drawItem( &paint, r, ShowPrefix | AlignHCenter | va, colorGroup(),
                          isEnabled(), 0, str, -1, ownPalette() ? 0 : &pen );
        paint.setClipRegion( event->region().subtract( r ) ); // clip everything but title
#ifndef QT_NO_CHECKBOX
    } else if ( d->checkbox ) {
        QRect cbClip = d->checkbox->geometry();
        QFontMetrics fm = paint.fontMetrics();
        cbClip.setX( cbClip.x() - fm.width(QChar(' ')) );
        cbClip.setWidth( cbClip.width() + fm.width(QChar(' ')) );
        paint.setClipRegion( event->region().subtract( cbClip ) );
#endif
    }
    if ( bFlat ) {
        QRect fr = frameRect();
        QPoint p1( fr.x(), fr.y() + 1 );
        QPoint p2( fr.x() + fr.width(), p1.y() );
        // ### This should probably be a style primitive.
        qDrawShadeLine( &paint, p1, p2, colorGroup(), TRUE,
                        lineWidth(), midLineWidth() );
    } else {
        drawFrame(&paint);
    }
    drawContents( &paint );			// draw the contents
}
Esempio n. 29
0
void SimpleSimulator::run() {
	running=true;
	while (running) {
		currentTime = TUIO::TuioTime::getSessionTime();
		tuioServer->initFrame(currentTime);
		processEvents();
		tuioServer->stopUntouchedMovingCursors();
		tuioServer->commitFrame();
		drawFrame();
		SDL_Delay(20);
	} 
}
Esempio n. 30
0
    /**
     * Draw a container and all its subcomponent
     * Adjust coordinates with his position
     */
    void Container::draw(Painter & painter)
    {
        painter.setBrushColor(::Color::white);
        if(draw_frame)
            drawFrame(painter);
        painter.pushTransform(area.min);

        std::list<Component *>::iterator i;
        for(i = components.begin(); i != components.end(); i++)
            (*i)->draw(painter);
        painter.popTransform();
    }