コード例 #1
0
void TextRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	//shared with the rest of the entity

	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pRotation = &GetParent()->GetVar("rotation")->GetFloat();  //in degrees
	m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
	m_pVisible = &GetParent()->GetVarWithDefault("visible", uint32(1))->GetUINT32();
	m_pDisabled = &GetVarWithDefault("disabled", uint32(0))->GetUINT32();
	m_pShadowColor = &GetVarWithDefault("shadowColor", Variant(MAKE_RGBA(0,0,0,0)))->GetUINT32();

	//our own stuff

	m_pEffectPower = &GetVarWithDefault("effectPower", Variant(8.0f))->GetFloat();
	m_pStyle = &GetVarWithDefault("style", Variant(uint32(STYLE_NORMAL)))->GetUINT32();

	//if "fileName" is set, we'll know about it here
	m_pText = &GetVar("text")->GetString(); //local to us
	GetVar("text")->GetSigOnChanged()->connect(1, boost::bind(&TextRenderComponent::OnTextChanged, this, _1));

	m_pFontID = &GetVarWithDefault("font", uint32(FONT_SMALL))->GetUINT32();
	GetVar("font")->GetSigOnChanged()->connect(1, boost::bind(&TextRenderComponent::OnFontChanged, this, _1));

	GetParent()->GetVar("scale2d")->GetSigOnChanged()->connect(1, boost::bind(&TextRenderComponent::OnScaleChanged, this, _1));
	
	//register ourselves to render if the parent does
	GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&TextRenderComponent::OnRender, this, _1));
}
コード例 #2
0
void TrailRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	m_insideTrailDrawingNow = false;
	m_frameRecordTimer= 0;
	m_timingSystem = GetBaseApp()->GetActiveTimingSystem();

	//shared with the rest of the entity
	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
	m_pRotation = &GetParent()->GetVar("rotation")->GetFloat();  //in degrees
	m_pTrailAlpha = &GetParent()->GetVarWithDefault("trailAlpha", 0.5f)->GetFloat();  
	//register ourselves to render if the parent does
	GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&TrailRenderComponent::OnRender, this, _1));
	
	//our own variables/settings
	m_pFrames = &GetVarWithDefault("frames", uint32(5))->GetUINT32(); 
	m_pTimeBetweenFramesMS = &GetVarWithDefault("timeBetweenFramesMS", uint32(50))->GetUINT32(); 

}
コード例 #3
0
void RectRenderComponent::OnRender(VariantList *pVList)
{

	if (*m_pAlpha > 0.01)
	{
		CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
		uint32 color = ColorCombine(*m_pColor, *m_pColorMod, *m_pAlpha);

		if (GET_ALPHA(color) == 0) return;

		CL_Vec2f vRotationPt = vFinalPos;

		g_globalBatcher.Flush();

		if (*m_pRotation != 0)
		{
			SetupOrtho();
			PushRotationMatrix(*m_pRotation, vRotationPt);
			vFinalPos -= vRotationPt;
		}

			CL_Rectf r = CL_Rectf(vFinalPos.x, vFinalPos.y, vFinalPos.x+ m_pSize2d->x, vFinalPos.y+m_pSize2d->y); 
			if (*m_pVisualStyle != STYLE_BORDER_ONLY)
			{
				DrawFilledRect(r, color);
			}
			
			if (GET_ALPHA(*m_pBorderColor) > 0)
			{
				DrawRect(r, *m_pBorderColor, 1);
			}

			if (*m_pVisualStyle == STYLE_3D)
			{
				int shadedColor = ColorCombineMix(color, MAKE_RGBA(0,0,0,255), 0.4f);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y+m_pSize2d->y, vFinalPos.x+m_pSize2d->x,vFinalPos.y+m_pSize2d->y, 1);
				DrawLine(shadedColor, vFinalPos.x+m_pSize2d->x, vFinalPos.y, vFinalPos.x+m_pSize2d->x,vFinalPos.y+m_pSize2d->y, 1);

				shadedColor = ColorCombineMix(color, MAKE_RGBA(255,255,255 ,255), 0.4f);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y, vFinalPos.x,vFinalPos.y+m_pSize2d->y, 1);
				DrawLine(shadedColor, vFinalPos.x, vFinalPos.y, vFinalPos.x+m_pSize2d->x,vFinalPos.y, 1);
			}

			if (*m_pRotation != 0)
			{
				PopRotationMatrix();
			}

		
	}

}
コード例 #4
0
ProtonPainter::ProtonPainter()
{
	m_posX = 0;
	m_posY = 0;
	m_sizeX = 100;
	m_sizeY = 100;
	m_lineColor = MAKE_RGBA(255,255,255,255);
	m_fillColor = MAKE_RGBA(0,0,255,255);
	m_fontID = FONT_SMALL;
	m_fontScale = 0.7f;
	m_fontColor = MAKE_RGBA(0,0,0,255);

}
コード例 #5
0
ファイル: AdManager.cpp プロジェクト: Zaxuhe/ludum-dare-24
void AdManager::OnRender()
{

#ifdef WIN32
	if (m_bShowingAd)
	{
		//draw a fake rectangle the same size as the real ad will be, this is just for testing, so you get an idea
		//of how big the ad when developing on Windows, and when it will pop up

		CL_Vec2f vRatio = CL_Vec2f(1,1);
		if (GetFakePrimaryScreenSizeX() != 0)
		{
			vRatio.x = (GetScreenSizeXf()/float(GetOriginalScreenSizeX()));
			vRatio.y =(GetScreenSizeYf()/float(GetOriginalScreenSizeY()));
		}
		rtRect r(0,0, (int)(m_vBannerSize.x*vRatio.x),(int)(m_vBannerSize.y*vRatio.y));
		
		//move to bottom
		r.AdjustPosition(0, GetScreenSizeY()-r.GetHeight());

		//center
		r.AdjustPosition( (GetScreenSizeX()-r.GetWidth())/2, 0 );
		
		DrawFilledRect(r, MAKE_RGBA(40,255,40,200));
	}
#endif

}
コード例 #6
0
void RectRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pRotation = &GetParent()->GetVar("rotation")->GetFloat();  //in degrees

	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
	m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();

	//register ourselves to render if the parent does
	GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&RectRenderComponent::OnRender, this, _1));
	m_pBorderColor = &GetVarWithDefault("borderColor", Variant(MAKE_RGBA(255,255,255,0)))->GetUINT32();
	m_pVisualStyle = &GetVarWithDefault("visualStyle", uint32(STYLE_NORMAL))->GetUINT32();
}
コード例 #7
0
void TextBoxRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	//shared with the rest of the entity
	
	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVarWithDefault("size2d", CL_Vec2f(300,200))->GetVector2();
	m_pEnclosedSize2d = &GetParent()->GetVarWithDefault("enclosedSize2d", CL_Vec2f(0,0))->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pAlignment = &GetParent()->GetVar("alignment")->GetUINT32();
	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
	m_pTimingSystem = &GetParent()->GetVarWithDefault("timingSystem", Variant(uint32(GetBaseApp()->GetActiveTimingSystem())))->GetUINT32();

	//our own stuff
	m_pFontScale = &GetVarWithDefault("fontScale", Variant(1.0f))->GetFloat();
	m_pEffectPower = &GetVarWithDefault("effectPower", Variant(30.0f))->GetFloat();
	m_pStyle = &GetVarWithDefault("style", Variant(uint32(STYLE_NORMAL)))->GetUINT32();
	
	//this controls the alignment of the wrapped text within the text rect, not the text rect itself!
	m_pTextAlignment = &GetVarWithDefault("textAlignment", (uint32)ALIGNMENT_UPPER_LEFT)->GetUINT32();
	GetVar("textAlignment")->GetSigOnChanged()->connect(1, boost::bind(&TextBoxRenderComponent::OnTextAlignmentChanged, this, _1));

	m_pText = &GetVar("text")->GetString(); //local to us
	GetVar("text")->GetSigOnChanged()->connect(1, boost::bind(&TextBoxRenderComponent::OnTextChanged, this, _1));

	m_pFontID = &GetVarWithDefault("font", uint32(FONT_SMALL))->GetUINT32();
	GetVar("font")->GetSigOnChanged()->connect(1, boost::bind(&TextBoxRenderComponent::OnFontChanged, this, _1));

	pEnt->GetVar("scale2d")->GetSigOnChanged()->connect(1, boost::bind(&TextBoxRenderComponent::OnScaleChanged, this, _1));

	//register ourselves to render if the parent does
	pEnt->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&TextBoxRenderComponent::OnRender, this, _1));

	m_pShadowColor = &GetVarWithDefault("shadowColor", Variant(MAKE_RGBA(0,0,0,0)))->GetUINT32();

}
コード例 #8
0
void ScrollBarRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);
	//shared with the rest of the entity
	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(0.3f))->GetFloat();
	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(224,188,130,255)))->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	
	m_pFileName = &GetVar("fileName")->GetString(); //local to us
	
	GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ScrollBarRenderComponent::OnUpdate, this, _1));
	GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&ScrollBarRenderComponent::OnRender, this, _1));
	GetParent()->GetFunction("OnOverStart")->sig_function.connect(1, boost::bind(&ScrollBarRenderComponent::OnTargetOverStart, this, _1));
	GetParent()->GetFunction("OnOverEnd")->sig_function.connect(1, boost::bind(&ScrollBarRenderComponent::OnTargetOverEnd, this, _1));
	//if "fileName" is set, we'll know about it here
	GetVar("fileName")->GetSigOnChanged()->connect(boost::bind(&ScrollBarRenderComponent::OnFileNameChanged, this, _1));

	GetVar("fileName")->Set("interface/scroll_bar_caps.rttex"); //default

	EntityComponent *pScrollComp = GetParent()->GetComponentByName("Scroll");
	if (!pScrollComp)
	{
		//assume our stuff will get set from the outside
		m_pBoundsRect = &GetParent()->GetVar("boundsRect")->GetRect();
		m_pProgress2d = &GetParent()->GetVar("progress2d")->GetVector2();

	} else
	{
		m_bUsingScrollComponent = true; //I keep track of this becuse it looks like the bounds is calculated a little
		//differently with scroll components.. ??
		m_pBoundsRect = &pScrollComp->GetVar("boundsRect")->GetRect();
		m_pProgress2d = &pScrollComp->GetVar("progress2d")->GetVector2();
	}
}
コード例 #9
0
void OverlayRenderComponent::OnAdd(Entity *pEnt)
{
	EntityComponent::OnAdd(pEnt);

	//shared with the rest of the entity
	m_pTex = NULL;
	m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
	m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
	m_pScale2d = &GetParent()->GetVarWithDefault("scale2d", Variant(1.0f, 1.0f))->GetVector2();
	m_pRotation = &GetParent()->GetVar("rotation")->GetFloat();  //in degrees
	m_pRotationCenter = &GetParent()->GetVarWithDefault("rotationCenter", Variant(0.5f, 0.5f))->GetVector2();
	m_pColor = &GetParent()->GetVarWithDefault("color", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pColorMod = &GetParent()->GetVarWithDefault("colorMod", Variant(MAKE_RGBA(255,255,255,255)))->GetUINT32();
	m_pAlpha = &GetParent()->GetVarWithDefault("alpha", Variant(1.0f))->GetFloat();
	m_pVisible = &GetParent()->GetVarWithDefault("visible", uint32(1))->GetUINT32();
	
	m_pFrameX = &GetVar("frameX")->GetUINT32(); //applicable if SetupAnim was used
	m_pFrameY = &GetVar("frameY")->GetUINT32(); //applicable if SetupAnim was used
	
	m_pFlipX = &GetVar("flipX")->GetUINT32(); 
	m_pFlipY = &GetVar("flipY")->GetUINT32(); 

	m_pFileName = &GetVar("fileName")->GetString(); //local to us
	
	GetVarWithDefault("frameSize2d", Variant(0.0f, 0.0f));

	//any post var data you want to send, must send it before the Init
	GetFunction("SetupAnim")->sig_function.connect(1, boost::bind(&OverlayRenderComponent::SetupAnim, this, _1));

	//if "fileName" is set, we'll know about it here
	GetVar("fileName")->GetSigOnChanged()->connect(boost::bind(&OverlayRenderComponent::OnFileNameChanged, this, _1));
	pEnt->GetVar("scale2d")->GetSigOnChanged()->connect(boost::bind(&OverlayRenderComponent::OnScaleChanged, this, _1));
	
	//register ourselves to render if the parent does
	GetParent()->GetFunction("OnRender")->sig_function.connect(1, boost::bind(&OverlayRenderComponent::OnRender, this, _1));
}
コード例 #10
0
ファイル: bitmap.c プロジェクト: bzaragoz/MandelMovie
struct bitmap * bitmap( const char *path )
{
	FILE *file;
	int size;
	struct bitmap *m;
	struct bmp_header header;
	int i;

	file = fopen(path,"rb");
	if(!file) return 0;

	fread(&header,1,sizeof(header),file);

	if(header.magic1!='B' || header.magic2!='M') {
		printf("bitmap: %s is not a BMP file.\n",path);
		fclose(file);
		return 0;
	}

	if(header.compression!=0 || header.bits!=24) {
		printf("bitmap: sorry, I only support 24-bit uncompressed bitmaps.\n");
		fclose(file);
		return 0;
	}

	m = bitmap_create(header.width,header.height);
	if(!m) {
		fclose(file);
		return 0;
	}

	size = header.width*header.height;
	for(i=0;i<size;i++) {
		int r,g,b;
		b = fgetc(file);
		g = fgetc(file);
		r = fgetc(file);
		if(b==0 && g==0 && r==0) {
			m->data[i] = 0;
		} else {
			m->data[i] = MAKE_RGBA(r,g,b,255);
		}	
	}

	fclose(file);
	return m;
}
コード例 #11
0
    BOOL CFColorQuantizerBase::_AnalyzeColorMeta()
    {
        FTLASSERT(24 == m_nBpp || 32 == m_nBpp);
        if (24 != m_nBpp && 32 != m_nBpp)
        {
            return FALSE;
        }

        SAFE_DELETE_ARRAY(m_pPixelClrList);
        
        m_pPixelClrList = new COLORREF[m_nBmpPixelCount];
        ZeroMemory(m_pPixelClrList, sizeof(COLORREF) * m_nBmpPixelCount);

        //UINT nColorCount = m_nWidth * m_nHeight;
        UINT nPixOffset = (m_nBpp / 8);
        UINT nRowBytes = CALC_BMP_ALLIGNMENT_WIDTH_COUNT(m_nWidth, m_nBpp); //4字节对齐,计算每行的字节数
        UINT nPixelIndex = 0;

        for (UINT h = 0; h < m_nHeight; h++)
        {
            BYTE* pBuf = m_pBmpData + (nRowBytes * h);
            for (UINT w = 0; w < m_nWidth; w++)
            {
                UCHAR Alpha = 0xFF;
                UCHAR Red = *(pBuf + 2);
                UCHAR Green = *(pBuf+1);
                UCHAR Blue = *(pBuf);

                if (32 == m_nBpp)
                {
                    Alpha = *(pBuf + 3);
                }
                //COLORREF clr = MAKE_RGBA(Red, Green, Blue, Alpha);
                //m_clrList.push_back(clr);
                m_pPixelClrList[nPixelIndex++] = MAKE_RGBA(Red, Green, Blue, Alpha);

                pBuf += nPixOffset;
            }
        }
        FTLASSERT(nPixelIndex == m_nBmpPixelCount);

        return TRUE;
    }
コード例 #12
0
ファイル: nodes.cpp プロジェクト: Zaxuhe/Ludum-dare-26
void nodes::draw()
{
	//we draw the nodes
	static bool once = false;
	if (once == false)
	{
		generate_node_batcher();


		once = true;
	}
	
	for (int i = 0; i < g_node_list.node_list_.size(); i++)
	{
		//now we draw the node lines
		for (int z = 0; z < g_node_list.node_list_[i]->childs.size(); z++)
		{
			//DrawLine( GLuint rgba, float ax, float ay, float bx, float by, float lineWidth = 2.0f);
			DrawLine(MAKE_RGBA(254,64,44,255),g_node_list.node_list_[i]->x,g_node_list.node_list_[i]->y,g_node_list.node_list_[i]->childs[z]->x,g_node_list.node_list_[i]->childs[z]->y);
		}
		//node_->Blit(g_node_list.node_list_[i]->x-8,g_node_list.node_list_[i]->y-8);
	}
}
コード例 #13
0
ファイル: Render.cpp プロジェクト: maximbilan/tblock
void Render::RDrawLine( const float pX1, const float pY1, const float pX2, const float pY2 )
{
	DrawLine( MAKE_RGBA( 0,255,0,100 ), pX1, pY1, pX2, pY2 );
}
コード例 #14
0
void ProtonPainter::SetLineColor( int inR, int inG, int inB )
{
	m_lineColor = MAKE_RGBA(inR, inG, inB, 255);
	m_fontColor =   MAKE_RGBA(inR, inG, inB, 255);
}
コード例 #15
0
void ProtonPainter::SetFillColor( int inR, int inG, int inB )
{
	m_fillColor = MAKE_RGBA(inR, inG, inB, 255);
}
コード例 #16
0
void ProtonPainter::InvertRect( int inX, int inY, int inW, int inH )
{
	DrawFilledRect(m_posX+(float)inX, m_posY+(float)inY, (float)inW, (float)inH, MAKE_RGBA(200,200,200,150));
}
コード例 #17
0
void TextRenderComponent::OnRender(VariantList *pVList)
{
	if (*m_pAlpha <= 0 || *m_pVisible == 0) return;

	CL_Vec2f vFinalPos = pVList->m_variant[0].GetVector2()+*m_pPos2d;
	CL_Vec2f vRotationPt = vFinalPos;

	//vFinalPos -= GetAlignmentOffset(*m_pSize2d, eAlignment(*m_pAlignment));
	
	if (vFinalPos.y < -m_pSize2d->y) return;
	if (vFinalPos.y > GetOrthoRenderSizeYf()) return;

	
	if (*m_pRotation != 0)
	{
		g_globalBatcher.Flush();
		SetupOrtho();
		PushRotationMatrix(*m_pRotation, vRotationPt);
		vFinalPos -= vRotationPt;
	}

	float alpha;

	if (*m_pDisabled)
	{
		alpha = rt_min(*m_pAlpha, 0.5f);
	} else
	{
		alpha = *m_pAlpha;
	}

	uint32 color = ColorCombine(*m_pColor, *m_pColorMod, alpha);

	switch(*m_pStyle)
	{
	case STYLE_NORMAL:
		
		if (m_pShadowColor != 0)
		{
			GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaledSolidColor(vFinalPos.x+2, vFinalPos.y+2, *m_pText, m_pScale2d->x, ColorCombine(*m_pShadowColor, MAKE_RGBA(255,255,255,255), alpha));
		}
		GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaled(vFinalPos.x, vFinalPos.y, *m_pText, m_pScale2d->x, color);
		break;
	
	case STYLE_EFFECT_SIN_WAVE:
		RenderAsWave(vFinalPos, color);
		break;
	}

	if (*m_pRotation != 0)
	{
		g_globalBatcher.Flush(); //force it to render now so our transformation matrix will work with it
		PopRotationMatrix();
	}
#ifdef _DEBUG

	//DrawRect(vFinalPos, *m_pSize2d); //useful for debugging our touch hotspot

#endif
}
コード例 #18
0
void TextBoxRenderComponent::DrawTextNormal(CL_Vec2f vPos)
{
	//go through all text and draw it
	if (vPos.x > GetScreenSizeX()) return; //no use drawing stuff that is off the screen to the right

	
	float lineHeight = GetBaseApp()->GetFont(eFont(*m_pFontID))->GetLineHeight(*m_pFontScale);
	uint32 color = ColorCombine(*m_pColor, *m_pColorMod, *m_pAlpha);

	FontStateStack state;

	for (unsigned int i=0; i < m_lines.size(); i++)
	{
		
		if (vPos.y+lineHeight < 0) 
		{
			//it's above the screen and doesn't need to be drawn.. but we still want to process it for color information.
			GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaledFakeToUpdateState(m_lines[i],  color, &state);
	
			vPos.y += lineHeight;		
			continue; //no use drawing stuff that is above the screen
		}
		

		if (vPos.y > GetOrthoRenderSizeYf()) 
		{
			break; //no use drawing any more down here
		}

		float lineSizeX;

		switch (*m_pTextAlignment)
		{
		case ALIGNMENT_UPPER_CENTER:

			//center the text on its line.  No reason why we couldn't cache this size data, but I suspect it's not a big hit compared to the
			//actual rendering.
			lineSizeX = GetBaseApp()->GetFont(eFont(*m_pFontID))->MeasureText(m_lines[i], *m_pFontScale).x;
		
			
			if (*m_pShadowColor != 0)
			{
				GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaledSolidColor( (vPos.x + ( (m_pSize2d->x-lineSizeX)/2))+2, vPos.y+2, m_lines[i], *m_pFontScale,ColorCombine(*m_pShadowColor, MAKE_RGBA(255,255,255,255), (float)GET_ALPHA(color)/255), NULL, &g_globalBatcher);
			}

			
			GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaled(vPos.x + ( (m_pSize2d->x-lineSizeX)/2), vPos.y, m_lines[i], *m_pFontScale, color, &state, &g_globalBatcher);
			break;

		default:

			if (*m_pShadowColor != 0)
			{
				GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaledSolidColor(vPos.x+2, vPos.y+2, m_lines[i], *m_pFontScale, ColorCombine(*m_pShadowColor, MAKE_RGBA(255,255,255,255), (float)GET_ALPHA(color)/255), NULL, &g_globalBatcher);
		
			}
			GetBaseApp()->GetFont(eFont(*m_pFontID))->DrawScaled(vPos.x, vPos.y, m_lines[i], *m_pFontScale, color, &state, &g_globalBatcher);

			break;
		}
	
		//advance to the next line
		vPos.y += lineHeight;
	}
	
}
コード例 #19
0
ファイル: nodes.cpp プロジェクト: Zaxuhe/Ludum-dare-26
void spaceship::draw()
{
	g_nodes->ship_->Blit(current_x_-16,current_y_-16,MAKE_RGBA(255,255,255,255),(walk_rads_*180.0f)/PI,CL_Vec2f(current_x_,current_y_));
}