Jump to content

State of the cursor with the actions


Dad72
 Share

Recommended Posts


Can we changed the State of the mouse cursor when it points to an object. I would like that the cursor does not change with the mouseOver but rather to the mouseDown.

I create a small game type "click'n point" and I would like to see the points to find, but not with mouseOver.


 

Basically I would like to just be able to change the image of the cursor of mouse in "Action". It would be possible?

 

Thanks

Link to comment
Share on other sites

Yes I watch, but I do not see where this is happening.

 

When you point to an object that has an action the cursor becomes a "pointer", but I can't find where in the source code. I do not know change it for myself. I didn't include the code of the engine.

 

This is for a game "click and points"

Link to comment
Share on other sites

En faite je pense que c'est dans babylon.scene.js que cela ce trouve et pas dans actions :

 

Je pense que cela peut être modifier comme ca ? J'ai mis en commentaire ce que j'ai modifier dans la classe.

 

 

Can someone submit it on GITHUB

     function Scene(engine) {                        this.cursor = "pointer"; //### pointer par défaut     }     Scene.prototype.setCursor = function (cur) { //### modifier le curseur si besoin          this.cursor = cur;   };                Scene.prototype.attachControl = function () {                         this._onPointerMove = function (evt) {                var canvas = _this._engine.getRenderingCanvas();                if (pickResult.hit) {                    _this.setPointerOverMesh(pickResult.pickedMesh);                    canvas.style.cursor = _this.cursor; //### Le curseur qui est soit: "pointer" par défaut, soit: modifier par l'utilisateur                    _this._meshUnderPointer = pickResult.pickedMesh;                } else {                    _this.setPointerOverMesh(null);                    canvas.style.cursor = "";                    _this._meshUnderPointer = null;                }            };        };
Link to comment
Share on other sites

In Css I know do. the problem is not there. is that in babylon, mouse cursor is edit by JavaScript no matter what cursor I ask in css.

 

I put the example code that allow to solve the problem, hoping that DK will add this (please DK)

 



function Scene(engine) {

this.cursor = "pointer"; //### pointer par défaut


}

Scene.prototype.setCursor = function (cur) { //### modifier le curseur si besoin
this.cursor = cur;
};

Scene.prototype.attachControl = function () {


this._onPointerMove = function (evt) {
var canvas = _this._engine.getRenderingCanvas();


if (pickResult.hit) {
_this.setPointerOverMesh(pickResult.pickedMesh);
canvas.style.cursor = _this.cursor; //### Le curseur qui est soit: "pointer" par défaut, soit: modifier par l'utilisateur


_this._meshUnderPointer = pickResult.pickedMesh;
} else {
_this.setPointerOverMesh(null);
canvas.style.cursor = "";
_this._meshUnderPointer = null;
}


};
};

Link to comment
Share on other sites

I asked what type of game I wanted to do, then here's what looks like a beginning of reading.
At the moment it is in french, but I provided the English language later.
 
The game is to type "click and points" (escape from a penitentiary)
 
Game Evasion (introduction in french and English. the story is still in french)  ;) 
 
there is only one set, but I provide to others later in tackling different theme.
 
I hope you like this start.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...