Hey there.
I have a C4PropList
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?
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?
I'm pretty sure you have to Create the actual facet in the correct size first before drawing onto it.
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.
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.
Can you give an example? As I said, I am not into the drawing system at all. Isn't there a ready-made method of the def/object to simply draw their picture at X,Y,Wdt,Hgt on the screen applying all color modifications and transformations?
Yes. But I already used that, see above. (And what would it be for C4Def? Draw is correct?)
C4Object::DrawPicture just calls C4Def::Draw with an object parameter. C4Def::Draw draws the def picture and, if it gets an object parameter, applies modifications specific to that object (overlays, picture rect changes, modulations, etc.).
ok,...sooo... as you see I already used the right functions. But how to use the facets now to draw?
Why don't you just do:
Also, what is this for? I cannot imagine a case where an assigned def overrides the more specific object.
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.
PictureDef is a proplist which has been given as a parameter to the CustomMessage function and may either be a def or an object. If it is an object, the current picture of the object should be drawn, otherwise just the definition picture. I am replacing the only usage that was left for portraits with the possibility to display normal object/def graphics.
Edit: Also - thats it? Oh, thats easier than I thought.
Edit: Also - thats it? Oh, thats easier than I thought.
Why don't you just pass one C4Value, which can be either an object or a def?
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()?
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