Beispiel #1
0
void gameLoop(){
  while(lives>0){
  updateGeese();
  updateBullet();
  updateGun();
  globalHitTest();
  paintFrame();
  updateLED(lives);
  curGeeseSpeed=geeseSpeed[getPot()/2];
  }
}
Beispiel #2
0
void
Frame::paintVideoFinish()
{
	HDC hdc = GetDC(hwnd);	
	RECT rect;
	rect.right  = 0;
	rect.left   = c_width;
	rect.top    = 0;
	rect.bottom = c_height - GetSystemMetrics(SM_CYMENU);
	FillRect(hdc, &rect, (HBRUSH)COLOR_BACKGROUND);
	ReleaseDC(hwnd, hdc);
	paintFrame();
}
Beispiel #3
0
HRESULT
Frame::DoRenderSample(IMediaSample *sample)
{
	if(FRAME_DECODING) { 
		if(debug) printf("Frame::DoRenderSample Cancelling DoRenderSample while FRAME_DECODING\n");
		return S_FALSE;
	}
	FRAME_PROCESSING  = false;
	if(STOP_REQUESTED) return S_FALSE;
	FRAME_PROCESSING  = true;
	data = 0;
	sample->GetPointer( &data );
	processFrame();
	bool newtag = false;
	bool newage = (last_tag_age == decoder->tagAge()) ? false : true ; 
	for(int i=0; i < 15; i++) { if( tag_string[i] != last_tag_string[i] ) newtag = true; }
	paintFrame(newtag, newage);
	for(int i=0; i < 15; i++) last_tag_string[i] = tag_string[i];
	last_tag_age = decoder->tagAge();
	//d_videoAlignmentTest();
	bmi.bmiHeader = bmih;
	HDC hdc = GetDC(hwnd);	
	HRESULT hr;
	SetStretchBltMode(hdc, HALFTONE);
	hr = StretchDIBits(hdc, 
		(c_width-v_display_width)/2, 
		(c_height - GetSystemMetrics(SM_CYMENU) - config->V_MSG_STRIP_SIZE - v_display_height)/2,
		v_display_width, v_display_height,
		0, 0, 
		v_width, v_height,
		data, &bmi, DIB_RGB_COLORS, SRCCOPY);
	ReleaseDC(hwnd, hdc);
	/* OVERLAY TEST
	RECT rect;
	rect.right  = 10;
	rect.left   = 20;
	rect.top    = 5;
	rect.bottom = 10;
	FillRect(hdc, &rect, debug_brush);
	OVERLAY TEST */
	if(config->V_D_PIXDEBUG) Sleep(600);	
	FRAME_PROCESSING  = false;
	return hr;
}
void UIPopupPane::paintEvent(QPaintEvent *)
{
    /* Compose painting rectangle,
     * Shifts are required for the antialiasing support: */
    const QRect rect(1, 1, width() - 2, height() - 2);

    /* Create painter: */
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    /* Configure clipping: */
    configureClipping(rect, painter);

    /* Paint background: */
    paintBackground(rect, painter);

    /* Paint frame: */
    paintFrame(painter);
}
int main()
{
    // Mute the speaker
    speaker=0.0;
    
    while(1) { //This is the game loo`p
            paintFrame(); //Render the scene
            updateLEDs(); // Pain the scene
            wait_ms(50);  // Wait 50ms, so there are 20 fps
            
            double rotSpeed=0; //Angular speed
            speaker=0.0;//Mute the speaker each frame
            
            //These buttons allow to turn left/right
            if(ain2.read() < 0.1){
                rotSpeed= 0.05;
            }
            if(ain.read() < 0.1){
                rotSpeed= -0.05;
            }
            //If the clicky button is down, try to move forward
            if(pushbutton){
                if(map[round(playerX+playerDirX/50)][round(playerY+playerDirY/50)]==0){ //If the taarget coordinates are empty, move
                    playerX+=playerDirX/20;
                    playerY+=playerDirY/20;
                }else{
                    speaker=1; //If not, notify with a beep
                }
            }
            
            //Update the direction and plane vectors according to the angular speed
            double oldDirX = playerDirX;
            playerDirX = playerDirX * cos(-rotSpeed) - playerDirY * sin(-rotSpeed);
            playerDirY = oldDirX * sin(-rotSpeed) + playerDirY * cos(-rotSpeed);
            double oldPlaneX = playerPlaneX;
            playerPlaneX = playerPlaneX * cos(-rotSpeed) - playerPlaneY * sin(-rotSpeed);
            playerPlaneY = oldPlaneX * sin(-rotSpeed) + playerPlaneY * cos(-rotSpeed);
    }
}
void PartitionDelegate::paint( QPainter* painter, const QStyleOptionViewItem& _option, const QModelIndex& index ) const
{
    QStyleOptionViewItemV4 option = _option;
    initStyleOption( &option, index );
    option.palette = mStyle->standardPalette();
#if defined( Q_OS_MAC )
    option.font.setPointSize( option.font.pointSize() -2 );
#endif
    
    const bool selected = option.state & QStyle::State_Selected;
    const bool hovered = option.state & QStyle::State_MouseOver;
    const int margin = option.widget->inherits( "QAbstractItemView" ) ? 3 : 0;
    const qint64 wbfsFSId = 0x25;
    pPartition partition = mModel->partition( index );
    
    if ( partition.property( pPartition::FileSystemId ).toLongLong() == wbfsFSId ) {
        // update wbfs partitions informations
        if ( partition.property( pPartition::LastCheck ).toDateTime() < QDateTime::currentDateTime()
            && ( partition.property( pPartition::UsedSize ).toLongLong() == -1 || partition.property( pPartition::FreeSize ).toLongLong() == -1 ) ) {
            // use a scope to avoid problems with windows partition read locked
            {
                bool created = false;
                QWBFS::Partition::Handle handle = QWBFS::Driver::getHandle( partition.property( pPartition::DevicePath ).toString(), &created );
                QWBFS::Driver driver( handle );
                QWBFS::Partition::Status status;
                
                driver.status( status );
                partition.updateSizes( status.size, status.free );
                
                if ( created ) {
                    QWBFS::Driver::closeHandle( handle );
                }
            }
            
            mModel->updatePartition( partition );
        }
    }
    
    int total = 100;
    int used = ( (qreal)partition.property( pPartition::UsedSize ).toLongLong() /(qreal)partition.property( pPartition::TotalSize ).toLongLong() ) *(qreal)100;
    
    QStyleOptionProgressBarV2 pbOption;
    pbOption.initFrom( option.widget );
    pbOption.state = option.state;
    pbOption.palette = option.palette;
    pbOption.rect = option.rect.adjusted( margin, margin, -margin, -margin );
    pbOption.bottomToTop = false;
    pbOption.invertedAppearance = false;
    pbOption.orientation = Qt::Horizontal;
    pbOption.maximum = total;
    pbOption.minimum = 0;
    pbOption.progress = used;
    pbOption.text = QString::null;
    pbOption.textAlignment = Qt::AlignCenter;
    pbOption.textVisible = false;
    
    pbOption.palette.setColor( QPalette::Highlight, QColor( 0, 160, 0, 100 ) );
    
    QStyleOptionButton bOption;
    bOption.initFrom( option.widget );
    bOption.state = option.state;
    bOption.palette = option.palette;
    bOption.rect = option.rect.adjusted( margin, margin, -margin, -margin );
    //bOption.icon = partition.fileSystem == "WBFS" ? QIcon( ":/icons/256/wii.png" ) : partition.icon();
    bOption.iconSize = QSize( bOption.rect.height() -5, bOption.rect.height() -5 );
    bOption.text = QString( "%1 - %2" )
        .arg( partition.property( pPartition::DisplayText ).toString() )
        .arg( pCoreUtils::fileSizeToString( partition.property( pPartition::TotalSize ).toLongLong() ) )
        ;
    
    if ( selected || hovered ) {
        paintFrame( painter, &option, selected );
    }
    
    painter->setFont( option.font );
    
    mStyle->drawControl( QStyle::CE_ProgressBar, &pbOption, painter, option.widget );
    mStyle->drawControl( QStyle::CE_PushButtonLabel, &bOption, painter, option.widget );
}
Beispiel #7
0
void
Frame::paintFrame(bool newtag, bool newage)
{
	paintFrame(tag_string, newtag, newage);
}
Beispiel #8
0
void
Frame::paintFrame()
{
	paintFrame(tag_string, true, true);
}
void CaptureWinGLEngine::paintGL()
{
	if (m_frameWidth < 1 || m_frameHeight < 1) {
		return;
	}

	if (m_formatChange)
		changeShader();

	if (m_frameData == NULL) {
		paintFrame();
		return;
	}

	switch (m_frameFormat) {
	case V4L2_PIX_FMT_YUYV:
	case V4L2_PIX_FMT_YVYU:
	case V4L2_PIX_FMT_UYVY:
	case V4L2_PIX_FMT_VYUY:
		render_YUY2();
		break;

	case V4L2_PIX_FMT_YUV420:
	case V4L2_PIX_FMT_YVU420:
		render_YUV(m_frameFormat);
		break;

	case V4L2_PIX_FMT_RGB32:
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight,
				GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, m_frameData);
		checkError("RGB32 paint");
		break;

	case V4L2_PIX_FMT_BGR32:
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight,
				GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, m_frameData);
		checkError("BGR32 paint");
		break;

	case V4L2_PIX_FMT_RGB555:
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight,
				GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, m_frameData);
		checkError("RGB555 paint");
		break;

	case V4L2_PIX_FMT_RGB565:
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight,
				GL_RGB, GL_UNSIGNED_SHORT_5_6_5, m_frameData);
		checkError("RGB565 paint");
		break;

	case V4L2_PIX_FMT_BGR24:
		render_BGR();
		break;
	case V4L2_PIX_FMT_RGB24:
	default:
		glActiveTexture(GL_TEXTURE0);
		glBindTexture(GL_TEXTURE_2D, m_screenTexture[0]);
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, m_frameHeight,
				GL_RGB, GL_UNSIGNED_BYTE, m_frameData);
		checkError("Default paint");
		break;
	}
	paintFrame();
}
Beispiel #10
0
void Spaceship::paintOn(gui::Canvas *canvas)
{
  paintFrame(_current_frame, canvas);
}
Beispiel #11
0
// ****************************************************************************
// Method:  ELWindowFrame::paintEvent
//
// Purpose:
///   Reimplemented to allow painting of the frame based on active state.
//
// Arguments:
//   ev         the paint event
//
// Programmer:  Jeremy Meredith
// Creation:    August  3, 2012
//
// Modifications:
// ****************************************************************************
void
ELWindowFrame::paintEvent(QPaintEvent *ev)
{
    paintFrame();
    QWidget::paintEvent(ev);
}