Game Development Community

Classes incorrect with multiple scenewindows

by Nick Sinnott · in Torque Game Builder · 09/02/2006 (11:04 pm) · 3 replies

Short:
When a scenewindow is set to a scenegraph using t2dscenewindow::setSceneGraph() does it load a new instance of the graph or just view the existing one?

Long:
I've been trying to use multiple t2dSceneWindows on the same scenegraph (2-player split screen) by loading a level into SceneWindowOne, then using the returned scenegraph ID to setSceneGraph() of the SceneWindowTwo, which seemed to go work:

%graph = sceneWindowOne.loadLevel("SpaceWaste/data/levels/testLevel.t2d");
%cam = sceneWindowOne.getCurrentCameraArea();
sceneWindowTwo.setSceneGraph(%graph);
sceneWindowTwo.setCurrentCameraArea(%cam);


However, somehow my class names / namespaces are no longer getting set correctly, or at all.

To check, I've created a sprite with a class of "blah" in the level and added the following to game.cs:

function blah::onLevelLoaded (%this, %scenegraph)
{
echo ("blah loaded!");
}

However, I'm not seeing this show up in the console. Bug? As designed?

For good measure, here's the code from the .t2d file:

new t2dStaticSprite(test) {
imageMap = "circleImageMap";
frame = "0";
canSaveDynamicFields = "1";
class = "blah";
Position = "0 0";
size = "32.000 32.000";
mountID = "2";
Speed = "50";
};

#1
09/03/2006 (9:48 am)
Not to disuade you from writting anything from scratch but a quick search for 'split screen' turns up a couple of resources that if nothing else will show you how other people tackled the problem. Both resources will require a rebuild though so be prepared to set up Visual Studio Express if you don't have it running already:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2261
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2304

-Unk
#2
09/03/2006 (10:32 am)
Thanks, but turns out it was just a typo in one of my exec's. Sorry for the trouble.
#3
09/05/2006 (3:02 pm)
Glad you figured it out Nick... TGB's camera and scenegraph systems were designed to easily do what you are talking about :) Which it seems you have discovered.