O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - customizing the mouse cursor

In this case, it will be easier to let the process explain itself, so let's dive right in.

  1. Open WorldClass_02.py.
  2. Add this line of code to our imports. While we're here, let's update our imports to use RaceClass_01.py instead of RaceClass_00.py.
    from pandac.PandaModules import *
    
  3. Scroll down to the __init__ method and add this block of code right at the top of the method:
    cursor = loader.loadModel("../Models/Cursor.egg")
    cursor.reparentTo(render2d)
    cursor.setBin("gui-popup", 100)
    cursor.hide()
    props = WindowProperties()
    props.setCursorHidden(True)
    base.win.requestProperties(props)
    base.mouseWatcherNode.setGeometry(cursor.node())
    self.totalItems = len(self.models)
    
  4. Next, scroll down to the line where we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required