This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_main.py
68 lines (59 loc) · 1.97 KB
/
game_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
61
62
63
64
65
66
67
68
from u_fsm import ConfigFSM
from t_engine import TextEngine
from direct.task import Task
from direct.showbase.ShowBase import ShowBase
from panda3d.core import loadPrcFileData, PandaSystem
from x_game import GameModel
from x_maps import MapsModel
from direct.gui.OnscreenText import OnscreenText, TextNode
from direct.gui.DirectGui import DirectFrame
appName = "This is not Earthbound 64"
loadPrcFileData("",
"""
window-title {}
#load-display pandagl
#win-size 1366 768
win-size 1280 720
fullscreen 0
cursor-hidden 0
show-frame-rate-meter 0
model-path $MAIN_DIR/egg/
framebuffer-multisample 1
#multisamples 8
#texture-anisotropic-degree 2
#textures-auto-power-2 1
#notify-level-device debug
#notify-level-device spam
#want-pstats 1
""".format(appName))
class Main(ShowBase, ConfigFSM):
def __init__(self):
self.loadingText = None
self.saveFolderPath = './saves/'
self.appName = appName
ShowBase.__init__(self)
self.textEngine = TextEngine(base.messenger.send)
self.mapData = MapsModel()
self.gameData = GameModel(self.saveFolderPath)
ConfigFSM.__init__(self)
self.disableMouse()
self.callLoadingScreen()
self.request("StartMenu")
# self.request("RPGField")
# self.request("Cutscene")
def callLoadingScreen(self):
self.loadingText = DirectFrame(
frameSize=(base.a2dLeft, base.a2dRight,
base.a2dBottom, base.a2dTop),
frameColor=(0, 0, 0, 1.0))
txt = OnscreenText("Loading...", 1, fg=(1, 1, 1, 1), pos=(
0, 0), align=TextNode.ACenter, scale=.07, mayChange=1)
txt.reparentTo(self.loadingText)
base.graphicsEngine.renderFrame()
base.graphicsEngine.renderFrame()
def removeLoadingScreen(self):
if self.loadingText:
self.loadingText.removeNode()
self.loadingText = None
game = Main()
game.run()