Article View: comp.windows.interviews
Article #1113Re: components of World
From: Mark Linton
Date: Thu, 09 May 1991 16:12
Date: Thu, 09 May 1991 16:12
35 lines
2234 bytes
2234 bytes
In article <19378@crdgw1.crd.ge.com>, taylorp@sunstar.crd.ge.com (Patrick D. Taylor) writes:
|> I have a few questions about Scene and World in InterViews 2.6.
|>
|> I want to get a list of components which have been inserted into the world.
|> According to the man page for Interactor, the GetComponents() member
|> function should return a list of the interactor's components if the
|> interactor is a Scene. Scene does not implement GetComponents(), nor does
|> World, which is a Scene. So World::GetComponents() is actually
|> Interactor::GetComponents(), which does nothing. How do I get the
|> components of the World scene?
|>
|> Also, the man page for Scene specifies that "when a scene is deleted, it
|> should delete all its component interactors. The World scene does not do
|> this. Why not?
You have clearly stated why World should not be a scene subclass,
which is the change we made in 3.0. World is really just an interface
to the display/root window.
|> What I want to be able to do is insert an arbitrary number of interactors
|> into a world. Each interactor has a quit button which removes it from the
|> world. When all of the interactors have been removed, the program should
|> terminate. Thus, my main event loop would be something like:
|>
|> do {
|> Read(event);
|> event.target->Handle(event);
|> n = number of components left in world;
|> } while (n > 0);
|>
|> Any suggestions?
One approach is to have a list of all the components; the other has a count.
When you insert into the world, add to the list/count; subtract when you remove.
It is common to have an "application" object that manages this state.
Technical Details
Message-ID:
<1991May9.161230.23058@fido.wpd.sgi.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!sgi!shinobu!fido.wpd.sgi.com!marktwain.rad.sgi.com!lintonReferences:
<19378@crdgw1.crd.ge.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!sgi!shinobu!fido.wpd.sgi.com!marktwain.rad.sgi.com!linton From: linton@marktwain.rad.sgi.com (Mark Linton) Newsgroups: comp.windows.interviews Subject: Re: components of World Message-ID: <1991May9.161230.23058@fido.wpd.sgi.com> Date: 9 May 91 16:12:30 GMT References: <19378@crdgw1.crd.ge.com> Sender: news@fido.wpd.sgi.com (Usenet News Admin) Reply-To: linton@marktwain.rad.sgi.com (Mark Linton) Organization: sgi Lines: 35