Beispiel #1
0
void WizDocumentStatusChecker::checkEditStatus(const QString& strKbGUID, const QString& strGUID)
{
//    qDebug() << "CWizDocumentStatusChecker start to check guid : " << strGUID;
    setDocmentGUID(strKbGUID, strGUID);
    m_stop = false;
    startCheck();
}
void CWizDocumentStatusChecker::checkEditStatus(const QString& strKbGUID, const QString& strGUID)
{
//    qDebug() << "CWizDocumentStatusChecker start to check guid : " << strGUID;
    setDocmentGUID(strKbGUID, strGUID);
    m_timeOutTimer->start(5 * 1000);
//    m_loopCheckTimer->start(1 * 60 * 1000);
    m_stop = false;
    startCheck();
}
Beispiel #3
0
//---------------------------------------------------------------------------------
// Draws a 3x3 side of the rubiks cube. as with DrawTile, assumes that all rotation
// has already been performed.
//---------------------------------------------------------------------------------
void RubiksCube::DrawSide(RubikSide side, int sideNum, int32 x, int32 y, int32 z, int32 size, bool picking) {
//---------------------------------------------------------------------------------
	int color; // generate an int to signify tile colour (see enum RC_Color)
	glBegin(GL_QUADS); //start drawin squares
	for(int i=0; i<3; i++)
	{
		for(int j=0; j<3; j++)
		{
			color = side.tile[i][j].color; //get this tile's colour
			if(picking) startCheck(); // if picking...
			DrawTile(	color,
						x + mulf32(inttof32(i),divf32(size,inttof32(3))),
						y + mulf32(inttof32(j),divf32(size,inttof32(3))),
						z,
						divf32(size,inttof32(3)),
						picking); // draw the tile at (i,j)
			if(picking) endCheck(sideNum, i, j); // if picking...
		}
	}
	glEnd(); // stop drawin squares

}
void CWizDocumentStatusChecker::startRecheck()
{
//    qDebug() << "CWizDocumentStatusChecker  start recheck";
    m_timeOutTimer->start(5000);
    startCheck();
}
Beispiel #5
0
void UpdateManager::resume() {
    startCheck();
}
int main()
{	

	// initialize gl
	glInit();

	u32 rotateX = 0;
	u32 rotateY = 0;

	//set mode 0, enable BG0 and set it to 3D
	videoSetMode(MODE_0_3D);
	
	// used to hold touched position
	touchPosition touchXY;
	
	lcdMainOnBottom(); // we are going to be touching the 3D display

	
	// enable edge outlining, this will be used to show which object is selected
	glEnable(GL_OUTLINE);
	
	//set the first outline color to white
	glSetOutlineColor(0,RGB15(31,31,31));
	
	int viewport[]={0,0,255,191}; // used later for gluPickMatrix()
	
	// setup the rear plane
	glClearColor(0,0,0,0); // set BG to black and clear
	glClearPolyID(0); // the BG and polygons will have the same ID unless a polygon is highlighted
	glClearDepth(0x7FFF);
	
	// setup the camera
	gluLookAt(	0.0, 0.0, 1.0,		//camera possition 
				0.0, 0.0, 0.0,		//look at
				0.0, 1.0, 0.0);		//up
	
	glLight(0, RGB15(31,31,31) , 0, floattov10(-1.0), 0); // setup the light
	
	while(1) {
		// handle key input
		scanKeys();
		u16 keys = keysHeld();
		if(!(keys & KEY_UP)) rotateX += 3;
		if(!(keys & KEY_DOWN)) rotateX -= 3;
		if(!(keys & KEY_LEFT)) rotateY += 3;
		if(!(keys & KEY_RIGHT)) rotateY -= 3;
		
		// get touchscreen position
		touchRead(&touchXY);
		
		glViewport(0,0,255,191); // set the viewport to fullscreen
		
		// setup the projection matrix for regular drawing
		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		gluPerspective(60, 256.0 / 192.0, 0.1, 20); 
		
		glMatrixMode(GL_MODELVIEW); // use the modelview matrix while drawing
		
		glPushMatrix(); // save the state of the current matrix(the modelview matrix)
		{
			glTranslatef32(0,0,floattof32(-6));
			glRotateXi(rotateX); // add X rotation to the modelview matrix
			glRotateYi(rotateY); // add Y rotation to the modelview matrix
			
			glPushMatrix(); // save the state of the modelview matrix while making the first pass
			{ 
				// draw the scene for displaying
				
				glTranslatef32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
				if(clicked==CONE) {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(1)); // set a poly ID for outlining
				} else {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(0)); // set a poly ID for no outlining (same as BG)
				}
				glCallList((u32*)cone_bin); // draw a green cone from a predefined packed command list
				
				
				glTranslatef32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
				if(clicked==CYLINDER) {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(1)); // set a poly ID for outlining
				} else {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(0)); // set a poly ID for no outlining (same as BG)
				}
				glCallList((u32*)cylinder_bin); // draw a blue cylinder from a predefined packed command list
				
				
				glTranslatef32(floattof32(.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
				if(clicked==SPHERE) {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(1)); // set a poly ID for outlining
				} else {
					glPolyFmt(POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0 | POLY_ID(0)); // set a poly ID for no outlining (same as BG)
				}
				glCallList((u32*)sphere_bin); // draw a red sphere from a predefined packed command list

			}
			glPopMatrix(1); // restores the modelview matrix to where it was just rotated
			
			// draw the scene again for picking
			{
				
				clicked = NOTHING; //reset what was clicked on
				closeW = 0x7FFFFFFF; //reset the distance
				
				//set the viewport to just off-screen, this hides all rendering that will be done during picking
				glViewport(0,192,0,192);
				
				// setup the projection matrix for picking
				glMatrixMode(GL_PROJECTION);
				glLoadIdentity();
				gluPickMatrix((touchXY.px),(191-touchXY.py),4,4,viewport); // render only what is below the cursor
				gluPerspective(60, 256.0 / 192.0, 0.1, 20); // this must be the same as the original perspective matrix
				
				glMatrixMode(GL_MODELVIEW); // switch back to modifying the modelview matrix for drawing
				
				glTranslatef32(floattof32(2.9),floattof32(0),floattof32(0)); // translate the modelview matrix to the drawing location
				startCheck();
				glCallList((u32*)cone_bin); // draw a cone from a predefined packed command list
				endCheck(CONE);
				
				glTranslatef32(floattof32(-3),floattof32(1.8),floattof32(2)); // translate the modelview matrix to the drawing location
				startCheck();
				glCallList((u32*)cylinder_bin); // draw a cylinder from a predefined packed command list
				endCheck(CYLINDER);
				
				glTranslatef32(floattof32(.5),floattof32(-2.6),floattof32(-4)); // translate the modelview matrix to the drawing location
				startCheck();
				glCallList((u32*)sphere_bin); // draw a sphere from a predefined packed command list
				endCheck(SPHERE);
			}
			
		}
		glPopMatrix(1); // restores the modelview matrix to its original state
		
		glFlush(0); // wait for everything to be drawn before starting on the next frame
	}

	return 0;
}//end main 
Beispiel #7
0
void WizDocumentStatusChecker::startRecheck()
{
//    qDebug() << "CWizDocumentStatusChecker  start recheck";    
    startCheck();
}
Beispiel #8
0
Patch* MapDraw::draw()
{
  // TODO: Fit this one in too so I don't have to to all the MODEL_SCALE multiplications.
//  glScalef(MODEL_SCALE, MODEL_SCALE, MODEL_SCALE);

  int x,y, temp;
  Patch* bottomLeft = '\0';
  Patch* tp = '\0';

  // Eventually this call will be made to whatever generic character the
  // map should be centered on.  i.e. the player, or an enemy ant.
  bottomLeft = getGrid()->getPatch(getCenterX(), getCenterY());

  // Shift from the center to the bottomLeft.
  // shift left a bunch of times or until we hit the left wall.
  for (temp=0; ((bottomLeft) && (Grid::getLeft(bottomLeft)) && (temp < GRID_SIZE)); temp++)
    bottomLeft = Grid::getLeft(bottomLeft);

  int offsetx = 0;
  // At the bottom, offset...
  if (temp < GRID_SIZE)
    offsetx = GRID_SIZE - temp;

  // shift up a bunch of times or until we hit the top wall.
  for (temp=0; ((bottomLeft) && (Grid::getDown(bottomLeft)) && (temp < GRID_SIZE)); temp++)
    bottomLeft = Grid::getDown(bottomLeft);

  int offsety = 0;
  // At the bottom, offset...
  if (temp < GRID_SIZE)
    offsety = GRID_SIZE - temp;
    //printf("EXTREME");

  tp=bottomLeft;

  // Setup for drawing.
//  glBegin(GL_QUADS);

  for (y=GRID_SIZE*-1 + (offsety); (bottomLeft && (y < (GRID_SIZE+1))); y+=1)
  {
    tp=bottomLeft;
    for (x=GRID_SIZE*-1 + (offsetx); x < (GRID_SIZE+1); x+=1)
    {
      if (pickMode)
        startCheck();
      // scale by *MODEL_SCALE then "translate" by adding the smooth scroll factors.
      // I really have no idea why I was scaling this thing, but I think this is screwing
      // up tile alignment.
      // OK, well if x and y get too big I get weird graphical issues with boxes wrapping
      // around the screen, so lets keep things small for now...
      drawPatch(x*MODEL_SCALE, y*MODEL_SCALE, tp);
      if (pickMode)
        if (endCheck())
        {
          //glEnd();
          return tp;
        }
      tp=tp->right;
    }
    if (bottomLeft)
      bottomLeft = Grid::getUp(bottomLeft);
  }

  // Finished drawing.
  //glEnd();
  return '\0';
}