Example #1
0
void ArrowLayer::drawLayer(MAP::MapWidget* map)
{
	Gfx_pushMatrix();

	Gfx_translate(map->getWidth()/2 - animation->getWidth()/2, map->getHeight()/2 - animation->getHeight()/2);

	animation->setEnabled(true);
	animation->draw(true);
	animation->setEnabled(false);

	Gfx_popMatrix();
}
Example #2
0
	void Widget::draw(bool forceDraw) {
		if(!mEnabled && !forceDraw)
			return;
	
		//Engine &engine = Engine::getSingleton();

		//bool res = engine.pushClipRectIntersect(mBounds.x, mBounds.y,
		//	mBounds.width, mBounds.height);
		
		Gfx_pushMatrix();
		Gfx_translate(mRelX, mRelY);
		BOOL res = Gfx_intersectClipRect(0, 0, mBounds.width, mBounds.height);

		if(res) 
		{
			if(isDirty() || forceDraw) 
			{
				drawBackground();
			}
			//MAUI_LOG("Widget::draw, paddingLeft= %d, paddingTop = %d", mPaddingLeft, mPaddingTop);
			Gfx_translate(mPaddingLeft, mPaddingTop);
			BOOL res = Gfx_intersectClipRect(0, 0, mPaddedBounds.width, mPaddedBounds.height);

#if 0	// debug drawings
			if(mFocused) {
				maSetColor(0x00ff00);
				Gfx_line(0, 0, mBounds.width-1, 0);
				Gfx_line(mPaddedBounds.width-1, 0, mPaddedBounds.width-1, mPaddedBounds.height-1);
				Gfx_line(0, mPaddedBounds.height-1, mPaddedBounds.width-1, mPaddedBounds.height-1);
				Gfx_line(0, 0, 0, mPaddedBounds.height-1);
			}
#endif

			Gfx_translate(getTranslationX(), getTranslationY());

			if(res) {
				if(isDirty() || forceDraw) {
					drawWidget();
				}

				Vector_each(Widget*, it, mChildren)
					(*it)->draw();

			}
			// This commented out to match removal of above intersectClipRect() call.
			Gfx_popClipRect();
			setDirty(false);
		}
		Gfx_popMatrix();
		//engine.popClipRect();
		Gfx_popClipRect();
	}