Game Development Community

Mouse questions

by Paul Fountain · in Torque Game Builder · 04/16/2006 (11:24 pm) · 2 replies

First post, I bought TGB about a week ago and I have been working through the tutorials, and I'm getting to the point where my simple game idea is starting to come to life. I have two questions about mouse handling:

1. There is a setMousePosition() function but from doing a search of the forums, it appears that it does not work currently. My quick tests in my game would seem to back that up. Anyone know the current status?

2. Is there any way to turn off the mouse cursor? A form search turned up CursorOn and CursorOff functions, but these are not in the reference docs that came with TGB.

#1
04/17/2006 (12:24 am)
I had thought the latest version of the engine fixed the setMousePosition problems that existed in the older versions, are you using the newest 1.1 Beta 2, or the 'stable' 1.0.2 version?

Using Canvas.cursorOn and Canvas.cursorOff totally turns off the mouse and will stop mouse even callbacks from happening. They're part of the core TGE engine and hence not in the TGB reference documentation.

What it sounds like you really want is either Canvas.showCursor() and Canvas.hideCursor(), or Canvas.setCursor(); which lets you set the graphic of the cursor to anything, including a blank graphic if you so desire. Search the script source for GuiCursor, which is where these cursor objects get defined. They're little more than an image bitmap reference and an offset coordinate.
#2
04/17/2006 (8:07 pm)
Thanks, Luke ... this code worked for making the mouse cursor disappear:

DefaultCursor.bitmapName = "~/data/images/blank";

I put a blank.gif in my images directory, a 1x1 transparent .gif file.

I do have Beta 2 of TGB, but the setMousePosition() function doesn't seem to work. Basically it doesn't do anything for me. I'll have to look into that more later. Everything else is going well, at this point I have created a basic working shell of the (very very) old arcade game "Rampart". I just followed the Tetris tutorial, and started throwing in my own code where appropriate. Now for the hard stuff like scoring, and detecting when the player creates a closed loop with his blocks ...