Esempio n. 1
0
void CDrawUtilities::dbgDrawEdge(const Fvector& p0,	const Fvector& p1, u32 clr, LPCSTR caption)
{
	dbgDrawPlacement(p0,1,clr,caption);
	DrawCross		(p0,0.01f,0.01f,0.01f, 0.01f,0.01f,0.01f, clr,false);
	DrawCross		(p1,0.01f,0.01f,0.01f, 0.01f,0.01f,0.01f, clr,false);
    DrawLine		(p0,p1,clr);
}
Esempio n. 2
0
//----------------------------------------------
// Display current eye position
void OnTimer( HWND hDlgWnd ){
  HWND hPic;
  HDC hDC;
  RECT recClnt;
  int iOffsetX, iOffsetY;
  int iRawX, iRawY, iDigIn;
  double dT_ms, dX, dY;
  static double dPrevX = 0, dPrevY = 0;
  char szTmp[100];


  hPic = GetDlgItem(hDlgWnd, IDC_PICTURE);
  GetClientRect( hPic, &recClnt );

  iOffsetX = ((recClnt.right - recClnt.left) - WIN_SIZE_X)/2;
  iOffsetY = ((recClnt.bottom - recClnt.top) - WIN_SIZE_Y)/2;
  hDC = GetDC(hPic);

  SetROP2( hDC, R2_XORPEN);

  // erase previous
  if( blnIsDrawn ){
    DrawCross( hDC,
              (int)(dPrevX*WIN_SIZE_X) + iOffsetX,  
              (int)(dPrevY*WIN_SIZE_Y) + iOffsetY  );
    blnIsDrawn = FALSE;
  }

  // draw new
  if(  !g_GetLatestRawCoordinates( &dT_ms, &iRawX, &iRawY, &iDigIn  ) ) {
    dX = ((double)iRawX - ISCAN_MIN_X)/ ISCAN_MAX_X; 
    dY = ((double)iRawY - ISCAN_MIN_Y)/ ISCAN_MAX_Y;

    dPrevX = dX;
    dPrevY = dY;
    DrawCross( hDC,
              (int)(dX*WIN_SIZE_X) + iOffsetX,  
              (int)(dY*WIN_SIZE_Y) + iOffsetY  );
    blnIsDrawn = TRUE;
    // Print timestamp
    sprintf(szTmp, "%.2f", dT_ms/1000.0);
    SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_TIME ), szTmp);

    // Print raw coordinates
    sprintf(szTmp, "%d", iRawX);
    SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_RAW_X ), szTmp);
    sprintf(szTmp, "%d", iRawY);
    SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_RAW_Y ), szTmp);
    sprintf(szTmp, "%d", iDigIn);
    SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_DIG_IN ), szTmp);
  }

  ReleaseDC(hPic, hDC); 

}
Esempio n. 3
0
void CDrawUtilities::DrawLineSphere(const Fvector& p, float radius, u32 c, BOOL bCross)
{
	// fill VB
	_VertexStream*	Stream	= &RCache.Vertex;
	u32			vBase;
    int i;
	FVF::L*	pv;
    // seg 0
	pv	 			= (FVF::L*)Stream->Lock(LINE_DIVISION+1,vs_L->vb_stride,vBase);
	for( i=0; i<LINE_DIVISION; i++,pv++){ pv->p.mad(p,circledef1[i],radius); pv->color=c;}
    pv->set(*(pv-LINE_DIVISION));
	Stream->Unlock	(LINE_DIVISION+1,vs_L->vb_stride);
	DU_DRAW_DP		(D3DPT_LINESTRIP,vs_L,vBase,LINE_DIVISION);
    // seg 1
	pv	 			= (FVF::L*)Stream->Lock(LINE_DIVISION+1,vs_L->vb_stride,vBase);
	for( i=0; i<LINE_DIVISION; i++){ pv->p.mad(p,circledef2[i],radius); pv->color=c; pv++; }
    pv->set(*(pv-LINE_DIVISION)); pv++;
	Stream->Unlock	(LINE_DIVISION+1,vs_L->vb_stride);
	DU_DRAW_DP		(D3DPT_LINESTRIP,vs_L,vBase,LINE_DIVISION);
    // seg 2
	pv	 			= (FVF::L*)Stream->Lock(LINE_DIVISION+1,vs_L->vb_stride,vBase);
	for( i=0; i<LINE_DIVISION; i++){ pv->p.mad(p,circledef3[i],radius); pv->color=c; pv++; }
    pv->set(*(pv-LINE_DIVISION)); pv++;
	Stream->Unlock	(LINE_DIVISION+1,vs_L->vb_stride);
	DU_DRAW_DP		(D3DPT_LINESTRIP,vs_L,vBase,LINE_DIVISION);

    if (bCross) DrawCross(p, radius,radius,radius, radius,radius,radius, c);
}
Esempio n. 4
0
		void  CSimpleMarketSymbol::DrawGeometryEx(IDisplay* pDisplay, const GPoint* points, const int* polyCounts, size_t polyCount)
		{
			for(size_t part = 0, offset = 0; part < polyCount; part++)
			{
				for(int point = (int)offset; point < (int)offset + polyCounts[part]; point++)
				{
					switch(m_style)
					{
					case SimpleMarkerStyleCircle:
						DrawCircle(points[point], pDisplay->GetGraphics().get());
						break;
					case SimpleMarkerStyleSquare:
						DrawSquare(points[point], pDisplay->GetGraphics().get());
						break;
					case SimpleMarkerStyleCross:
						DrawCross(points[point], pDisplay->GetGraphics().get());
						break;
					case SimpleMarkerStyleX:
						DrawX(points[point], pDisplay->GetGraphics().get());
						break;
					case SimpleMarkerStyleDiamond:
						DrawDiamond(points[point], pDisplay->GetGraphics().get());
						break;
					}
				}
				offset += polyCounts[part];
			}
		}
Esempio n. 5
0
STDMETHODIMP CamShiftTracker::Process(IplImage *image)
{
    HRESULT hr = MatchFormat(image, &m_image_format);
    if (FAILED(hr))
        return hr;

    if (m_calibrate > 0)
    {
        CvRect rect = cvRect(image->width*0.47, image->height*0.47, image->width*0.06, image->height*0.07);
        cvRectangle(image, cvPoint(rect.x, rect.y), cvPoint(rect.x+rect.width, rect.y+rect.height), 0xffffff, 1);
        set_window(rect);
        update_histogram(static_cast<CvImage *>(image));
        m_calibrate--;
    }
    //else
    {
        track_object(static_cast<CvImage *>(image));

        CvRect rect = get_window();
        CvPoint center = cvPoint(rect.x + rect.width/2, rect.y + rect.height/2);
        DrawCross(image, center);
        cvRectangle(image, cvPoint(rect.x, rect.y), cvPoint(rect.x+rect.width, rect.y+rect.height), 0xffffff, 1);
    }

    return NOERROR;
}
Esempio n. 6
0
Int16
BurnField(UInt16 x, UInt16 y, Int16 forceit)
{
	welem_t node;
	int rv = 0;

	zone_lock(lz_world);
	zone_lock(lz_flags);
	node = getWorld(WORLDPOS(x, y));
	if ((forceit != 0 && node != Z_BRIDGE &&
	    node != Z_REALWATER) ||
	    (node != Z_FIRE1 &&
	    node != Z_FIRE2 &&
	    node != Z_FIRE3 &&
	    node != Z_DIRT &&
	    node != Z_WASTE &&
	    node != Z_FAKEWATER &&
	    node != Z_REALWATER &&
	    node != Z_CRATER &&
	    node != Z_BRIDGE &&
	    ContainsDefence(x, y) == 0)) {
		Build_Destroy(x, y);
		setWorldAndFlag(WORLDPOS(x, y), Z_FIRE1, 1);
		orWorldFlags(WORLDPOS(x, y), SCRATCHDISASTER);
		DrawCross(x, y, 1, 1);
		vgame.BuildCount[bc_fire]++;
		rv = 1;
	}
	zone_unlock(lz_flags);
	zone_unlock(lz_world);
	return (rv);
}
Esempio n. 7
0
void CChoosedView::OnDraw(CDC* /*pDC*/)
{
	CCurveSnapDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	if (!pDoc->extractor.choosedShower.IsEmpty())
	{
		// note that the shower will get DC from the WND, so don't use pdc above
		// using more than one dc from the same wnd is not stable
		// it may cause the latter DrawCross bugging.
		pDoc->extractor.choosedShower.Show(this->m_hWnd, cvx::SW_STRETCH);

		if (!pDoc->extractor.singlePoints.empty())
		{
			CDC* pdc = this->GetDC();
			COLORREF colorCross = pDoc->extractor.IsChoosedShowerBgBlack()? RGB(255,255,255) : RGB(255,0,0);

			for (list<cv::Point2d>::iterator it = pDoc->extractor.singlePoints.begin();
					it != pDoc->extractor.singlePoints.end(); ++it)
			{
				DrawCross(pdc, pDoc->extractor.choosedShower.Original2Show(*it),
					3, colorCross);
			}
			this->ReleaseDC(pdc);
		}
	}
}
void CRecognizerContainer::DrawImage(const CFbsBitmap* aImage) const
{
	CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("DrawImage"));

	CWindowGc& gc = SystemGc();
	gc.Activate(Window());
	gc.Clear();

	TSize si = aImage->SizeInPixels();
	TInt wi = si.iWidth;
	TInt hi = si.iHeight;

	TInt wr = Rect().iBr.iX;
	TInt hr = Rect().iBr.iY;
	TPoint tl;
	tl.iX = (wr - wi) >> 1;
	tl.iY = (hr - hi) >> 1;
	gc.BitBlt(tl, aImage);

	if (iTranslation.iX == 0 && iTranslation.iY == 0) {
		ShowCodes(TRect(tl.iX, tl.iY, tl.iX + wi, tl.iY + hi), si);
	}

	// draw cross
	gc.SetPenStyle(CGraphicsContext::ESolidPen);
	gc.SetPenColor(KRgbWhite);
	TPoint center = Rect().Center();
	DrawCross(gc, center);

	gc.Deactivate();
	iCoeEnv->WsSession().Flush();
}
Esempio n. 9
0
/*画棋盘*/
void DrawMap(void)
{
  int i,j;
  clrscr();
  for(i=0;i<19;i++)
    for(j=0;j<19;j++)
      DrawCross(i,j);
}
Esempio n. 10
0
//
// Draw
//
void CamShift::DrawOverlay(IplImage* image, int overlay_level) const
{
  if (m_tracking && overlay_level>1) {
    if (overlay_level>2 && m_pProbProv==NULL) {
      CheckBackProject(image, 1);
    }
    DrawCross(image);
  }
} // Draw
Esempio n. 11
0
Status GraphicsEx::DrawCrosses(IN const Pen* pen, IN const PointF* points,
                               IN INT count, IN REAL extent)
{
    Status s = Ok;
    for (uint i = 0; i < (uint)count && s == Ok; i++) {
        s = DrawCross(pen, points[i], extent);
    }
    return s;
}
Esempio n. 12
0
void DisplayCalibration(
    IplImage* displayImage, 
    const QLCalibrationTarget* targets, 
    const QLCalibrationScore* leftScores, 
    const QLCalibrationScore* rightScores,
    int numTargets,
    const char * windowName)
{
    int tx = 0;
    int ty = 0;

    //Clear the calibration window
    memset(displayImage->imageData, 128, displayImage->imageSize);

    //Loop through each target.
    printf_s("\nCalibration Scores\n");
	for (int i = 0; i < numTargets; i++)
    {
        // Draw the target positions
        tx = (int)targets[i].x * displayImage->width / 100;
        ty = (int)targets[i].y * displayImage->height / 100;
        DrawTarget(displayImage, cvPoint(tx, ty),  20, CV_RGB(50, 50, 50));

        // Draw the left 
        tx = (int)(targets[i].x + leftScores[i].x) * displayImage->width / 100;
        ty = (int)(targets[i].y + leftScores[i].y) * displayImage->height / 100;
        DrawCross(displayImage, cvPoint(tx, ty), 10, CV_RGB(0, 255, 255), 1);

        // Draw the right 
        tx = (int)(targets[i].x + rightScores[i].x) * displayImage->width / 100;
        ty = (int)(targets[i].y + rightScores[i].y) * displayImage->height / 100;
        DrawCross(displayImage, cvPoint(tx, ty), 10, CV_RGB(255, 0, 0), 1);

	    cvShowImage(windowName, displayImage);

        printf_s("%2.2f %2.2f ", leftScores[i].score, rightScores[i].score);
    }
    printf_s("\n");


};
Esempio n. 13
0
SmartPointer<SDL_Surface> minimapForLevel(const std::string& f, bool absolute) {
	LevelInfo info = infoForLevel(f, absolute);
	
	std::auto_ptr<MapLoad> loader( MapLoad::open(absolute ? f : ("levels/" + f), absolute, false) );
	if(!loader.get()) {
		SmartPointer<SDL_Surface> minimap = gfxCreateSurface(128,96);
		DrawCross(minimap.get(), 0, 0, 128, 96, Color(0,0,255));
		return minimap;
	}
	
	return loader->getMinimap();
}
Esempio n. 14
0
void DrawJoint( AcGiWorldDraw* mode, const AcGePoint3d& pt, double radius, JointDrawType jdt )
{
    if( jdt == JDT_CROSS )
    {
        DrawCircle( mode, pt, radius, false );
        DrawCross( mode, pt, radius );
    }
    else if( jdt == JDT_FILL )
    {
        DrawCircle( mode, pt, radius, true );
    }
}
void CScanImage::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	int nWidth=m_nBoxWidth;
	int nHeight=m_nBoxHeight;
	int nXPos=m_nXPos;
	int nYPos=m_nYPos;
	DrawCross(nWidth,nHeight,nXPos,nYPos);//画十字叉

	// Do not call CDialog::OnPaint() for painting messages
}
int CBulletManager::CBullet::DrawModel( int flags )
{
	if (m_flCurrAlpha < 0)
		return 0;

	if (flags & STUDIO_SHADOWDEPTHTEXTURE)
		return 0;

#ifdef __linux__
	return 0;
#endif

	if (!g_hBulletStreak.IsValid())
		g_hBulletStreak.Init( "effects/tracer1.vmt", TEXTURE_GROUP_OTHER );

	float flAlpha = 150.5f/255.0f * m_flCurrAlpha;

	Vector vecRight = Vector(0, 0, 1).Cross(m_vecDirection).Normalized();
	Vector vecCross1 = (Vector(0, 0, 1) + vecRight).Normalized();
	Vector vecCross2 = (Vector(0, 0, 1) - vecRight).Normalized();

	CMeshBuilder meshBuilder;

	CMatRenderContextPtr pRenderContext( materials );
	pRenderContext->Bind( g_hBulletStreak );
	IMesh* pMesh = pRenderContext->GetDynamicMesh();

	meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

	DrawCross(meshBuilder, GetRenderOrigin(), vecCross1, m_vecDirection, flAlpha);
	DrawCross(meshBuilder, GetRenderOrigin(), vecCross2, m_vecDirection, flAlpha);

	meshBuilder.End(false, true);

	return 1;
}
Esempio n. 17
0
void DirectXT::Render()
{
	if (Valid())
	{
		DXDevice->Clear(NULL, NULL, D3DCLEAR_TARGET, NULL, 1, NULL);
		DXDevice->BeginScene();
		DrawCross(Overlay->Width / 2, Overlay->Height / 2, 15, 1, D3DCOLOR_RGBA(0, 255, 0, 255), true, 1, D3DCOLOR_RGBA(0, 0, 0, 255));
		if (Globals->DebugSettings.EnableDebugLog)
		{
			DrawString(Overlay->X, Overlay->Y, Debug->DebugLog, Globals->DebugSettings.TextColor, Globals->DebugSettings.DrawTextOutline,  Globals->DebugSettings.TextOutlineColor);
		}
		DXDevice->EndScene();
		DXDevice->PresentEx(NULL, NULL, NULL, NULL, NULL);
	}
}
Esempio n. 18
0
void ControlPad::OnPaint(HDC hDC)
{
	RECT rcClient;
	GetClientRect(&rcClient);

	// Standard Setup
	HDC hMemDC = ::CreateCompatibleDC(hDC);
	if (hMemDC)
	{
		HBITMAP hBmp   = ::CreateCompatibleBitmap(hDC, m_nWidth, m_nHeight);
		HGDIOBJ hOldBmp = ::SelectObject(hMemDC, hBmp);
	
		DrawBackground(hMemDC);
		DrawHint(hMemDC);
		DrawCross(hMemDC);
		DrawTextLabels(hMemDC);
		POINT ptDeflection;

		if (m_fAction)
		{
			ptDeflection.x = m_ptCurrent.x;
			ptDeflection.y = m_ptCurrent.y;
		}
		else
		{
			ptDeflection.x = m_nWidth/2;
			ptDeflection.y = m_nHeight/2;
		}

		DrawControl(hMemDC, &ptDeflection);

		// Copies the source rectangle directly to the destination rectangle
		::BitBlt(hDC, 0, 0, m_nWidth, m_nHeight, hMemDC, 0, 0, SRCCOPY);

		// Standard End
		::SelectObject(hMemDC, hOldBmp);
		::DeleteDC(hMemDC);
		::DeleteObject(hBmp); 
	}
	else
	{
		// Error handler here
		TRACE2("Memory DC failed: %#X, %d\n", hDC, GetLastError());
	}

}
Esempio n. 19
0
/*******************************************************************************
* Function Name  : TouchPanel_Calibrate
* Description    : 校准触摸屏
* Input          : None
* Output         : None
* Return         : None
* Attention		 : None
*******************************************************************************/
void TouchPanel_Calibrate(void)
{
  uint8_t i;
  Coordinate * Ptr;

  for(i=0;i<3;i++)
  {
   LCD_Clear(White);
   GUI_Text(10,10,"Touch crosshair to calibrate",Black,White);   
   DelayUS(1000 * 500);
   DrawCross(DisplaySample[i].x,DisplaySample[i].y);
   do
   {
   Ptr = Read_Ads7846();
   }
   while( Ptr == (void*)0 );
   ScreenSample[i].x = Ptr->x; ScreenSample[i].y = Ptr->y;
  }
  setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix ) ;  /* 送入值得到参数 */	   
  LCD_Clear(White);
} 
Esempio n. 20
0
/*******************************************************************************
* Function Name  : TouchPanel_Calibrate
* Description    : 
* Input          : None
* Output         : None
* Return         : None
* Attention		 : None
*******************************************************************************/
void TouchPanel_Calibrate(void)
{
  uint8_t i;
  Coordinate * Ptr;

  for(i=0;i<3;i++)
  {
   LCD_Clear(Black);
   GUI_Text(44,10,"Touch crosshair to calibrate",0xffff,Black);
   delay_ms(300);
   DrawCross(DisplaySample[i].x,DisplaySample[i].y);
   do
   {
     Ptr=Read_Ads7846();
   }
   while( Ptr == (void*)0 );
   ScreenSample[i].x= Ptr->x; ScreenSample[i].y= Ptr->y;
  }
  setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix );
  LCD_Clear(Black);
} 
Esempio n. 21
0
/*******************************************************************************
* Function Name  : TouchPanel_Calibrate
* Description    : У׼´¥ÃþÆÁ
* Input          : None
* Output         : None
* Return         : None
* Attention		 : None
*******************************************************************************/
void TouchPanel_Calibrate(void)
{
  uint8_t i;
  Coordinate * Ptr;
  for(i=0;i<3;i++)
  {
   LCD_Clear(BLACK);
   //LCD_SetTextColor(BLUE);
   //LCD_SetBackColor(BLACK);
   //LCD_StringLine(10,10,"Touch crosshair to calibrate");
   GUI_Text(10, 10, "Touch crosshair to calibrate",BLUE,BLACK);
   Delay(0xFFFFFF);
   DrawCross(DisplaySample[i].x,DisplaySample[i].y);
   do
   {
   Ptr=Read_Ads7846();
   }
   while( Ptr == (void*)0 );
   ScreenSample[i].x= Ptr->x; ScreenSample[i].y= Ptr->y;
  }
  setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix ) ;  /* ËÍÈëÖµµÃµ½²ÎÊý */	
  LCD_Clear(BLACK);
}
Esempio n. 22
0
/*!
 * \brief Turn the zone into wasteland
 * \param x x position to affect
 * \param y y position to affect
 */
static void
CreateWaste(UInt16 x, UInt16 y)
{
	welem_t node;

	zone_lock(lz_world);
	zone_lock(lz_flags);
	node = getWorld(WORLDPOS(x, y));
	Build_Destroy(x, y);
	if (node == Z_REALWATER || IsRoadBridge(node)) {
		zone_unlock(lz_flags);
		zone_unlock(lz_world);
		return;
	}
	setWorldAndFlag(WORLDPOS(x, y), Z_WASTE, 0);
	vgame.BuildCount[bc_waste]++;
	DrawCross(x, y, 1, 1);
	zone_unlock(lz_flags);
	zone_unlock(lz_world);
	if (node == Z_COALPLANT || node == Z_NUCLEARPLANT)  {
		UIDisasterNotify(diPlantExplosion);
		FireSpread(x, y);
	}
}
Esempio n. 23
0
    /*****************************************************************************
    * FUNCTION - Redraw
    * DESCRIPTION: See header file
    *****************************************************************************/
    void CrossChalk::Redraw()
    {
      if ((mpBlackBoard != NULL) && (mpData != NULL))
      {
        int width = mpBlackBoard->GetWidth();
        int height = mpBlackBoard->GetHeight();
        int length = mpData->GetSize();

        if (length > width)
        {
          length = width;
        }

        GUI_SetLineStyle(GUI_LS_SOLID);
        GUI_SetColor(mpBlackBoard->GetColour());

        GUI_RECT rect;
        GUI_GetClientRect(&rect);

        mpData->Lock();
        
        for (int i = 0; i < length; i++)
        {
          if (mpData->IsCurveValueValid(i))
          {
            float val = mpData->GetCurveValueAsPercent(i);
            
            int y = height - 1 - (int)(val * (height - 1) / 100.0f);
 
            DrawCross(i, y);
          }
        }
        
        mpData->UnLock();
      }
    }
Esempio n. 24
0
void CDrawUtilities::dbgDrawVert(const Fvector& p0, u32 clr, LPCSTR caption)
{
	dbgDrawPlacement(p0,1,clr,caption);
	DrawCross		(p0,0.01f,0.01f,0.01f, 0.01f,0.01f,0.01f, clr,false);
}
Esempio n. 25
0
//----------------------------------------------
// Display current sensor position
void OnTimer( HWND hDlgWnd ){
  int iFrame;
  double dT_ms;
  double adXYZ[N_DISPL_SENSORS][N_COORD_ANGL];
  int aiDistortion[N_DISPL_SENSORS];
  HWND hPic;
  HDC hDC, hBitmapDC;
  HBITMAP hBitmap;
  RECT recClnt;
  int iSensor;
  int iOffsetX, iOffsetY;
  int iW, iH;
  int nSensors;
  double dSensX, dSensY;
  double dX, dY;
  char szTmp[100];

  ZeroMemory(adXYZ, sizeof(adXYZ));
  if( g_GetLatestCoordinates( &nSensors, &iFrame, &dT_ms, adXYZ ) ) return; 
  g_GetSignalDistortion( aiDistortion );

  hPic = GetDlgItem(hDlgWnd, IDC_PICTURE);
  GetClientRect( hPic, &recClnt );

  iW = (recClnt.right - recClnt.left);
  iH = (recClnt.bottom - recClnt.top);
  iOffsetX = (iW - WIN_SIZE_X)/2;
  iOffsetY = (iH - WIN_SIZE_Y)/2;
  hDC = GetDC(hPic);

  // to avoid flicker we draw on the off-screen bitmap and then copy it to the screen
  hBitmapDC = CreateCompatibleDC ( hDC );
  hBitmap = CreateCompatibleBitmap ( hDC, iW, iH );
  SelectObject ( hBitmapDC, hBitmap ); // map DC to the off-screen bitmap
  // Black backgound
  SelectObject( hBitmapDC, GetStockObject( BLACK_BRUSH ));
  Rectangle( hBitmapDC, recClnt.left, recClnt.top, 
                        recClnt.right, recClnt.bottom);
  // White box
  SelectObject( hBitmapDC, GetStockObject( WHITE_PEN ));
  Rectangle( hBitmapDC, iOffsetX, iOffsetY, 
                        WIN_SIZE_X+iOffsetX, WIN_SIZE_Y+iOffsetY );

  for( iSensor = 0; iSensor < nSensors; iSensor++){
    dSensX = adXYZ[iSensor][0];
    dSensY = adXYZ[iSensor][1];
    // normalize coordinates to 0-1 
    dX = (dSensX - RAW_MIN_X)/ (RAW_MAX_X - RAW_MIN_X);  
    dY = (RAW_MAX_Y - dSensY)/ (RAW_MAX_Y - RAW_MIN_Y);  // make Y axis bottom->top

    // clip coordinates
    if(dX < 0) dX = 0;
    if(dX > 1) dX = 1;
    if(dY < 0) dY = 0;
    if(dY > 1) dY = 1;

    DrawCross( hBitmapDC, x_atMarkerColors[iSensor],
              (int)(dX*WIN_SIZE_X) + iOffsetX,  
              (int)(dY*WIN_SIZE_Y) + iOffsetY  );
  } // for all sensors

  // Draw bitmap
  BitBlt(hDC, recClnt.left, recClnt.top, iW, iH, 
         hBitmapDC, 0, 0, SRCCOPY);

  DeleteObject(hBitmap);
  DeleteDC(hBitmapDC);
  ReleaseDC(hPic, hDC); 

  DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[0]],  IDC_PIC_SENS1);
  DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[1]],  IDC_PIC_SENS2);
  DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[2]],  IDC_PIC_SENS3);
  DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[3]],  IDC_PIC_SENS4);

  // Print timestamp
  sprintf(szTmp, "%.2f", dT_ms/1000.0);
  SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_TIME ), szTmp);
  // Print frame
  sprintf(szTmp, "%d", iFrame);
  SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_IFRAME ), szTmp);

  // Print coordinates
  PrintCoord(hDlgWnd, adXYZ[0][0], IDC_LBL_X1);
  PrintCoord(hDlgWnd, adXYZ[0][1], IDC_LBL_Y1);
  PrintCoord(hDlgWnd, adXYZ[0][2], IDC_LBL_Z1);

  PrintCoord(hDlgWnd, adXYZ[1][0], IDC_LBL_X2);
  PrintCoord(hDlgWnd, adXYZ[1][1], IDC_LBL_Y2);
  PrintCoord(hDlgWnd, adXYZ[1][2], IDC_LBL_Z2);

  PrintCoord(hDlgWnd, adXYZ[2][0], IDC_LBL_X3);
  PrintCoord(hDlgWnd, adXYZ[2][1], IDC_LBL_Y3);
  PrintCoord(hDlgWnd, adXYZ[2][2], IDC_LBL_Z3);

  PrintCoord(hDlgWnd, adXYZ[3][0], IDC_LBL_X4);
  PrintCoord(hDlgWnd, adXYZ[3][1], IDC_LBL_Y4);
  PrintCoord(hDlgWnd, adXYZ[3][2], IDC_LBL_Z4);

}
Esempio n. 26
0
int CHudRadar::Draw(float flTime)
{
	if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) ||
		 gEngfuncs.IsSpectateOnly() ||
		 !(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT))) ||
		 gHUD.m_fPlayerDead )
		return 1;

	int iTeamNumber = g_PlayerExtraInfo[ gHUD.m_Scoreboard.m_iPlayerNum ].teamnumber;
	int r, g, b;

	if( cl_radartype->value )
	{
		SPR_Set(m_hRadarOpaque.spr, 200, 200, 200);
		SPR_DrawHoles(0, 0, 0, &m_hRadarOpaque.rect);
	}
	else
	{
		SPR_Set( m_hRadar.spr, 25, 75, 25 );
		SPR_DrawAdditive( 0, 0, 0, &m_hRadarOpaque.rect );
	}

	if( bUseRenderAPI )
	{
		gEngfuncs.pTriAPI->RenderMode( kRenderTransAdd );
		gEngfuncs.pTriAPI->CullFace( TRI_NONE );
		gEngfuncs.pTriAPI->Brightness( 1 );
		gRenderAPI.GL_SelectTexture( 0 );
	}

	for(int i = 0; i < 33; i++)
	{
		// skip local player and dead players
		if( i == gHUD.m_Scoreboard.m_iPlayerNum || g_PlayerExtraInfo[i].dead )
			continue;

		// skip non-teammates
		if( g_PlayerExtraInfo[i].teamnumber != iTeamNumber )
			continue;

		// decide should player draw at this time. For flashing.
		// Always true for non-flashing players
		if( !FlashTime( flTime, &g_PlayerExtraInfo[i]) )
			continue;

		// player with C4 must be red
		if( g_PlayerExtraInfo[i].has_c4 )
		{
			DrawUtils::UnpackRGB( r, g, b, RGB_REDISH );
		}
		else
		{
			// white
			DrawUtils::UnpackRGB( r, g, b, RGB_WHITE );
		}

		// calc radar position
		Vector pos = WorldToRadar(gHUD.m_vecOrigin, g_PlayerExtraInfo[i].origin, gHUD.m_vecAngles);

		DrawZAxis( pos, r, g, b, 255 );
	}

	// Terrorist specific code( C4 Bomb )
	if( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_TERRORIST )
	{
		if ( !g_PlayerExtraInfo[33].dead &&
			 g_PlayerExtraInfo[33].radarflashes &&
			 FlashTime( flTime, &g_PlayerExtraInfo[33] ))
		{
			Vector pos = WorldToRadar(gHUD.m_vecOrigin, g_PlayerExtraInfo[33].origin, gHUD.m_vecAngles);
			if( g_PlayerExtraInfo[33].playerclass ) // bomb planted
			{
				DrawCross( pos.x, pos.y, 255, 0, 0, 255 );
			}
			else
			{
				DrawZAxis( pos, 255, 0, 0, 255 );
			}
		}
	}
	// Counter-Terrorist specific code( hostages )
	else if( g_PlayerExtraInfo[gHUD.m_Scoreboard.m_iPlayerNum].teamnumber == TEAM_CT )
	{
		// draw hostages for CT
		for( int i = 0; i < MAX_HOSTAGES; i++ )
		{
			if( !HostageFlashTime( flTime, g_HostageInfo + i ) )
			{
				continue;
			}

			Vector pos = WorldToRadar(gHUD.m_vecOrigin, g_HostageInfo[i].origin, gHUD.m_vecAngles);
			if( g_HostageInfo[i].dead )
			{
				DrawZAxis( pos, 255, 0, 0, 255 );
			}
			else
			{
				DrawZAxis( pos, 4, 25, 110, 255 );
			}
		}
	}

	return 0;
}
Esempio n. 27
0
static void DisplayObjective(TTileItem * t, int objectiveIndex)
{
	DrawCross(t, gMission.objectives[objectiveIndex].color);
}
Esempio n. 28
0
void CDrawUtilities::DrawPointLight(const Fvector& p, float radius, u32 c)
{
	RCache.set_xform_world(Fidentity);
	DrawCross(p, radius,radius,radius, radius,radius,radius, c, true);
}
Esempio n. 29
0
void CDrawUtilities::DrawPivot(const Fvector& pos, float sz){
	DU_DRAW_SH(dxRenderDeviceRender::Instance().m_WireShader);
    DrawCross(pos, sz, sz, sz, sz, sz, sz, 0xFF7FFF7F);
}
Esempio n. 30
0
void CDrawUtilities::DrawSound(const Fvector& p, float r, u32 c){
	DrawCross(p, r,r,r, r,r,r, c, true);
}