Esempio n. 1
0
void TToweredTrainUnit::Draw()
{
    TField *f = GetField(X, Y);
    TSprite *s, *sst;
    int rrx = GetRelX(X), rry = GetRelY(Y);
    int drawx = 28 * (rrx - rry) + LittleX + 28;
    int drawy = 14 * (rrx + rry - (f->Height)) + LittleY + 14;
    
    if ((!SelectCrossLock) && (SelectedUnit == this)) {
        void *oldb = MapBuf;
        MapBuf = FullBuf;
        DrawL2Selector(drawx-LittleX, drawy+28-LittleY, f->Terrain, BmpSelected);
        MapBuf = oldb;
  }

    s = GetSprite();
    DrawSprite(drawx, drawy, s);
    if (ActualSprite < 8/*tj.jsme v rovine*/) {
        s = UnitsSprites[Type][40 + WpnOrient];
        DrawSprite(drawx + SpriteLocators[Type][SpriteOrient*2], 
                   drawy + SpriteLocators[Type][SpriteOrient*2+1], s);
    }

    s = GetSmoke();
    if (s) DrawSprite(drawx, drawy, s);

    if (iniShowStatusbar && (!StatusbarLock)) {
        if ((sst = GetStatusBar()) != NULL) {
            DrawSprite(drawx, drawy, sst);
            memfree(sst);
        }
    }
    GetDrawRect(&(LD_rect[ID])); LD_used[ID] = TRUE;
}
bool CPDF_ImageRenderer::DrawMaskedImage() {
  if (NotDrawing()) {
    m_Result = false;
    return false;
  }

  FX_RECT rect = GetDrawRect();
  if (rect.IsEmpty())
    return false;

  CFX_Matrix new_matrix = GetDrawMatrix(rect);
  CFX_FxgeDevice bitmap_device1;
  if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr))
    return true;

#if defined _SKIA_SUPPORT_
  bitmap_device1.Clear(0xffffff);
#else
  bitmap_device1.GetBitmap()->Clear(0xffffff);
#endif
  CPDF_RenderStatus bitmap_render;
  bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1,
                           nullptr, nullptr, nullptr, nullptr, nullptr, 0,
                           m_pRenderStatus->m_bDropObjects, nullptr, true);
  CPDF_ImageRenderer image_render;
  if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix,
                         m_Flags, true, FXDIB_BLEND_NORMAL)) {
    image_render.Continue(nullptr);
  }
  CFX_FxgeDevice bitmap_device2;
  if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb,
                             nullptr))
    return true;

#if defined _SKIA_SUPPORT_
  bitmap_device2.Clear(0);
#else
  bitmap_device2.GetBitmap()->Clear(0);
#endif
  CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_Loader.m_pMask,
                     &new_matrix, rect);
#ifdef _SKIA_SUPPORT_
  m_pRenderStatus->m_pDevice->SetBitsWithMask(
      bitmap_device1.GetBitmap(), bitmap_device2.GetBitmap(), rect.left,
      rect.top, m_BitmapAlpha, m_BlendType);
#else
  bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask);
  bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap());
  if (m_BitmapAlpha < 255)
    bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha);
  m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
      bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
#endif  //  _SKIA_SUPPORT_
  return false;
}
Esempio n. 3
0
TInt CDrawFourBppScreenBitmapGray::InitScreen()
	{
	TRect drawRect;
	GetDrawRect(drawRect);
    RWindows* window = ::WindowHandler(iScreenNo);
	window->iDisplayMode = DisplayMode();
	window->iEpocBitmapSize = drawRect.Size();
	window->iEpocBitmapLinePitch = (iScanLineWords*4);

	return KErrNone;
	}
Esempio n. 4
0
void CCircCtrl::FlashColor(CDC* pdc)
{
	CBrush* pOldBrush;
	CBrush flashBrush(TranslateColor(m_flashColor));
	CPen* pOldPen;
	CRect rc;

	GetClientRect(rc);
	GetDrawRect(&rc);
	pOldBrush = pdc->SelectObject(&flashBrush);
	pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN);
	pdc->Ellipse(rc);
	pdc->SelectObject(pOldPen);
	pdc->SelectObject(pOldBrush);
}
bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
  if (NotDrawing()) {
    m_Result = false;
    return false;
  }

  FX_RECT rect = GetDrawRect();
  if (rect.IsEmpty())
    return false;

  CFX_Matrix new_matrix = GetDrawMatrix(rect);
  CFX_FxgeDevice bitmap_device1;
  if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr))
    return true;

  bitmap_device1.GetBitmap()->Clear(0xffffff);
  CPDF_RenderStatus bitmap_render;
  bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1,
                           nullptr, nullptr, nullptr, nullptr,
                           &m_pRenderStatus->m_Options, 0,
                           m_pRenderStatus->m_bDropObjects, nullptr, true);
  CFX_Matrix patternDevice = *pObj2Device;
  patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top);
  if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) {
    bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject,
                                    &patternDevice, false);
  } else if (CPDF_ShadingPattern* pShadingPattern =
                 m_pPattern->AsShadingPattern()) {
    bitmap_render.DrawShadingPattern(pShadingPattern, m_pImageObject,
                                     &patternDevice, false);
  }

  CFX_FxgeDevice bitmap_device2;
  if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb,
                             nullptr)) {
    return true;
  }
  bitmap_device2.GetBitmap()->Clear(0);
  CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_pDIBSource,
                     &new_matrix, rect);
  bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask);
  bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap());
  bitmap_device1.GetBitmap()->MultiplyAlpha(255);
  m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
      bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
  return false;
}
Esempio n. 6
0
BOOL CCircCtrl::InCircle(CPoint& point)
{
	CRect rc;
	GetClientRect(rc);
	GetDrawRect(&rc);

	// Determine radii
	double a = (rc.right - rc.left) / 2;
	double b = (rc.bottom - rc.top) / 2;

	// Determine x, y
	double x = point.x - (rc.left + rc.right) / 2;
	double y = point.y - (rc.top + rc.bottom) / 2;

	// Apply ellipse formula
	return ((x * x) / (a * a) + (y * y) / (b * b) <= 1);
}
Esempio n. 7
0
void CWaveRecord::DrwaWave8(CDC *pDC, BYTE *pData, DWORD dwSize, BOOL bLeft)
{
	CRect rcBG = GetDrawRect(bLeft);
	int y = (int)(pData[0] * rcBG.Height() / 0xff);
	
	// Start point
	pDC->MoveTo(0, y);

	// Line one point to another
	float fStep = (float)rcBG.Width() / (float)(dwSize);
	float fPointX = 0;
	for(DWORD i = 1; i < dwSize; i++)
	{
		fPointX += fStep;
		y = (int)(pData[i] * rcBG.Height() / 0xff);
		pDC->LineTo((int)fPointX, y);
	}
}
Esempio n. 8
0
void CCircCtrl::OnDraw(
			CDC* pdc, const CRect& rcBounds, const CRect&)
{
	CBrush* pOldBrush;
	CBrush bkBrush(TranslateColor(GetBackColor()));
	CPen* pOldPen;
	CRect rc = rcBounds;
	CFont* pOldFont;
	TEXTMETRIC tm;
	const CString& strCaption = InternalGetText();

	// Set the ForeColor property color and transparent background mode into the device context
	pdc->SetTextColor(TranslateColor(GetForeColor()));
	pdc->SetBkMode(TRANSPARENT);

	// Paint the background using the BackColor property
	pdc->FillRect(rcBounds, &bkBrush);

	// Draw the ellipse using the BackColor property and a black pen
	GetDrawRect(&rc);
	pOldBrush = pdc->SelectObject(&bkBrush);
	pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN);
	pdc->Ellipse(rc);

	// Draw the caption and note using the stock Font and ForeColor properties
	pOldFont = SelectStockFont(pdc);
	GetStockTextMetrics(&tm);

	pdc->SetTextAlign(TA_CENTER | TA_TOP);
	pdc->ExtTextOut((rc.left + rc.right) / 2, (rc.top + rc.bottom - tm.tmHeight) / 2,
		ETO_CLIPPED, rc, strCaption, strCaption.GetLength(), NULL);
	pdc->SetTextAlign(TA_LEFT | TA_TOP);
	pdc->ExtTextOut(rcBounds.left, rcBounds.top,
		ETO_CLIPPED, rcBounds, m_note, m_note.GetLength(), NULL);
	pdc->SelectObject(pOldFont);

	pdc->SelectObject(pOldPen);
	pdc->SelectObject(pOldBrush);
}
void Stage_001::Update()
{
    m_frame++;
    
    m_pConnection->Update();
    
    for (int i = 0; i < MAX_MULTI_PLAYER; i++) {
        if (m_clientPositionQueues[i].empty() || 0 == m_pOtherPlayers[i]) {
            continue;
        }
        
        m_pOtherPlayers[i]->position = m_clientPositionQueues[i].front();
        m_clientPositionQueues[i].pop();
    }
    
    bool isMove = false;
    CVector moveVector = m_pPlayer->GetMoveVector();
    
    if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadLeft)) {
        isMove = true;
        moveVector.x -= 4.0f;
    }
    /*
    if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadTop)) {
        isMove = true;
        moveVector.y -= 4.0f;
    }*/
    
    if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadRight)) {
        isMove = true;
        moveVector.x += 4.0f;
    }
    /*
    if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadBottom)) {
        isMove = true;
        moveVector.y += 4.0f;
    }*/
    
    if (0.0f == moveVector.y && sKeyPadManager->GetMainKeyPad()->IsPress(KeyPadA)) {
        isMove = true;
        moveVector.y -= 16.0f;
        if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadB)) {
            moveVector.y -= 4.0f;
        }
    }
    
    if (isMove) {
        m_pPlayer->SetMoveVector(moveVector);
        
        if (sKeyPadManager->GetMainKeyPad()->IsOn(KeyPadB)) {
            m_pPlayer->AddMoveVector(CVector(moveVector.x, 0.0f, 0.0f));
        }
    }
    
    if (sKeyPadManager->GetMainKeyPad()->IsPress(KeyPadStart)) {
        if (0 == CSocket::GetIP()) {
            m_pView->SetTransition(new CTransitionFadeIn(0.2f, this, Stage_001TransitionID_Entry));
            m_pView->RunTransition();
        }
        else {
            m_pConnection->Search();
        }
    }
    
    CRect drawRect = GetDrawRect();
    CRect stepRect = CRect(drawRect.left - m_drawSize.width, drawRect.top - m_drawSize.height, drawRect.right + m_drawSize.width, drawRect.bottom + m_drawSize.height);
    m_pWorld->Step(stepRect);
    
    std::list<CBody *> bodies = m_pWorld->GetBodyList();
    std::list<CBody *>::iterator i = bodies.begin();
    while (i != bodies.end()) {
        CRect bodyRect = (*i)->GetRect();
        if (CCollision::RectOnRect(bodyRect, drawRect)) {
            CPoint position = (*i)->position;
            position.x -= m_drawOffset.x;
            CView *surface = (*i)->GetSurface();
            surface->SetPosition(position);
        }
        
        ++i;
    }
    
    CVector vector = m_pPlayer->GetMoveVector();
    vector.x = 0.0f;
    m_pPlayer->SetMoveVector(vector);
    
    // プレイヤーの位置に合わせてステージの表示領域を移動
    CPoint center = CPoint(m_drawOffset.x + m_drawSize.width / 2.0f, m_drawOffset.y + m_drawSize.height / 2.0f);
    m_drawOffset.x += m_pPlayer->GetRect().right - center.x;
    if (0.0f > m_drawOffset.x || (0.0f >= (GetStageSize().width - m_drawSize.width))) {
        m_drawOffset.x = 0.0f;
    }
    else if ((GetStageSize().width - m_drawSize.width) < m_drawOffset.x) {
        m_drawOffset.x = GetStageSize().width - m_drawSize.width;
    }
    
    CPoint realPosition = m_pPlayer->GetSurface()->GetPosition() + m_drawOffset;
    m_pConnection->Move(realPosition);
}