The commands getPointerX() and getPointerY() are used to read the pointer X and Y positions respectively and these can be inserted straight into the existing setSpritePosition() command in our project.
setSpritePosition( spriteRef , getPointerX() , getPointerY() )
Currently this is called just once at the start. In order to make the pointer move continually, this needs to be transferred to inside the do/loop section so that it is done in every frame.
Finally we can replace the lines which print the Virtual Resolution (which are no longer needed as this is now the same as the physical resolution);
printc( "Virtual: " )
print( str( virtWidth# ) + " x " + str( virtHeight# ) )
printc( "Pointer: " )
print( str( getPointerX() ) + " x " + str( getPointerY() ) )
The project now looks like this.
Now within windows , whenever the pointer is over the output window, the finger will follow it and the position will be shown in text at the top of the screen.
Remember, this is purely for my screen grabs and will not be present in the final project.
Now within windows , whenever the pointer is over the output window, the finger will follow it and the position will be shown in text at the top of the screen.
Preparations are complete, now the project can begin.
No comments:
Post a Comment