View Full Version : Moving an image around under a touch

04-22-2012, 09:39 PM
I am playing around with the TouchTestComponent to try better understand the entity/component framework. I am trying to get image/texture to show upon a touch, move around during the touch and then disappear. I am having limited success.

Is there an example of this I am missing?

Found this posting, but not able to apply this tidbit.

I am adding an entity variable to the TouchObject and trying to create and destroy based upon the messagetype coming into the OnInput. So far still missing something.

04-23-2012, 01:56 AM
Well, there should be no problem doing bitmaps instead of filled squares. I can't really see what's wrong without code but...

Keep in mind that if you add entities, they aren't going to draw unless they are A, added as a child to an entity that has draw focus, or B, you add draw focus to them.

Another way would be to just init a Surface and blit it yourself instead of the rect here:

void TouchTestComponent::DrawTouch(uint32 touchID, CL_Vec2f vPos)
DrawFilledSquare(vPos.x, vPos.y, 40, m_touch[touchID].m_color, true);
GetBaseApp()->GetFont(FONT_SMALL)->Draw(vPos.x-5, vPos.y-20, toString(touchID), MAKE_RGBA(0,0,0,255)); //<-- change this to something else

04-23-2012, 11:25 PM
void TouchTestComponent::DrawTouch(uint32 touchID, CL_Vec2f vPos)
Surface *pSurf = new Surface();

This seems to get me what I need. I was trying to this:

Entity *pBG = CreateOverlayEntity(GetParent(), "MyEnt", "", vPos.x,vPos.y);

which left a trail of images all over the place.

04-24-2012, 01:02 AM
void TouchTestComponent::DrawTouch(uint32 touchID, CL_Vec2f vPos)
SurfaceAnim *pSurfAnim = GetResourceManager()->GetSurfaceAnim("interface/Cobbles_grey_VL.rttex");