Game Development Community

isnt T3D Mouse Cursor change Bug fixed?

by Enel · in Torque 3D Professional · 04/22/2010 (2:13 am) · 9 replies

im usgin this code
new GuiCursor(IdleCursor)
{
      hotSpot = "1 1";
      bitmapName = "/art/gui/GideonUI/MouseIdlePoint";
};

Canvas.setCursor(IdleCursor);

but.. cursor dosent change


I think that bottom code has problem

// gui/core/guicanvas.cpp -> GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */) function

      if (!mPlatformWindow->getCursorController() || (mCursorEnabled && mouseCursor && mShowCursor && 
         !mPlatformWindow->getCursorController()->isCursorVisible()))
      {
         Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
         Point2I spot = mouseCursor->getHotSpot();

         pos -= spot;
         mouseCursor->render(pos);
      }

Why mPlatformWindow->getCursorController() function has always return true??



and than if excute a force mouseCursor->render(pos); function

mTextureObject has appreciate isnt exsist object

// gui/core/guiTypes.cpp GuiCursor::render(const Point2I &pos) function

   if (!mTextureObject && mBitmapName && mBitmapName[0])
   {
      mTextureObject.set( mBitmapName, &GFXGuiCursorProfile, avar("%s() - mTextureObject (line %d)", __FUNCTION__, __LINE__));
      if(!mTextureObject)
         return;
      mExtent.set(mTextureObject->getWidth(), mTextureObject->getHeight());
   }



plz.. anyone try fix this code

also im try to fix this code :)

#1
04/25/2010 (3:20 am)
We fixed it in our game projects.

Change this

// Really draw the cursor. :)
      // Only if the platform cursor controller is missing or the platform cursor
      // isn't visible.
      if (!mPlatformWindow->getCursorController() || (mCursorEnabled && mouseCursor && mShowCursor && 
         !mPlatformWindow->getCursorController()->isCursorVisible()))
      {
         Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
         Point2I spot = mouseCursor->getHotSpot();

         pos -= spot;
         mouseCursor->render(pos);
      }

to

// Really draw the cursor. :)
      // Only if the platform cursor controller is missing or the platform cursor
      // isn't visible.
      mPlatformWindow->setCursorVisible(false);
      if ( (mCursorEnabled && mouseCursor && mShowCursor) )
      {
         Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
         Point2I spot = mouseCursor->getHotSpot();

         pos -= spot;
         mouseCursor->render(pos);
      }
#2
04/25/2010 (4:55 am)
omg.. that's Cool!

why i dont think about that :P


Thx Kodgraf!


My game is more completed! caused by you :)
#3
06/18/2010 (11:10 pm)
@kodgraf Great Work. It works Fine.


#4
07/17/2015 (7:26 pm)
And that was still found in Torque 3D MIT version 3.51 :O) Now fixed!
#5
07/21/2015 (9:05 pm)
This will cause issues with the menu of the editor. This fix only would work if you'd distribute your game without the editor.
#6
07/22/2015 (6:20 am)
Well, there is a global (don't recall the name) that could be checked to catch the editor issue in theory. Have to start playing with it now....

In the mean time, someone could try this out:
// at top of guiCanvas
extern bool gEditingMission;

// now, in renderFrame():

      // Really draw the cursor. :)
      // Only if the platform cursor controller is missing or the platform cursor
      // isn't visible.
	  if (gEditingMission)
	  {
		  if (!mPlatformWindow->getCursorController() || (mCursorEnabled && mouseCursor && mShowCursor &&
			  !mPlatformWindow->getCursorController()->isCursorVisible()))
		  {
			  Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
			  Point2I spot = mouseCursor->getHotSpot();

			  pos -= spot;
			  mouseCursor->render(pos);
		  }
	  }
	  else
	  {
		  // Only if the platform cursor controller is missing or the platform cursor  
		  // isn't visible.  
		  mPlatformWindow->setCursorVisible(false);
		  if ((mCursorEnabled && mouseCursor && mShowCursor))
		  {
			  Point2I pos((S32)mCursorPt.x, (S32)mCursorPt.y);
			  Point2I spot = mouseCursor->getHotSpot();

			  pos -= spot;
			  mouseCursor->render(pos);
		  }
	  }
#7
07/22/2015 (5:23 pm)
@Nils
Quote:This will cause issues with the menu of the editor. This fix only would work if you'd distribute your game without the editor.

Yups that is what I aim for :O)

@Ranft

nice idea! I shall check it out tomorrow :O)
#8
07/30/2015 (2:51 pm)
Did that work? I haven't had a chance to actually try it myself yet....
#9
08/03/2015 (7:00 am)
@Ranft

Sorry, I have not had a chance to test it out yet as we had to go to London and all suddenly became more busy. Just came home a few days ago...

Nice city by the way :O)

Shall have a look soon when time is coming up. Perhaps tomorrow :O)

Time is a limited resource in these days :O)