Exemple #1
0
void CALLBACK GPUupdateLace(void) // VSYNC
{
    ShowFPS();
    /*
    if(!(dwActFixes&1))
        lGPUstatusRet^=0x80000000;                           // odd/even bit
     */
    if (!(dwActFixes & 32)) // std fps limitation?
        CheckFrameRate();

    if (PSXDisplay.Interlaced) // interlaced mode?
    {
        lGPUstatusRet ^= 0x80000000; //fix for some games ...
        if (bDoVSyncUpdate && PSXDisplay.DisplayMode.x > 0 && PSXDisplay.DisplayMode.y > 0) {
            updateDisplay();
        }
    } else // non-interlaced?
    {
        if (dwActFixes & 64) // lazy screen update fix
        {
            if (bDoLazyUpdate && !UseFrameSkip)
                updateDisplay();
            bDoLazyUpdate = FALSE;
        } else {
            if (bDoVSyncUpdate && !UseFrameSkip) // some primitives drawn?
                updateDisplay(); // -> update display
        }
    }

    bDoVSyncUpdate = FALSE; // vsync done
}
Exemple #2
0
void FCEU_PutImageDummy(void)
{
	ShowFPS();
	if(GameInfo->type!=GIT_NSF)
	{
		FCEU_DrawNTSCControlBars(XBuf);
		FCEU_DrawSaveStates(XBuf);
		FCEU_DrawMovies(XBuf);
	}
	if(guiMessage.howlong) guiMessage.howlong--; /* DrawMessage() */
}
Exemple #3
0
	void EngineApp::OnUpdate()
	{
		m_pCore->Update();

		ShowFPS();
		
		m_pGameManager->GetGame()->Update();
		
		//Sleep(1);

	}
Exemple #4
0
bool Core::Stop()
{
	EatMsg();

	ShowFPS();

	screen->Show(hdc);

	delta_time = timer->Update();
	 
	return stop;
}
Exemple #5
0
bool D3DApp::Run() {
	if (!m_timerStop) m_timer.Signal();

	if (!m_appPaused) {
		ShowFPS();
		UpdateScene(m_timer.Delta());
		DrawScene();
	} else {
		Sleep(100);
	}

	return true;
}
Exemple #6
0
void myGlutDisplay(void)
{
	::glClearColor(0.2f, .7f, 0.7f, 1.0f);
	::glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	::glEnable(GL_DEPTH_TEST);
  
	::glEnable(GL_POLYGON_OFFSET_FILL );
	::glPolygonOffset( 1.1f, 4.0f );
  
	::glMatrixMode(GL_MODELVIEW);
	::glLoadIdentity();
	Com::View::SetModelViewTransform(cameras);
  
  if( is_animation ){        
    StepTime3();	// solve rigid motion
    cur_time += dt;
		// caliculation of kinematic energy
    double eng = 0;
    for(unsigned int irb=0;irb<aRB.size();irb++){
      double e = aRB[irb].GetKineticEnergy();
      e -= Com::Dot(gravity,aRB[irb].GetDispCG())*aRB[irb].GetMass();
      eng += e;
    }
    std::cout << "cur time " << cur_time << " " << eng << std::endl;
  }
  
  ShowBackGround();
  
  {
    ::glLineWidth(1);
    ::glBegin(GL_LINES);
    ::glColor3d(1,0,0);	::glVertex3d(0,0,0);	::glVertex3d(1,0,0);
    ::glColor3d(0,1,0);	::glVertex3d(0,0,0);	::glVertex3d(0,1,0);
    ::glColor3d(0,0,1);	::glVertex3d(0,0,0);	::glVertex3d(0,0,1);
    ::glEnd();
  }
  
  for(unsigned int irb=0;irb<aRB.size();irb++){
		DrawRigidBody(aRB[irb]);
    //	    aRB[irb].Draw();
  }
  for(unsigned int ifix=0;ifix<apFix.size();ifix++){
		DrawConstraint(apFix[ifix],aRB);
    //		apFix[ifix]->Draw(aRB);
  }
  
  ShowFPS();
  
	glutSwapBuffers();
}
Exemple #7
0
void XenonGLDisplay()
{
    Xe_SetBlendOp(xe, XE_BLENDOP_ADD);
    Xe_SetSrcBlend(xe, XE_BLEND_SRCALPHA);
    Xe_SetDestBlend(xe, XE_BLEND_INVSRCALPHA);
    
    // update vb cache !!!
    Xe_VB_Lock(xe, pVbGL, 0, XE_MAX_VERTICES, XE_LOCK_WRITE);
	Xe_VB_Unlock(xe, pVbGL);    
    
/*
	// Refresh texture cash
    unsigned int * pBitmap = Xe_Surface_LockRect(xe, pVideoSurface, 0, 0, 0, 0, XE_LOCK_WRITE);
    int i;
    for(i = 0;i<(vid.width*vid.height);i++)
	{
		//Make an ARGB bitmap
		unsigned int c = (pQ2Palette[vid.buffer[i]]) >> 8 | ( 0xFF << 24 );
		pBitmap[i] = c;
	}
    
    Xe_Surface_Unlock(xe, pVideoSurface);

    // Select stream and shaders
    Xe_SetTexture(xe, 0, pVideoSurface);
    Xe_SetCullMode(xe, XE_CULL_NONE);
    Xe_SetStreamSource(xe, 0, pVBSw, 0, 10);
    Xe_SetShader(xe, SHADER_TYPE_PIXEL, pPixelShader, 0);
    Xe_SetShader(xe, SHADER_TYPE_VERTEX, pVertexShader, 0);
   
    // Draw
    Xe_DrawPrimitive(xe, XE_PRIMTYPE_RECTLIST, 0, 1);
*/    
    // Resolve
    Xe_Resolve(xe);
    while(!Xe_IsVBlank(xe));
    Xe_Sync(xe);
    
    // Reset states
    Xe_InvalidateState(xe);
    Xe_SetClearColor(xe, 0);
    
    xe_NumVerts = xe_PrevNumVerts = 0;
 
	ShowFPS();
}
Exemple #8
0
void XenonEndGl()
{	
	// update vb cache !!!
    xe_Vertices = Xe_VB_Lock(xe, pVbGL, 0, xe_NumVerts * sizeof(glVerticesFormat_t), XE_LOCK_WRITE);
	Xe_VB_Unlock(xe, pVbGL);
	
	xe_indices = Xe_IB_Lock(xe, pIbGL, 0, xe_NumIndices * sizeof(short), XE_LOCK_WRITE);
	Xe_IB_Unlock(xe, pIbGL); 
	
	// Resolve
    Xe_Resolve(xe);
    
	Xe_Execute(xe);
	
	// Reset vertices
    xe_NumVerts = xe_PrevNumVerts = 0;
    xe_NumIndices = xe_PrevNumIndices = 0;
 
	ShowFPS();
}
	void DisplayDebugInfo::Draw()
	{
		if (Game::Instance()->GetDebugOptions().ShowAxis == true)
		{
			DrawAxis(m_VertexBuffer, m_pProgram->Handle());
		}

		if (Game::Instance()->GetDebugOptions().ShowFPS == true)
		{
			ShowFPS();
		}

		if (Game::Instance()->GetDebugOptions().IsDebugActivated == true)
		{
			ShowDebugWindow();
		}

		if (Game::Instance()->GetDebugOptions().ShowLogInGame == true)
		{
			InGameLogger::Instance().ShowWindow();
		}
	}
Exemple #10
0
void FCEU_PutImage(void)
{
	if(dosnapsave==2)	//Save screenshot as, currently only flagged & run by the Win32 build. //TODO SDL: implement this?
	{
		char nameo[512];
		strcpy(nameo,FCEUI_GetSnapshotAsName().c_str());
		if (nameo[0])
		{
			SaveSnapshot(nameo);
			FCEU_DispMessage("Snapshot Saved.",0);
		}
		dosnapsave=0;
	}
	if(GameInfo->type==GIT_NSF)
	{
		DrawNSF(XBuf);

		//Save snapshot after NSF screen is drawn.  Why would we want to do it before?
		if(dosnapsave==1)
		{
			ReallySnap();
			dosnapsave=0;
		}
	}
	else
	{
		//Save backbuffer before overlay stuff is written.
		if(!FCEUI_EmulationPaused())
			memcpy(XBackBuf, XBuf, 256*256);

		//Some messages need to be displayed before the avi is dumped
		DrawMessage(true);

#ifdef _S9XLUA_H
		// Lua gui should draw before the avi is dumped.
		FCEU_LuaGui(XBuf);
#endif

		//Save snapshot
		if(dosnapsave==1)
		{
			ReallySnap();
			dosnapsave=0;
		}

		if (!FCEUI_AviEnableHUDrecording()) snapAVI();

		if(GameInfo->type==GIT_VSUNI)
			FCEU_VSUniDraw(XBuf);

		FCEU_DrawSaveStates(XBuf);
		FCEU_DrawMovies(XBuf);
		FCEU_DrawLagCounter(XBuf);
		FCEU_DrawNTSCControlBars(XBuf);
		FCEU_DrawRecordingStatus(XBuf);
		ShowFPS();
	}

	if(FCEUD_ShouldDrawInputAids())
		FCEU_DrawInput(XBuf);

	//Fancy input display code
	if(input_display)
	{
		extern uint32 JSAutoHeld;
		uint32 held;

		int controller, c, ci, color;
		int i, j;
		uint32 on  = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0x90:0xA7;	//Standard, or Gray depending on movie mode
		uint32 oni = 0xA0;		//Color for immediate keyboard buttons
		uint32 blend = 0xB6;		//Blend of immiate and last held buttons
		uint32 ahold = 0x87;		//Auto hold
		uint32 off = 0xCF;

		uint8 *t = XBuf+(FSettings.LastSLine-9)*256 + 20;		//mbg merge 7/17/06 changed t to uint8*
		if(input_display > 4) input_display = 4;
		for(controller = 0; controller < input_display; controller++, t += 56)
		{
			for(i = 0; i < 34;i++)
				for(j = 0; j <9 ; j++)
					t[i+j*256] = (t[i+j*256] & 0x30) | 0xC1;
			for(i = 3; i < 6; i++)
				for(j = 3; j< 6; j++)
					t[i+j*256] = 0xCF;
			c = cur_input_display >> (controller * 8);

			// This doesn't work in anything except windows for now.
			// It doesn't get set anywhere in other ports.
#if defined(WIN32) && !defined(DINGUX)
			if (!oldInputDisplay) ci = FCEUMOV_Mode(MOVIEMODE_PLAY) ? 0:GetGamepadPressedImmediate() >> (controller * 8);
			else ci = 0;

			if (!oldInputDisplay && !FCEUMOV_Mode(MOVIEMODE_PLAY)) held = (JSAutoHeld >> (controller * 8));
			else held = 0;
#else
			// Put other port info here
			ci = 0;
			held = 0;
#endif

			//adelikat: I apologize to anyone who ever sifts through this color assignment
			//A
			if (held&1)	{ //If auto-hold
				if (!(ci&1) ) color = ahold;
				else
					color = (c&1) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&1) color = (ci&1) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&1) ? oni : off;
			}
			for(i=0; i < 4; i++)
			{
				for(j = 0; j < 4; j++)
				{
					if(i%3==0 && j %3 == 0)
						continue;
					t[30+4*256+i+j*256] = color;
				}
			}
			//B
			if (held&2)	{ //If auto-hold
				if (!(ci&2) ) color = ahold;
				else
					color = (c&2) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&2) color = (ci&2) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&2) ? oni : off;
			}
			for(i=0; i < 4; i++)
			{
				for(j = 0; j < 4; j++)
				{
					if(i%3==0 && j %3 == 0)
						continue;
					t[24+4*256+i+j*256] = color;
				}
			}
			//Select
			if (held&4)	{ //If auto-hold
				if (!(ci&4) ) color = ahold;
				else
					color = (c&4) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&4) color = (ci&4) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&4) ? oni : off;
			}
			for(i = 0; i < 4; i++)
			{
				t[11+5*256+i] = color;
				t[11+6*256+i] = color;
			}
			//Start
			if (held&8)	{ //If auto-hold
				if (!(ci&8) ) color = ahold;
				else
					color = (c&8) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&8) color = (ci&8) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&8) ? oni : off;
			}
			for(i = 0; i < 4; i++)
			{
				t[17+5*256+i] = color;
				t[17+6*256+i] = color;
			}
			//Up
			if (held&16)	{ //If auto-hold
				if (!(ci&16) ) color = ahold;
				else
					color = (c&16) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&16) color = (ci&16) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&16) ? oni : off;
			}
			for(i = 0; i < 3; i++)
			{
				for(j = 0; j < 3; j++)
				{
					t[3+i+256*j] = color;
				}
			}
			//Down
			if (held&32)	{ //If auto-hold
				if (!(ci&32) ) color = ahold;
				else
					color = (c&32) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&32) color = (ci&32) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&32) ? oni : off;
			}
			for(i = 0; i < 3; i++)
			{
				for(j = 0; j < 3; j++)
				{
					t[3+i+256*j+6*256] = color;
				}
			}
			//Left
			if (held&64)	{ //If auto-hold
				if (!(ci&64) ) color = ahold;
				else
					color = (c&64) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&64) color = (ci&64) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&64) ? oni : off;
			}
			for(i = 0; i < 3; i++)
			{
				for(j = 0; j < 3; j++)
				{
					t[3*256+i+256*j] = color;
				}
			}
			//Right
			if (held&128)	{ //If auto-hold
				if (!(ci&128) ) color = ahold;
				else
					color = (c&128) ? on : off; //If the button is pressed down (immediate) that negates auto hold, however it is only off if the previous frame the button wasn't pressed!
			}
			else {
				if (c&128) color = (ci&128) ? blend : on;	//If immedaite buttons are pressed and they match the previous frame, blend the colors
				else color = (ci&128) ? oni : off;
			}
			for(i = 0; i < 3; i++)
			{
				for(j = 0; j < 3; j++)
				{
					t[6+3*256+i+256*j] = color;
				}
			}
		}
void myGlutDisplay(void)
{
//	::glClearColor(0.2, .7, 0.7, 1.0);
	::glClearColor(1.0, 1.0, 1.0, 1.0);
	::glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	::glEnable(GL_DEPTH_TEST);

	::glEnable(GL_POLYGON_OFFSET_FILL );
	::glPolygonOffset( 1.1f, 4.0f );

	::glMatrixMode(GL_MODELVIEW);
	::glLoadIdentity();
	Com::View::SetModelViewTransform(camera);

  ShowBackGround();  
  ShowFPS();
  

  {
    ::glDisable(GL_LIGHTING);
    ::glLineWidth(2);
    /*
    std::vector<unsigned int> aIdL = cad_3d.GetAryElemID(Cad::LOOP);
    for(unsigned int iil=0;iil<aIdL.size();iil++){
      unsigned int id_l = aIdL[iil];
      const Cad::CLoop3D& l = cad_3d.GetLoop(id_l);
      const Com::CVector3D& o = l.org; 
      const Com::CVector3D& n = l.normal;     
      double r = 0.1;
      ::glBegin(GL_LINES);
      ::glColor3d(1,0,0);
      ::glVertex3d(o.x,o.y,o.z);
      ::glVertex3d(o.x+n.x*r,o.y+n.y*r,o.z+n.z*r);
      ::glEnd();
    }
     */
    if( imode == 1 ){
      if( cad_3d.IsElemID(Cad::LOOP,id_loop_selected) ){
        const Cad::CLoop3D& l = cad_3d.GetLoop(id_loop_selected);
        const Com::CVector3D& o0 = l.org; 
        const Com::CVector3D& n0 = l.normal;
        Com::CVector3D x0 = l.dirx;
        Com::CVector3D y0 = Cross(n0,x0);
        x0 = Dot(mouse_pos-picked_pos,x0)*x0;
        y0 = Dot(mouse_pos-picked_pos,y0)*y0;
        const Com::CVector3D& p = picked_pos;
        const Com::CVector3D& px = picked_pos+x0;
        const Com::CVector3D& py = picked_pos+y0;
        const Com::CVector3D& pxy = picked_pos+x0+y0;        
        ::glLineWidth(1);
        ::glColor3d(0,0,0);
        ::glBegin(GL_LINES);
        ::glVertex3d(p.x,p.y,p.z);
        ::glVertex3d(px.x,px.y,px.z);
        ::glVertex3d(p.x,p.y,p.z);
        ::glVertex3d(py.x,py.y,py.z);        
        ::glVertex3d(pxy.x,pxy.y,pxy.z);
        ::glVertex3d(px.x,px.y,px.z);
        ::glVertex3d(pxy.x,pxy.y,pxy.z);
        ::glVertex3d(py.x,py.y,py.z);                
        ::glEnd();
      }
      /*
      ::glBegin(GL_POINTS);
      ::glColor3d(1,0,0);
      ::glVertex3d(picked_pos.x,picked_pos.y,picked_pos.z);
      ::glColor3d(1,0,1);      
      ::glVertex3d(mouse_pos.x,mouse_pos.y,mouse_pos.z);      
      ::glEnd();
       */
    }
    ::glEnable(GL_LIGHTING);        
  }

	drawer_ary.Draw();


	glutSwapBuffers();
}