Beispiel #1
0
void HUDLayer::OnDraw()
/*****************************************************************************/
{
   Drawing::SetColor(154, 205, 50);
   ostringstream text1, text2;
   XYPoint mousePos = MousePosition();
   DevicePoint mousePosDev = MousePositionDevice();
   text1<<"Mouse (XY): ("<<mousePos.x<<", "<<mousePos.y<<")";
   text2<<"Mouse (Device): ("<<mousePosDev.x<<", "<<mousePosDev.y<<")";
   const int rightYOffset = 230;
	Text(DevicePoint(WidthInPixels() - rightYOffset, 28), text2.str(), FN_BITMAP_8_BY_13);
	Text(DevicePoint(WidthInPixels() - rightYOffset, 10), text1.str(), FN_BITMAP_8_BY_13);

}
void CHuiShadowBorderBrush::ExpandVisualRect(TRect& aRect) const
    {
    // We need access to visual to convert metric units into pixels,
    // currently a pointer to visual is provided through separate
    // method since we want to avoid breaking binary compatibility 
    // of this class.
    TReal32 widthInPixels = WidthInPixels(BrushGuide()); 
    aRect.Grow(HUI_ROUND_FLOAT_TO_INT(widthInPixels), HUI_ROUND_FLOAT_TO_INT(widthInPixels)); 
    }
void CHuiShadowBorderBrush::Draw(CHuiGc& aGc, const MHuiBrushGuide& aGuide) const
    {
    TRect content = aGuide.BrushRect().Round();
    TReal32 opacity = aGuide.BrushOpacity() * iOpacity.Now();

    if(opacity <= 0)
        {
        return;
        }

    aGc.SetPenAlpha(TInt(opacity * 255));
    aGc.SetPenColor(TRgb(0, 0, 30));

    const CHuiTexture* shadowTexture = NULL;
    TInt err = aGuide.BrushSkin().GetTexture(EHuiSkinShadowTexture, shadowTexture);
    if (err!=KErrNone)
    	{
    	ASSERT(EFalse); // failed to get the shadow texture - unable to proceed!
    	return;
	    }
    ASSERT(shadowTexture);
    THuiImage shadowImage(*shadowTexture);

    aGc.Disable(CHuiGc::EFeatureDepthWrite);
    
    TReal32 widthInPixels = WidthInPixels(BrushGuide()); 
    content.Grow(HUI_ROUND_FLOAT_TO_INT(widthInPixels), HUI_ROUND_FLOAT_TO_INT(widthInPixels)); 
    
    // ID:  EHJK-7G5AHB - shadow border leaves artifacts in the display while visual is moved.
    TReal32 offset = 0.0f; // NOTE: It was 1.f. 

    // Note: DrawBorders does not (yet) support different widths for every border.
    aGc.DrawBorders(content, 
                    widthInPixels-offset, 
                    widthInPixels+offset, 
                    widthInPixels-offset, 
                    widthInPixels+offset, 
                    CHuiGc::EBorderImage, 
                    &shadowImage);            

    aGc.Enable(CHuiGc::EFeatureDepthWrite);
    }
Beispiel #4
0
void EmotionsLayer::DrawEmotionMeter(int c, string label, float val)
/*****************************************************************************/
{
   assert(val >= -1.0);
   assert(val <= 1.0);

   SetColor(100,100,4);
   glLineWidth(3);

   const int ySpacingInPixels     = 30;
   const int xRightOffsetInPixels = 200;
   const int yTopOffset           = 10;
   const int sliderWidth          = 180;

   int sliderXVal = WidthInPixels() - xRightOffsetInPixels;
   int sliderYVal = (HeightInPixels() - yTopOffset) - (ySpacingInPixels * c);

   Beeber::Drawing::Slider(DevicePoint(sliderXVal, sliderYVal), label, val, sliderWidth);

}