Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Anyone want to chanhe the defaui;lt mouse icon in your game - this Action extension works: // This changes the mouse icon and is stopped by default when variable 'cursor' equals 0 & started with anything but 0; // link a new png file image with a transparent background; /* <action jsname="action_MouseIcon" description="New mouse icon"> </action> */ action_MouseIcon = function() {}; action_MouseIcon.prototype.execute = function() { var me = this; this.registeredFunction = function() { me.onFrameDrawing(); }; ccbRegisterOnFrameEvent(this.registeredFunction); } action_MouseIcon.prototype.onFrameDrawing = function() { var check = ccbGetCopperCubeVariable("cursor"); if(check == 0) { ccbUnregisterOnFrameEvent(this.registeredFunction); } var mouseX = ccbGetMousePosX(); var mouseY = ccbGetMousePosY(); ccbDrawTextureRectangleWithAlpha("data/tex/cursor.png", mouseX-20, mouseY-20, mouseX+20, mouseY+20); }; |
||||
|
Awesome! Thanks a million. ![]() *Are there any instructions on how it is used? I had a play with the code and can't seem to get it to work. Thank you. |
||||
|
Once you have created the Action extension and saved it in the extensions folder... you need to change the location of the mouse icon png image is located to match your game and then just set cursor = 1 or anything other than 0 actually then do the Action. When no longer needed, just set cursor = 0 to stop it working. |
||||
|
Thank you - will give it a go :) |
||||
|
tried it out.... I've got to say, it worked a charm! thanks robo (once more) you are the CC Guru! |
||||
|
javascript:insertBuBCode(' ![]() ![]() |
||||
|
@Robo thanks, but for some reason this does not work for webgl(?) I've tried it, but I'm only getting a black square. the code does work when publishing it to *.exe. Any idea why this might fail on webgl? |
|