Re: changing the mouse pointer location

[email protected]
Newsgroups gmane.games.torcs.general
Message-ID <1370037951.16431.140661238297573.74D041A2@webmail.messagingengine.com>


On Thu, May 23, 2013, at 06:09 AM, Bernhard Wymann wrote:
...
> Lets see...
> find . -name "*.cpp" -exec grep -H -i cursor {} \;
> 
> -> so src/libs/tgfclient/gui.cpp looks interesting, maybe
> "GfuiMouseShow"?
> 
> Then google:
> https://www.google.com/search?q=glut+mouse+cursor+positioning
> 
> -> glutWarpPointer could do the trick
> 
> Looking for this in TORCS:
> find . -name "*.cpp" -exec grep -H -i Pointer {} \;
> 
> -> src/libs/tgfclient/gui.cpp -> glutWarpPointer, GfuiMouseSetPos, this 
> could be your thing:-)
> 
> Maybe you need to dig a tad further, but I guess this is a major hint 
> for your solution, the next step would be to look up the places where
> GfuiMouseSetPos is used.
> 
> But as I pointed out above, I think the main flaw is that you restart 
> TORCS at all, if you just edit an existing track restarting the game 
> session should relaod the track, not even reselection of the track 
> should be required;-)
> 
> Keep us informed about your solution (hacked TORCS or adopted workflow, 
> whatever).
> 
> Best regards
> 
> Bernhard

I found the GfuiMouseSetPos and glutWarpPointer (around l. 390) in
/src/libs/tgfclient/gui.cpp and tried changing it, replacing (x, y) with
many number combinations like (750, 750), (0, 0) and (1024, 768) that
should have pushed the pointer off the middle of the screen, but in
vain. Obviously, after saving the file and running "make" I pasted the
changed library from that source folder to the torcs library folder and
only then ran torcs, but the desktop pointer promptly popped up in the
middle of the screen, crashing the party with impunity. If I added
numbers separated by a comma elsewhere on that line, after the brackets
or the semi-colon, "make" failed and spewed out an error message (which
I didn't copy but which had something to do with operands on either side
of commas not taking effect).

So then this amateur hack had to improvise. I canceled those changes and
moved on, somewhere between lines 220-245, where I saw 

GfuiScreen -> mouseAllowed = 1;

and

GfuiMouseHW = 1;

both of which I changed to 0, saved the file, then ran "make" and pasted
the library like described above. Now the desktop pointer still appeared
in the initial torcs logo screen, but vanished before the game main
screen, so I could then proceed to the track without taking my hands off
the keyboard. That's good enough for me. If I touch the mouse afterward,
a bluish pointer will appear, so it's not like mouse is completely
disabled after those changes. 

As to why I have to quit and re-start the game after any editing of the
track.xml and re-creating the track with trackgen, it would be
impossible or at least incredibly complicated to run the game itself (in
the terminal, with the -s option) in full-screen mode (the only way for
my poor video card) and then use the same terminal and my text editor
for track editing. It's not like I can escape from the game by ALT+TAB
or anything in full-screen mode. 

Thanks for pointing me in the right direction.

st
http://stdesigns.orgfree.com/

-- 
http://www.fastmail.fm - A fast, anti-spam email service.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.