Dad72 Posted August 13, 2014 Share Posted August 13, 2014 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 Quote Link to comment Share on other sites More sharing options...
davrous Posted August 13, 2014 Share Posted August 13, 2014 Hi, Did you have a look to the source code of Actions? It's something you could easily modify by yourself. Which kind of game are you working on?Bye,David Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 13, 2014 Author Share Posted August 13, 2014 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" Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 13, 2014 Author Share Posted August 13, 2014 In css I know do : a { cursor:pointer}but for actions cannot change this cursor? ceci ne fonctionne pas sur les actions. le curseur reste en pointer. canvas.style.cursor = ""; Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 13, 2014 Author Share Posted August 13, 2014 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; } }; }; Quote Link to comment Share on other sites More sharing options...
reddozen Posted August 13, 2014 Share Posted August 13, 2014 Maybe some way to specify exactly what you want including a URL? CSS / Style option for cursorcursor: url(../pix/cursor_ppk.cur),auto. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 13, 2014 Author Share Posted August 13, 2014 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; } }; }; Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 14, 2014 Author Share Posted August 14, 2014 It's good or it's not good the code above. Well I think I'll do otherwise without using actions. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 16, 2014 Author Share Posted August 16, 2014 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 18, 2014 Share Posted August 18, 2014 You should add it to our Projects post Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 18, 2014 Author Share Posted August 18, 2014 Yes. I open a topic to present. I just finished for the English language at the beginning of the project. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.