Invisibilisation des boutons < et > en fonction de la taille de l'écran

This commit is contained in:
Philippe Roy 2022-11-26 01:29:27 +01:00
parent 2716fb34dd
commit 944b23fb4e
3 changed files with 42 additions and 0 deletions

Binary file not shown.

28
rp.py
View File

@ -1392,6 +1392,20 @@ def about_screen_up(cont):
scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
bge.render.setWindowSize(screen_width,screen_height)
# Boutons < et >
if screen_width <=640:
scene.objects['About_screen-down'].setVisible(False,True)
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-down'].setVisible(True,True)
scene.objects['About_screen-down-colbox'].restorePhysics()
if screen_width >= 1920:
scene.objects['About_screen-up'].setVisible(False,True)
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-up'].setVisible(True,True)
scene.objects['About_screen-up-colbox'].restorePhysics()
# Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
rp_config_tree[0][3][0].text=str(screen_width)
rp_config_tree[0][3][1].text=str(screen_height)
@ -1411,6 +1425,20 @@ def about_screen_down(cont):
scene.objects['About_screen']['Text']= "SCREEN SIZE : "+str(screen_width) +" x "+str(screen_height)
bge.render.setWindowSize(screen_width,screen_height)
# Boutons < et >
if screen_width <=640:
scene.objects['About_screen-down'].setVisible(False,True)
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-down'].setVisible(True,True)
scene.objects['About_screen-down-colbox'].restorePhysics()
if screen_width >= 1920:
scene.objects['About_screen-up'].setVisible(False,True)
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-up'].setVisible(True,True)
scene.objects['About_screen-up-colbox'].restorePhysics()
# Maj du fichier de config (screen size : data/config/screen/width-> [0][3][0].text)
rp_config_tree[0][3][0].text=str(screen_width)
rp_config_tree[0][3][1].text=str(screen_height)

View File

@ -46,6 +46,20 @@ def open():
scene.objects['About']['timer'] = 0
scene.objects['About']['anim'] = True
# Boutons < et > ("640x360", "960x540", "1280x720", "1920x1080")
if bge.render.getWindowWidth() <=640:
scene.objects['About_screen-down'].setVisible(False,True)
scene.objects['About_screen-down-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-down'].setVisible(True,True)
scene.objects['About_screen-down-colbox'].restorePhysics()
if bge.render.getWindowWidth() >= 1920:
scene.objects['About_screen-up'].setVisible(False,True)
scene.objects['About_screen-up-colbox'].suspendPhysics (True)
else:
scene.objects['About_screen-up'].setVisible(True,True)
scene.objects['About_screen-up-colbox'].restorePhysics()
##
# Animation de l'ouverture
##