

We apply some math so that the cursor functions accurately. The next 4 parameters are: x beginning position, y beginning position, x ending position, y ending position (all in pixels). First one is "mycursor.png" and it tells which file will be used for drawing a cursor image. We create a ccbDrawTextureRectangleWithAlpha function call and specify 5 parameters to be used by that function. Inside that function we get X and Y positions of our mouse and store those into variables mX and mY respectively.
#SPECIAL VARIABLES COPPERCUBE CODE#
So, for the cursor to be drawn (to appear) on our game screen, use a code like this:ĬcbDrawTextureRectangleWithAlpha("mycursor.png", mX-4, mY-4, mX+28, mY+28) įirst, we define a function that will be called every frame.

This means that the function is using alpha or transparent pixels, which is what we need. Note the last two words that say WithAlpha. We will make the cursor appear on screen using the The further you go to the bottom and to the right the more coordinates increase. Here we will encounter a slightly different coordinate space in which Y direction goes down in space. Mycursor.png (32 x 32 px) 2-D Coordinate Space You can use this image for the sake of this tutorial: The rest area of the image should be transparent, or semi-transparent. The arrow should be visible, preferably with a border or outline. So, the image should have an arrow pointing to the top-left corner of the image area. It should have transparent pixels (alpha channel) set to it. First, we will need a texture/image to be used as a mouse cursor.
