Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating an interactive user interface


With very few exceptions, nearly every game features some kind of menu-based user interaction for selecting game modes, browsing servers, setting game, and graphics options, or chatting with other players. Most likely, the games you are going to create with Panda3D will also have such requirements and you will need to create buttons, text input fields, loading bars, or whatever controls suit your needs. To make things easier for you, the Panda3D engine comes with a set of user interface classes that make it very easy to place controls on the screen and make them react to the players' actions.

Getting ready

Go back to Chapter 1 and follow the steps of the recipe Setting up the game structure if you haven't yet and you are set to go on with the following tasks.

How to do it...

Let's create a user interface:

  1. Paste the following source code to Application.py:

    from direct.showbase.ShowBase import ShowBase
    from direct.gui.DirectGui import *
    from direct.interval...