Added debuglevel-based console-output
This commit is contained in:
18
Game.py
18
Game.py
@@ -20,7 +20,8 @@ from panda3d.core import loadPrcFile #Ermöglicht das Laden eigener Konfiguratio
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
class game(ShowBase):
|
class game(ShowBase):
|
||||||
|
__debug_mode = [0,1,2,3,4]
|
||||||
|
__debuglevel = 0
|
||||||
__us = User.User
|
__us = User.User
|
||||||
__statics = Statics.statics
|
__statics = Statics.statics
|
||||||
#__ctrl = Controls.controls
|
#__ctrl = Controls.controls
|
||||||
@@ -67,6 +68,11 @@ class game(ShowBase):
|
|||||||
#Zusatzfunktionen innerhalb instanzierter ShowBase-Klasse
|
#Zusatzfunktionen innerhalb instanzierter ShowBase-Klasse
|
||||||
def update_keystate(self, controlName, controlState):
|
def update_keystate(self, controlName, controlState):
|
||||||
self.__keymap[controlName] = controlState
|
self.__keymap[controlName] = controlState
|
||||||
|
|
||||||
|
def setDebugMode(self, debugmode:int):
|
||||||
|
"""DEBUGLEVEL"""
|
||||||
|
self.__debuglevel = debugmode
|
||||||
|
|
||||||
|
|
||||||
#Taskfunctions and definitions
|
#Taskfunctions and definitions
|
||||||
def task1(self, task):
|
def task1(self, task):
|
||||||
@@ -82,19 +88,19 @@ class game(ShowBase):
|
|||||||
|
|
||||||
def keyboard_event(self, task):
|
def keyboard_event(self, task):
|
||||||
|
|
||||||
print(self.__keymap)
|
if(self.__debuglevel == 4): print(self.__keymap)
|
||||||
|
|
||||||
if (self.__keymap['up']):
|
if (self.__keymap['up']):
|
||||||
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0,0.2,0))
|
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0,0.2,0))
|
||||||
print("Nach oben!")
|
if(self.__debuglevel >= 3): print("Nach oben!")
|
||||||
if (self.__keymap['down']):
|
if (self.__keymap['down']):
|
||||||
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0,0.2,0))
|
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0,0.2,0))
|
||||||
print("Nach unten!")
|
if(self.__debuglevel >= 3): print("Nach unten!")
|
||||||
if (self.__keymap['left']):
|
if (self.__keymap['left']):
|
||||||
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0.2,0,0))
|
self.__actor1.setPos(self.__actor1.getPos() - Vec3(0.2,0,0))
|
||||||
print("Nach links!")
|
if(self.__debuglevel >= 3): print("Nach links!")
|
||||||
if (self.__keymap['right']):
|
if (self.__keymap['right']):
|
||||||
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0.2,0,0))
|
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0.2,0,0))
|
||||||
print("Nach rechts!")
|
if(self.__debuglevel >= 3): print("Nach rechts!")
|
||||||
|
|
||||||
return Task.cont
|
return Task.cont
|
||||||
@@ -9,9 +9,10 @@ import subprocess
|
|||||||
def __main__():
|
def __main__():
|
||||||
#label = subprocess.check_output(["git", "describe"]).strip()
|
#label = subprocess.check_output(["git", "describe"]).strip()
|
||||||
def get_git_revision_hash():
|
def get_git_revision_hash():
|
||||||
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
return subprocess.check_output(['git', 'rev-parse', 'HEAD'])
|
||||||
|
|
||||||
game = Game.game()
|
game = Game.game()
|
||||||
|
game.setDebugMode(3)
|
||||||
game.run()
|
game.run()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ class statics:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
#def __init__(self) -> None:
|
||||||
for x in self._menupoints:
|
# for x in self._menupoints:
|
||||||
print(x)
|
# print(x)
|
||||||
|
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user