Beispiel #1
0
void ChessWidget::paintEvent(QPaintEvent * )
{
  cpos_.draw(this, curPt_);

  drawState();
  drawInfo();
}
Beispiel #2
0
void gameInitial() {
  int i;
  initMap(map);
  drawInfo(global.score, global.life);
  pacman.mapX = 14;
  pacman.mapY = 18;  
  pacman.screenX = 14 * UNIT + UNIT / 2 + OFFSET;
  pacman.screenY = 18 * UNIT + UNIT / 2 + OFFSET;
  pacman.dir = UP;
  pacman.speed = 1.2;
  drawPacman((int)pacman.screenX, (int)pacman.screenY, pacman.dir);
  for (i = 0; i < 3; i++) {
    ghost[i].mapX = 12 + i * 2;
    ghost[i].mapY = 16;
    ghost[i].screenX = mapToscreen(ghost[i].mapX) + UNIT / 2;
    ghost[i].screenY = mapToscreen(16);
    ghost[i].dir = UP;
    ghost[i].burst = 0;
    ghost[i].speed = 0.9;
    drawGhost(i, (int)ghost[i].screenX, (int)ghost[i].screenY, ghost[i].dir, ghost[i].burst);
  }
  ghost[3].mapX = 14;
  ghost[3].mapY = 12;
  ghost[3].screenX = mapToscreen(ghost[3].mapX);
  ghost[3].screenY = mapToscreen(12) + UNIT / 2;
  ghost[3].dir = LEFT;
  ghost[3].burst = 0;
  ghost[3].speed = 0.4;
  drawGhost(3, (int)ghost[3].screenX, (int)ghost[3].screenY, ghost[3].dir, ghost[3].burst);
}
//--------------------------------------------------------------
void ofApp::draw(){
    
    drawInfo();
    
    topCam.begin();
    ofTranslate(-dla.winCen.x, -dla.winCen.y, 0);
    if (dla.showthread) {
        ofSetColor(255, 255, 255);
        ofNoFill();
        ofCircle(dla.winCen, dla.enterThread);
    }
    //debug enterThread

    
    ofFill();
    //
    if (dla.bldrawFltPtl) {
        dla.dlaDrawfltPtls();
    }
    
    if (dla.bldrawAggPtl) {
        dla.dlaDrawaggPtls();
    }
    
//    dlaMesh.draw();
    if (dla.bldrawMesh) {
        dla.dlaDrawMesh();
    }
    
    topCam.end();
}
static void
display(void)
{
	demos[demoIndex].drawFunc();
	
	if(!paused || step){
		cpVect newPoint = cpvlerp(mouseBody->p, ChipmunkDemoMouse, 0.25f);
		mouseBody->v = cpvmult(cpvsub(newPoint, mouseBody->p), 60.0f);
		mouseBody->p = newPoint;
		
		demos[demoIndex].updateFunc(ticks);
		
		ticks++;
		step = cpFalse;
	}
  
	if(drawBBs) cpSpaceEachShape(space, drawShapeBB, NULL);
	
	drawInstructions();
	drawInfo();
	drawString(-300, -200, ChipmunkDemoMessageString);
		
	glutSwapBuffers();
	glClear(GL_COLOR_BUFFER_BIT);
}
Beispiel #5
0
void* def(void *a) {
	draw(0,0);
	shift_x=0;
	shift_y=0;
	shift_pix=1;
	draw(1,1);
	drawInfo();
	pthread_exit(NULL);
}
Beispiel #6
0
void
display ()
{
    drawAttractor ();
    if (dset.displayInfo) {
        drawInfo ();
    }
    glutSwapBuffers ();
}
Beispiel #7
0
void SplashScreenWidget::timerEvent(QTimerEvent *e){
    getTask();
    if(e->timerId()==dots_timer_id){
        getDots();
    }
    drawInfo();

    update();
    QObject::timerEvent(e);
}
Beispiel #8
0
gameMech::gameMech(int ms)
{
    milliseconds = ms;
    running = true;
    score = 0;
    startLoop = std::chrono::system_clock::now();
    startGame = startLoop;
    drawInfo();
    drawPoints();
}
// doDraw
//---------------------------------------------------------------------------
void GetSessionView::doDraw(Surface &viewArea, Surface &clientArea)
{
    if (previousSessionType != gameconfig->hostorjoin) {
        loadTitleSurface();
    }

    MenuTemplateView::doDraw(viewArea, clientArea);

    drawInfo(clientArea);

} // end GetSessionView::doDraw
Beispiel #10
0
void* dec(void* what) {
	draw(0,0);
	if( (MTYPE*) what==&shift_y )
		shift_y-=SHIFT*MULT;
	if( (MTYPE*) what==&shift_x )
		shift_x-=SHIFT*MULT;
	if( (MTYPE*) what==&shift_pix )
		shift_pix/=MULT;
	draw(1,1);
	drawInfo();
	pthread_exit(NULL);
}
/******************************************************************************
* @fn          cc120x_FreqConfig
*
* @brief       Writes frequency word depending on user input
*
* input        index
*              
* output       none
*
* @return      void
*/
uint8 cc120x_FreqConfig(uint16 index) {
  // Set frequency
  cc120xSpiWriteReg(CC120X_FS_CFG,&cc120xFsCfgs[index],1);
  cc120xSpiWriteReg(CC120X_FREQ2,freqSettings40Mhz[index],3);
  
  // Put radio in powerdown to save power
  trxSpiCmdStrobe(CC120X_SPWD);
  
  //Insert Carrier Sense threshold warning in Sniff Test Menu
  drawInfo();
  
  return SNIFF_RETURN_SUCCESS;
}
Beispiel #12
0
	void D3D11Render::v_render()
	{
		float bgColor[4] ={ 0.0f, 0.0f, 0.0f, 1.0f };

		m_pD3D11DeviceContext->RSSetState(m_pRasterState);
		m_pD3D11DeviceContext->OMSetRenderTargets(1, &m_pRenderTargetView, m_pDepthStencilView);
		m_pD3D11DeviceContext->ClearRenderTargetView(m_pRenderTargetView, bgColor);
		m_pD3D11DeviceContext->ClearDepthStencilView(m_pDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);

		drawInfo();
		m_pSwapChain->Present(0, 0);
		sound.Play();
	}
Beispiel #13
0
void HUD::draw()
{
	if (mToggleHelp)
	{
		drawHelp();
	}
	else
	{
		drawInfo();
	}
	//display help info
	al_draw_text(mpFont, al_map_rgb(255, 255, 255), X_CENTRE, TOP_LEFT_X - 20, ALLEGRO_ALIGN_CENTRE, mHelpText[14].c_str());
}
Beispiel #14
0
void* inc(void* what) {
	draw(0,0);
	if( (MTYPE*) what==&shift_y )
		shift_y+=SHIFT*MULT;
	if( (MTYPE*) what==&shift_x )
		shift_x+=SHIFT*MULT;
	if( (MTYPE*) what==&shift_pix ) {
		if( shift_pix<50 )
			shift_pix*=MULT;
	}
	draw(1,1);
	drawInfo();
	pthread_exit(NULL);
}
/**
  \brief Creates a QImage comprising the depth map
**/
QImage QKinectWrapper::createCameraImage()
{

	// Here must mutex / run also access the data
	xn::DepthMetaData dmd;
	xn::ImageMetaData imd;
	g_DepthGenerator.GetMetaData(dmd);
	g_ImageGenerator.GetMetaData(imd);

	XnUInt16 g_nXRes = dmd.XRes();
	XnUInt16 g_nYRes = dmd.YRes();

	QImage image(g_nXRes,g_nYRes,QImage::Format_RGB32);


	const XnUInt8 *idata = imd.Data();
	for (unsigned nY=0; nY<g_nYRes; nY++)
	{
		uchar *imageptr = image.scanLine(nY);

		for (unsigned nX=0; nX < g_nXRes; nX++)
		{
			imageptr[0] = idata[2];
			imageptr[1] = idata[1];
			imageptr[2] = idata[0];
			imageptr[3] = 0xff;

			imageptr+=4;
			idata+=3;

		}
	}
	QPainter painter;
	painter.begin(&image);
	if(displayInfoImage)
	{
		painter.setPen(textPen);
		painter.setFont(font);
		drawInfo(&painter);
	}
	if(displaySkeletonImage)
	{
		painter.setPen(skeletonPen);
		drawSkeleton(&painter);
	}
	painter.end();

	return image;

}
void FirstRunWindow::draw()
{
    drawInfo();
    drawButtons();
    drawConnectMessage();

    if (modelDriver->getSelectedWindow() == FIRSTWINDOW) {
        wattron(win, A_BOLD);
        wattron(win, COLOR_PAIR(HICOLOR));
    }
    Window::draw();

    wrefresh(win);
}
Beispiel #17
0
    void draw(){
        
        ofPushMatrix();
        ofSetColor(0);
        drawAngle();
        ofTranslate(140, 0);
        
        drawGraph();
        drawInfo();
        
        ofTranslate(N + 20, 0);
        drawHistogram();
        ofPopMatrix();

    }
Beispiel #18
0
static void display(void)
{
    const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
    const double a = t*89.0;
    const double b = (animateXRot?t:1)*67.0;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    if (persProject)
        glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);
    else
        glOrtho(-ar*3, ar*3, -3.0, 3.0, 2.0, 100.0);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glEnable(GL_LIGHTING);

    glColor3d(1,0,0);

    glPushMatrix();
        glTranslated(0,1.2,-6);
        glRotated(b,1,0,0);
        glRotated(a,0,0,1);
        table [function_index].solid ();
    glPopMatrix();

    glPushMatrix();
        glTranslated(0,-1.2,-6);
        glRotated(b,1,0,0);
        glRotated(a,0,0,1);
        table [function_index].wire ();
    glPopMatrix();

    glDisable(GL_LIGHTING);
    glColor3d(0.1,0.1,0.4);

    if( show_info )
        /* print info to screen */
        drawInfo();
    else
        /* print to command line instead */
        printf ( "Shape %d slides %d stacks %d\n", function_index, slices, stacks ) ;

    glutSwapBuffers();
}
Beispiel #19
0
	void D3D11Render::v_render()
	{
		float bgColor[4] ={ 0.0f, 0.0f, 0.0f, 1.0f };

		m_pD3D11DeviceContext->RSSetState(m_pRasterState);
		m_pD3D11DeviceContext->OMSetRenderTargets(1, &m_pRenderTargetView, m_pDepthStencilView);
		m_pD3D11DeviceContext->ClearRenderTargetView(m_pRenderTargetView, bgColor);
		m_pD3D11DeviceContext->ClearDepthStencilView(m_pDepthStencilView, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);

		drawInfo();

#ifdef USE_CEGUI
		D3DCEGUI::getInstance()->render();
#endif

		m_pSwapChain->Present(0, 0);
	}
Beispiel #20
0
void move( int dir, int* floor )
{
	
	//动画移一层
	if ( dir == 1 )
		sprintf( msg, "%-4d:Moving up from %d to Floor %d\n", Time, *floor, *floor+dir );		
	else
		sprintf( msg, "%-4d:Moving down from %d to Floor %d\n", Time, *floor, *floor+dir );

	drawInfo( msg );

	drawMove( dir ); 
	*floor += dir;
	showFloor( *floor );

	Time += runTime;
}
Beispiel #21
0
void ofxGuiImage::draw() 
{
	glPushMatrix();
	glTranslatef( mObjX, mObjY, 0.0f );
	ofFill();
	if (bImageSet) 
		drawImage();
	else 
		drawBlank();
	if ( mParamName != "" ) 
		drawHighlightParamString( PARAM_TEXT_OFFSET_X, .0f, mParamName, false );
	if ( bDrawInfo && bCanDrawInfo && pCam != NULL )
		drawInfo();
	if (bCamSelected)
		drawSelectedText();
	glPopMatrix();
}
Beispiel #22
0
static void
display(void)
{
	glClear(GL_COLOR_BUFFER_BIT);
	
	drawSpace(space, currDemo->drawOptions ? currDemo->drawOptions : &options);
	drawInstructions();
	drawInfo();
	drawString(-300, -210, messageString);
		
	glutSwapBuffers();
	ticks++;
	
	cpVect newPoint = cpvlerp(mousePoint_last, mousePoint, 0.25f);
	mouseBody->p = newPoint;
	mouseBody->v = cpvmult(cpvsub(newPoint, mousePoint_last), 60.0f);
	mousePoint_last = newPoint;
	currDemo->updateFunc(ticks);
}
Beispiel #23
0
static void
display(void)
{
	PrintStringBuffer[0] = 0;
	PrintStringCursor = PrintStringBuffer;
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glScalef(scale, scale, 1.0);
	glTranslatef(translate_x, translate_y, 0.0);
	
	demos[demoIndex].drawFunc();
	
	if(!paused || step){
		cpVect newPoint = cpvlerp(mouseBody->p, ChipmunkDemoMouse, 0.25f);
		mouseBody->v = cpvmult(cpvsub(newPoint, mouseBody->p), 60.0f);
		mouseBody->p = newPoint;
		
		demos[demoIndex].updateFunc(ticks);
		
		ticks++;
		ChipmunkDemoTime = ticks/60.0;
		
		step = cpFalse;
	}
  
	if(drawBBs) cpSpaceEachShape(space, drawShapeBB, NULL);
	
	glMatrixMode(GL_MODELVIEW);
	glPushMatrix(); {
		// Draw the text at fixed positions,
		// but save the drawing matrix for the mouse picking
		glLoadIdentity();
		
		drawInstructions();
		drawInfo();
		drawString(-300, -200, ChipmunkDemoMessageString);
	} glPopMatrix();
		
	glutSwapBuffers();
	glClear(GL_COLOR_BUFFER_BIT);
}
Beispiel #24
0
void Viewer::update() {
  
  // clear frame
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  // run user renderer
  if (renderer) {
    renderer->render();
  }

  // draw info
  if( showInfo ) {
    drawInfo();        
  } 

  // swap buffers
  glfwSwapBuffers(window); 

  // poll events
  glfwPollEvents();
}
/* The main drawing function.  Technically there's a race condition
   between drawing and writing new values from the simulation for the
   body positions. I'm lazy and It doesn't need to be displayed 100%
   accurately so this should be good enough.
 */
static void drawGLScene()
{
    if (!scene)
        return;

    mwMicroSleep(scene->usleepdt);

    /* draw scene if necessary */
    if (scene->changed)
    {
        nbodyGraphicsSetOn(&scene->attached);
        scene->changed = FALSE;

        /* erase scene */
        glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

        /* get ready to render 3D objects */
        glLoadIdentity();
        glTranslatef(0.0f, 0.0f, scene->z + 0.1f);

        /* rotate view--I know these two rotation matrices don't commute */
        glRotatef(scene->xrot, 1.0f, 0.0f, 0.0f);
        glRotatef(scene->yrot, 0.0f, 1.0f, 0.0f);

        if (scene->drawGalaxy)
        {
            drawSimpleGalaxy();
        }

        if (scene->drawaxes)
        {
            drawAxes();
        }

        drawPoints();
        drawInfo();

        glutSwapBuffers();
    }
}
Beispiel #26
0
void waiting( void )
{
	int waitTime = 0;
	eleStat.dir = 0;
	while ( isWait() )
	{
		//计时,等待超时则返回第一层
		if ( waitTime > maxWaitTime )
			if ( eleStat.floor != 1 )
			{
				eleStat.inRqst[1] = 1;
				break;
			}

		waitTime ++;
		fprintf( oPtr, "%-4d:Wait at Floor %d\n", Time, eleStat.floor );
		sprintf( msg, "%-4d:Wait at Floor %d\n", Time, eleStat.floor );
		drawInfo( msg );
		putClock( 1 );
	}
	return;
}
Beispiel #27
0
void stop( int dir, int floor )
{
	sprintf( msg, "%-4d:Stop at Floor %d\n", Time, floor );
	drawInfo( msg );

	//清除完成的请求
	eleStat.inRqst[floor] = 0;

	//相应当前请求
	if ( dir != 0 )
	{
		if ( dir == 1 )			upRqst[floor] = 0;
		else if ( dir == -1 )	dnRqst[floor] = 0;
		drawOutRqstLight( floor, dir, -1 );
	}
	else
		if ( upRqst[floor] == 1 )
		{
			upRqst[floor] = 0;
			if ( floor != 9 )	
				drawOutRqstLight( floor, 1, -1 );
		}
		else if ( dnRqst[floor] == 1 )
		{
			dnRqst[floor] = 0;
			if ( floor != 1 )	
				drawOutRqstLight( floor, -1, -1 );
		}

	//更新电梯面板显示
	drawInRqstLight( -floor );

	//播放声音
	PlaySound( "global.wav", NULL, SND_ASYNC|SND_NODEFAULT );   
	Sleep(1000);
	PlaySound( snd[floor], NULL, SND_SYNC|SND_NODEFAULT );   
	//时间推进
	putClock( stopTime );
}
//--------------------------------------------------------------
void ofApp::draw(){
    
    drawInfo();
    
    topCam.begin();

    ofTranslate(-dla.winCen.x, -dla.winCen.y, 0);
    if (showthread) {
        ofSetColor(255, 255, 255);
        ofNoFill();
        ofCircle(dla.winCen, dla.enterThread);
    }
    //debug enterThread

    
    ofFill();
    //
    if (dla.bldrawFltPtl) {
        dla.dlaDrawfltPtls();
    }

    if (dla.bldrawAggPtl) {
        dla.dlaDrawaggPtls();
    }
    
    shader.begin();
    
    shader.setUniform1f("time", ofGetElapsedTimef());
    shader.setUniform1f("scale", 100.0);
    shader.setUniform1f("width", divWidth);
    shader.setUniform1f("height", divHeight);
//    dlaMesh.draw();
    if (dla.bldrawMesh) {
        dla.dlaDrawMesh();
    }
    shader.end();
    topCam.end();
}
Beispiel #29
0
void GLWidget::paintGL()
{
    glClearColor(0.0, 0.3, 0.0, 1);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();



    drawInfo();
    m_camera->setUp();

    m_light->setUp();

    m_forklift->draw();

    drawBox();

    glFlush();

}
Beispiel #30
0
SplashScreenWidget::SplashScreenWidget(){
    setObjectName("splash_screen_widget");

    Version v = Version::appVersion();
    version = v.text;

    QImage image(":ugene/images/ugene_splash.png");
    QSize widgetSize = image.size();
    setFixedSize(widgetSize);

    image = image.scaled(widgetSize * devicePixelRatio());
    image.setDevicePixelRatio(devicePixelRatio());
    image1 = image2 = image;

    dots_number = 0;
    task = "";
    dots_timer_id = startTimer(500);
    startTimer(50);

    getTask();
    getDots();
    drawInfo();
}