
I have a C4PropList
PictureDef
which can only be either a C4Def or a C4Object. Now, I want to draw the picture of the definition or object onto a given facet (and draw that at the specified position). For the lack of understanding and/or documentation of how all the drawing stuff with facets, surfaces, facetsurfaces, facettargets etc works, I naively used that code:
C4FacetSurface fctPicture;
if (PictureDef->GetDef())
PictureDef->GetDef()->Draw(fctPicture);
else if(PictureDef->GetObject())
PictureDef->GetObject()->DrawPicture(fctPicture);
C4Facet facet(cgo.Surface, iDrawX, iDrawY, PictureWidth, PictureWidth);
fctPicture.Draw(facet);
but that doesn't work at all. (No errors, just it doesn't draw anything).
So, what would be the correct way to do this?

Anyway, drawing on an external surface and then onto the main is a) slow and b) kills drawing modes like additive drawing. Just apply a clipper and draw onto the cgo directly if you can.





C4Facet facet(cgo.Surface, iDrawX, iDrawY, PictureWidth, PictureWidth);
if (PictureDef->GetDef())
PictureDef->GetDef()->Draw(facet);
else if(PictureDef->GetObject())
PictureDef->GetObject()->DrawPicture(facet);
Also, what is this for? I cannot imagine a case where an assigned def overrides the more specific object.

Edit: Also - thats it? Oh, thats easier than I thought.

Edit: Oh right, I understand. Both def and objects are proplists now. But wouldn't an object proplist also return a valid def for GetDef()?
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill