Hi,
Quoting Scott Johnson <[EMAIL PROTECTED]>:

> Hi Everyone!
>
> I'm encountering a little bit of confusion with SCF, and I was wondering
> if someone might be able to answer my questions.
>
> Specifically, in our game, we're utilizing a custom graphical
> interface.  Thus, I'm creating it by creating a cs plugin.  I currently
> have two interfaces, iSUIS, which represents the overall user interface
> system, and iSUISReticle, which represents a reticle on the screen.  I
> have two other classes, EridanusSUIS, which implements iSUIS, and
> EridanusReticle, which implements iSUISReticle.  Now, I can load and get
> the plugin to work overall, and get a csRef<iSUIS> enabled, but I can't
> seem to get a pointer to a iSUISReticle object.  Am I missing something
> here?  I thought that once the plugin was loaded, that I should be able
> to do something like:
>
> csRef<iSUISReticle> reticle = csQueryRegistry<iSUISReticle> (obj_reg);
>
> But this doesn't return a valid pointer.  How do I go about creating an
> object so that it can be picked up by the object registry?

You are, as many other people I can add, confusing two different  
things, the SCF system and the object registry. Something being an SCF  
object and implementing SCF interfaces does not automatically put them  
into the object registry, to be there they have to be manually  
inserted. Think of the object registry as a big singleton manager than  
makes it easy to get pointers to things you have _one_ of (even though  
object registry supports multiple objects of same type.. but that is  
another topic).

What you most probably want to do, and which is what most CS plugins  
does, is expose one main interface to the world, in this case  
EridanusSUIS/iSUIS, which is the class in SCF_FACTORY and listed in  
your csplugin file and hen have a method in this to create your  
"secondary" classes (EridanusReticle etc). For example the CS mesh  
objects works this way, they expose an object implementing  
iMeshObjectType which then can create factories etc.

You can also directly have multiple classes directly exposed to the  
outside, then you need to list all of them in your csplugin-file, each  
of them must implement iComponent as well as your main interface and  
there must be an SCF_FACTORY for each; To create them you then use  
scfCreateInstance. This is however imo a bit more clumsy and  
definitely takes more performance (scfCreateInstance is quite heavy  
compared to have a direct factory method on your iSUIS.. the iSUIS you  
can put into the object registry if you want to)

-M

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to