Exemplo n.º 1
0
bool SDLRenderer::blitBackBufferToScreen() {
  IntegerSize sizeBackBuffer(m_pBackBufferSurface->sizePixels());
  SDL_Rect rectBackBuffer(convertSizeToRect(sizeBackBuffer));
  IntegerSize sizeScreen(m_pScreenSurface->sizePixels());
  SDL_Rect rectScreen(convertSizeToRect(sizeScreen));
  int result = SDL_BlitSurface(
      m_pBackBufferSurface->rawSurfacePtr(),
      &rectBackBuffer,
      m_pScreenSurface->rawSurfacePtr(),
      &rectScreen);
  bool didRender = (result == 0);
  if (!didRender) {
    return false;
  }
  SDL_UpdateRect(
      m_pScreenSurface->rawSurfacePtr(),
      rectScreen.x,
      rectScreen.y,
      rectScreen.w,
      rectScreen.h);
#ifdef DEBUG
  std::cout << "SDLRenderer::blitBackBufferToScreen result " << result << " ";
  std::cout << (didRender ? "" : "not ") << "did render" << std::endl;
  std::cout << "sizeBackBuffer " << sizeBackBuffer << std::endl;
  std::cout << "sizeScreen " << sizeScreen << std::endl;
#endif
  return didRender;
}
/*---------------------------------------------------------------------*//**
	作成
**//*---------------------------------------------------------------------*/
bool GameActMsgWindow::create(Font* fontRef, Texture* texRef)
{
	RectF32 rectWnd(X_THIS, Y_THIS, W_THIS, H_THIS);
	RectF32 rectScreen(0, 0, Game::getGame()->getLogicalWidth(), Game::getGame()->getLogicalHeight());
	return ActionMsgWindow::create(
		&rectWnd,
		&rectScreen,
		fontRef,
		texRef );
}
Exemplo n.º 3
0
void CCWidget::Draw(CCDrawContext* pDC){
	if(m_bVisible==false) return;

	unsigned char nLastOpacity;
	nLastOpacity = pDC->GetOpacity();

	sRect sr = GetScreenRect();
	pDC->SetOrigin(sPoint(sr.x, sr.y));

	if(m_pFont!=NULL) pDC->SetFont(m_pFont);
	else pDC->SetFont(CCFontManager::Get(NULL));

	pDC->SetOpacity((unsigned char)(nLastOpacity * (float)(m_iOpacity / 255.0f)));
	if(!IsEnable())
		pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70));	

	bool bIntersect = true;
	sRect rectScreen(0, 0, CCGetWorkspaceWidth()-1, CCGetWorkspaceHeight()-1);
	sRect PrevClipRect;
	if(GetParent()!=NULL) {
		sRect parentClipRect = CCClientToScreen(GetParent(), GetParent()->GetClientRect());
		bIntersect = rectScreen.Intersect(&PrevClipRect,parentClipRect);
	}else
		PrevClipRect = rectScreen;

	sRect CurrClipRect = GetScreenRect();
	sRect IntersectClipRect;

	if(m_bClipByParent==true){
		if(PrevClipRect.Intersect(&IntersectClipRect, CurrClipRect)==true){
			sRect test = IntersectClipRect;
			if(IntersectClipRect.w>0 && IntersectClipRect.h>0) {
				pDC->SetClipRect(IntersectClipRect);
				OnDraw(pDC);
			}
		}
	}
	else{
		pDC->SetClipRect(CurrClipRect);
		OnDraw(pDC);
	}

	for(int i=0; i<m_Children.GetCount(); i++){
		CCWidget* pCurWnd = m_Children.Get(i);
		if(pCurWnd==GetLatestExclusive()) continue;
		if(pCurWnd != NULL ) pCurWnd->Draw(pDC);
	}
	if(GetLatestExclusive()!=NULL) 
		GetLatestExclusive()->Draw(pDC);

	pDC->SetOpacity(nLastOpacity);
}
Exemplo n.º 4
0
void CWordPadApp::LoadOptions()
{
	BYTE* pb = NULL;
	UINT nLen = 0;

	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
	if (hFont == NULL)
		hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
	VERIFY(::GetObject(hFont, sizeof(LOGFONT), &m_lf));

	m_bWordSel = GetProfileInt(szSection, szWordSel, TRUE);
	TCHAR buf[2];
	buf[0] = NULL;
	GetLocaleInfo(GetUserDefaultLCID(), LOCALE_IMEASURE, buf, 2);
	int nDefUnits = buf[0] == '1' ? 0 : 1;
	SetUnits(GetProfileInt(szSection, szUnits, nDefUnits));
	m_bMaximized = GetProfileInt(szSection, szMaximized, (int)FALSE);

	if (GetProfileBinary(szSection, szFrameRect, &pb, &nLen))
	{
		ASSERT(nLen == sizeof(CRect));
		memcpy(&m_rectInitialFrame, pb, sizeof(CRect));
		delete pb;
	}
	else
		m_rectInitialFrame.SetRect(0,0,0,0);

	CRect rectScreen(0, 0, GetSystemMetrics(SM_CXSCREEN),
		GetSystemMetrics(SM_CYSCREEN));
	CRect rectInt;
	rectInt.IntersectRect(&rectScreen, &m_rectInitialFrame);
	if (rectInt.Width() < 10 || rectInt.Height() < 10)
		m_rectInitialFrame.SetRect(0, 0, 0, 0);

	if (GetProfileBinary(szSection, szPageMargin, &pb, &nLen))
	{
		ASSERT(nLen == sizeof(CRect));
		memcpy(&m_rectPageMargin, pb, sizeof(CRect));
		delete pb;
	}
	else
		m_rectPageMargin.SetRect(1800, 1440, 1800, 1440);

	m_optionsText.LoadOptions(szTextSection);
	m_optionsRTF.LoadOptions(szRTFSection);
	m_optionsWord.LoadOptions(szWordSection);
	m_optionsWrite.LoadOptions(szWriteSection);
	m_optionsIP.LoadOptions(szIPSection);
}