-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
60 lines (49 loc) · 1.36 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8-*-
#
# Import stuff in order to have a derived ShowBase extension running
# Remember to use every extension as a DirectObject inheriting class
#
from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject
from panda3d.core import *
#
# Task declaration import (uncomment to use)
#
#from direct.task import Task
#
# Default classes used to handle input and camera behaviour
# Useful for fast prototyping
#
from myCamera import *
from myInputHandler import InputHandler
from myDebug import DebugPrint
import sys,__builtin__
#
# Show FPS and use utf8 encoding
#
from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", """
text-encoding utf8
show-frame-rate-meter 1
""")
class World(ShowBase):
def __init__(self):
ShowBase.__init__(self)
#starting all base methods
__builtin__.myApp = self
__builtin__.d = DebugPrint()
__builtin__.myCamera = MyCamera()
__builtin__.myInputHandler = InputHandler()
#default config when just opened
myCamera.mm.showMouse()
myCamera.setUtilsActive()
self.defineBaseEvents()
self.mainScene = render.attachNewNode("mainScene")
#example debug line useful when prototyping
d.line("sandbox ready for prototyping!")
def getSceneNode(self):
return self.mainScene
def defineBaseEvents(self):
base.accept("escape", sys.exit)
w = World()
w.run()