Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name: Password:
Ambiera Forum > CopperCube > Help with CopperCube
Custom Mouse icon
Author Text

Robo
Guest
Quote
2020-11-10 12:56:49

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);
};


veganpete
Registered User
Quote
2020-11-10 13:09:02

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.


Robo
Guest
Quote
2020-11-10 22:31:43

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.


veganpete
Registered User
Quote
2020-11-11 14:15:12

Thank you - will give it a go :)


count2rfeit
Registered User
Quote
2020-11-13 00:17:46

tried it out.... I've got to say, it worked a charm!

thanks robo (once more) you are the CC Guru!


jakobi
Guest
Quote
2021-05-12 00:26:43

javascript:insertBuBCode('')


gree
Registered User
Quote
2022-11-11 00:59:07

@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?


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact