Added debuglevel-based console-output

This commit is contained in:
2023-12-23 16:56:08 +01:00
parent ea8ad12c50
commit b8a8262a68
3 changed files with 18 additions and 11 deletions

18
Game.py
View File

@@ -20,7 +20,8 @@ from panda3d.core import loadPrcFile #Ermöglicht das Laden eigener Konfiguratio
import random
class game(ShowBase):
__debug_mode = [0,1,2,3,4]
__debuglevel = 0
__us = User.User
__statics = Statics.statics
#__ctrl = Controls.controls
@@ -67,6 +68,11 @@ class game(ShowBase):
#Zusatzfunktionen innerhalb instanzierter ShowBase-Klasse
def update_keystate(self, controlName, controlState):
self.__keymap[controlName] = controlState
def setDebugMode(self, debugmode:int):
"""DEBUGLEVEL"""
self.__debuglevel = debugmode
#Taskfunctions and definitions
def task1(self, task):
@@ -82,19 +88,19 @@ class game(ShowBase):
def keyboard_event(self, task):
print(self.__keymap)
if(self.__debuglevel == 4): print(self.__keymap)
if (self.__keymap['up']):
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']):
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']):
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']):
self.__actor1.setPos(self.__actor1.getPos() + Vec3(0.2,0,0))
print("Nach rechts!")
if(self.__debuglevel >= 3): print("Nach rechts!")
return Task.cont

View File

@@ -9,9 +9,10 @@ import subprocess
def __main__():
#label = subprocess.check_output(["git", "describe"]).strip()
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.setDebugMode(3)
game.run()
return 0

View File

@@ -7,9 +7,9 @@ class statics:
def __init__(self) -> None:
for x in self._menupoints:
print(x)
#def __init__(self) -> None:
# for x in self._menupoints:
# print(x)
pass
# pass