Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Tool Tips on Mouse Cursor

james_wards
Registered User
Quote
2016-09-04 10:21:48

Hello All!

I have a bucket load of buttons on my user interface that would seem entirely alien when thrown in the face of a first time user, however if I were able to display text beside the cursor when hovered over a button this would make life much easier for the user.

I know I could use a static 2D overlay to display and change when I hover an object, but is there a simple way to change the displayed mouse cursor when hovered over an icon?

Any advice would be most appreciated.

Thank you!


james_wards
Registered User
Quote
2016-09-16 06:48:02

I found this code in an earlier forum:

function onFrameDrawing()
{

var mouseX = ccbGetMousePosX();
var mouseY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("customcursor.png", mouseX-10, mouseY-10, mouseX+10, mouseY+10);
}

ccbRegisterOnFrameEvent(onFrameDrawing);


This does exactly what I need it to do once I hover over a button, I can change the cursor to display text when *on mouse hover* function..

However, I can't for the life of me figure out how to get it back to normal when *mouse hover exit* function. I tried to get it to load a blank .png on exit, but that didn't work, any advice? It appears I can only load one custom mouse texture and then it refuses to load any others.


james_wards
Registered User
Quote
2016-09-16 07:03:17

All I need to know is what code I can add to this to get it to STOP DRAWING when I exit the 2D overlay on mouse hover. Then hopefully it will load another mouse cursor when I hover over the next 2D icon.

What line of code can I add to stop drawing?


gar
Registered User
Quote
2016-09-16 22:11:13

From the doc's :

After you no longer need events, call ccbUnregisterOnFrameEvent() to unregister your function.


james_wards
Registered User
Quote
2016-09-17 02:47:09

Yeaah.... Imma gunna need someone to add that line of code wherever it needs to go because I have absolutely no idea how script works lol

I spent all my years as a modeler and animator. Scripting is an alien language to me.

Can someone please post the new code so I can copy and paste it?

Thanks!


james_wards
Registered User
Quote
2016-09-17 10:46:26

Right so I've wasted hours on trying every variation of that code line and trying to get it to work, but I have no idea what I'm doing.

I need, 'When Cursor Moved Over Do Something; OnEnter" Load a custom cursor.

When Cursor 'On Exit'; I need the custom cursor to be unloaded.

I also need custom cursors loaded for each button, for example:

Button 1 will load Custom Cursor 1 on entry, and remove on Exit.

Button 2 will load Custon Cursor 2 on enttry and remove on Exit.

I will have a custom cursor .png made for each button.

All I require is someone to post the code in full form here, so I can copy and paste.

I will send $20 USD via paypal to whoever can help me get my tool tips performing as desired.

Thanks.


tim12345
Guest
Quote
2016-09-17 17:26:35

wow $20!!

first create a billboard and put it out of sight.
in that billboard put 'every few seconds do something' with 1ms.
in that execute this javascript.
var winning = ccbGetCopperCubeVariable('button')


function onFrameDrawing()
{


if (winning==0){

var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("clear.png", timX-20, timY-20, timX+20, timY+20);
}

if (winning==1){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button1.png", timX-20, timY-20, timX+20, timY+20);
}

if (winning==2){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button2.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==3){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button3.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==4){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button4.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==5){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button5.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==6){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button6.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==7){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button7.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==8){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button8.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==9){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button9.png", timX-20, timY-20, timX+20, timY+20);

}
if (winning==10){
var timX = ccbGetMousePosX();
var timY = ccbGetMousePosY();

ccbDrawTextureRectangleWithAlpha("button10.png", timX-20, timY-20, timX+20, timY+20);

}
ccbUnregisterOnFrameEvent(onFrameDrawing);


}

ccbRegisterOnFrameEvent(onFrameDrawing);


that's code for 10 buttons.
in each button, put 'on entermouse' ---> 'do later 10ms' ---> 'set variable the variable named "button" to the number of the button (1-10). (it's important you put the 'do later' action so make sure that extension is installed.
and in each button put 'on leavemouse' ---> 'set variable' the variable named "button" to 0. that way when the cursor leaves the button it switches to a "clear texture.

and that's it!


james_wards
Registered User
Quote
2016-09-18 00:18:17

Hey Tim thank you very much for your reply. The soonest I am available I will test this immediately and see if I can get it to work. If I am able to get it to work the $20 USD is yours. In the meantime the offer is still on the table if anyone else has any other ways to do it, but I will be attempting them in the order they are posted. Thank you.


james_wards
Registered User
Quote
2016-09-18 00:19:18

Also tim do you have skype? Maybe you can message me through this if I have difficulty. Thank you.


tim12345
Guest
Quote
2016-09-18 01:17:00

no, but i can be reached by phone via my website ---> http://www.timiscool.net


james_wards
Registered User
Quote
2016-09-18 01:36:20

Tim, you lost me at "Enter Mouse" -> "Do Later". There appears to be no option to do anything later or After X amount of time in the "Enter Mouse" options for the "When Moused Over" options.


james_wards
Registered User
Quote
2016-09-18 01:39:18

Tim do you have some form of Instant Messanger? Facebook? Wechat? Whatsapp? Anything? If you don't, are you able to organize a free skype account and add me? james_wards1 is my username.


james_wards
Registered User
Quote
2016-09-18 01:52:20

Any chance you could whip this up in a coppercube file mock and send it through? Perhaps I could pull it apart that way, I can't for the life of me get this working.


tim12345
Guest
Quote
2016-09-18 01:57:51

ok let me see


kiranmiller
Registered User
Quote
2019-04-27 08:48:09

Is there anyone who share custom mouse pointers because it'll help a lot.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (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© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact