Beispiel #1
0
BOOL CMainWnd::DrawCtrlBoard(HDC hDC)
{
	LOGBRUSH lb;//画刷描述符
	HBRUSH hBrush, hOldBrush;//画刷句柄
	HFONT hFont, hOldFont;//字体句柄
	int FontW, FontH;//名字体宽、高

	SetBkMode(hDC, TRANSPARENT);//设置背景混合模式为透明

	//填充背景色为银灰色
	lb.lbStyle = BS_SOLID;
	lb.lbColor = RGB(230, 230, 230);
	lb.lbHatch = NULL;
	hBrush = CreateBrushIndirect(&lb);
	hOldBrush = (HBRUSH)SelectObject(hDC, hBrush);
	//FillRect填充矩形不包括右、下边界,故需要扩展矩形区域
	RECT tRect = rtInfoPart;
	tRect.right++;
	tRect.bottom++;
	FillRect(hDC, &tRect, hBrush);
	SelectObject(hDC, hOldBrush);
	DeleteObject(hBrush);

	//绘制静态框
	DrawStatic(hDC, &rtSBlc, "Black(先手)", RGB(230, 230, 230), RGB(150, 150, 150), edge);//绘制黑方静态框
	DrawStatic(hDC, &rtSWht, "White(后手)", RGB(230, 230, 230), RGB(150, 150, 150), edge);//绘制白方静态框

	//绘制引擎名
	FontW = (int)((rtBlcName.right - rtBlcName.left + 1) / strlen(strBlcName));
	FontH = (rtBlcName.bottom - rtBlcName.top + 1);
	hFont = CreateSimpleFont(FontW, FontH);
	hOldFont = (HFONT)SelectObject(hDC, hFont);
	DrawText(hDC, strBlcName, strlen(strBlcName), &rtBlcName, DT_CENTER);//绘制黑方引擎的名字
	SelectObject(hDC, hOldFont);
	DeleteObject(hFont);

	FontW = (int)((rtWhtName.right - rtWhtName.left + 1) / strlen(strWhtName));
	FontH = (rtWhtName.bottom - rtWhtName.top + 1);
	hFont = CreateSimpleFont(FontW, FontH);
	hOldFont = (HFONT)SelectObject(hDC, hFont);
	DrawText(hDC, strWhtName, strlen(strWhtName), &rtWhtName, DT_CENTER);//绘制白方引擎的名字
	SelectObject(hDC, hOldFont);
	DeleteObject(hFont);

	//绘制计时
	FontW = (int)((rtBlcTime.right - rtBlcTime.left + 1) / strlen(strBlcTime));
	FontH = (rtBlcTime.bottom - rtBlcTime.top + 1);
	hFont = CreateSimpleFont(FontW, FontH);
	hOldFont = (HFONT)SelectObject(hDC, hFont);
	DrawText(hDC, strBlcTime, strlen(strBlcTime), &rtBlcTime, DT_CENTER);//绘制黑方引擎所需时间
	DrawText(hDC, strWhtTime, strlen(strWhtTime), &rtWhtTime, DT_CENTER);//绘制白方引擎所需时间
	SelectObject(hDC, hOldFont);
	DeleteObject(hFont);

	return true;
}
Beispiel #2
0
  void TUI::Redraw (int drawFlags)
  {
    // Redraw the "static" background
    if (simpleMode)
    {
      DrawSimple ();
      return;
    }

    // Clear
    if (drawFlags & TUI_DRAW_CLEAR)
      csPrintf (CS_ANSI_CLEAR_SCREEN);

    // Screen layout (keep to 80x25...)
    if (drawFlags & TUI_DRAW_STATIC)
      DrawStatic ();

    // Draw progress
    if (drawFlags & TUI_DRAW_PROGRESS)
      DrawProgress ();

    // Draw messages
    if (drawFlags & TUI_DRAW_MESSAGES)
      DrawMessage ();

    // Draw RayCore stats
    if (drawFlags & TUI_DRAW_RAYCORE)
      DrawRayCore ();

    // Draw photonmapper stats
    if (drawFlags & TUI_DRAW_PMCORE)
      DrawPMCore ();

    // Draw global settings
    if (drawFlags & TUI_DRAW_SETTINGS)
      DrawSettings ();
      
    // Draw global stats
    if (drawFlags & TUI_DRAW_STATS)
      DrawStats ();
      
    if (drawFlags & TUI_DRAW_SWAPCACHE)
      DrawSwapCacheStats ();

    /* Linux: output is buffered, and the UI may appear "incomplete" if not 
     * flushed */
    fflush (stdout);
  }