Game Development Community

Calling "SceneGraph::onLevelLoaded()" hides the cursor...

by Junsik Shim · in iTorque 2D · 02/13/2010 (3:22 am) · 5 replies

Hello.

When I try to call SomeSceneGraph::onLevelLoaded(),
the cursor just disappears from the screen.


Here are the steps to reproduce:

1. Create a new project.

2. In the "Scene Graph Scripting" section, set the Class field to "EmptySceneGraph".

3. Save the scene, and run it; works fine.

4. Create a new script file named "emptySceneGraph.cs" in "scripts" folder.

5. Put this code into the file.
function EmptySceneGraph::onLevelLoaded(%this, %scenegraph) {}

6. Insert this line into "startGame()" in "game.cs".
exec("./emptySceneGraph.cs");

7. Save all and run it; the cursor disappears!


Am I missing something?

BTW, I'm using T2Di 1.3.1 on Vista 32bit.

Thanks in advance.

#1
02/14/2010 (5:52 am)
at any time, you can call Canvas.showCursor(); or Canvas.hideCursor(); and it will apply the change. if you just look into that function you will probably find hideCursor, and you can comment it out (and add a comment why).
#2
02/14/2010 (12:02 pm)
@Sven
There's no code in EmptySceneGraph::onLevelLoaded() as I mentioned above. Just calling the function itself is causing this weird problem.

Am I the only one having this problem??
#3
02/14/2010 (12:16 pm)
The problem is one you create yourself.

You override the t2dSceneGraph::onLevelLoaded thats defined in common/scripts/levelManagement.cs, which actually does the call to showCursor

if you want your overrides to work correctly get used to have a call to the base classes version of the function being the first thing in such an override before anything else happens so you have the "base state" setup correctly
#4
02/14/2010 (7:13 pm)
@Marc
Oh, I didn't know I was actually overriding the method. I thought I'm just declaring it for the first time. I guess I should take a look at the common scripts for answers now.

Thanks!
#5
02/14/2010 (8:29 pm)
:-)

Torsion - Search Project is often a good lifesaver in such cases ;)