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

This commit is contained in:
Philippe Roy 2022-12-05 14:19:02 +01:00
parent 4f930825bc
commit 7e6cb8116b

View File

@ -115,40 +115,6 @@ def get_near_pos(array,value):
idx = (np.abs(array-value)).argmin() idx = (np.abs(array-value)).argmin()
return idx return idx
# def about_screen_up(cont):
# if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
# screen_width_mode=[640, 960, 1280, 1920]
# screen_height_mode=[360, 540, 720,1080]
# screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
# i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
# if i>=0 and i<3 :
# screen_width=screen_width_mode[i+1]
# screen_height=screen_height_mode[i+1]
# 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)
# buffer_xml = ET.tostring(rp_config_tree)
# with open("rp_config.xml", "wb") as f:
# f.write(buffer_xml)
# Taille de l'écran + # Taille de l'écran +
def screen_up(cont): def screen_up(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive : if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
@ -176,40 +142,6 @@ def screen_up(cont):
scene.objects['About_screen-up'].setVisible(True,True) scene.objects['About_screen-up'].setVisible(True,True)
scene.objects['About_screen-up-colbox'].restorePhysics() scene.objects['About_screen-up-colbox'].restorePhysics()
# def about_screen_down(cont):
# if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
# screen_width_mode=[640, 960, 1280, 1920]
# screen_height_mode=[360, 540, 720,1080]
# screen_mode_txt=["640x360", "960x540", "1280x720", "1920x1080"]
# i = get_near_pos(screen_width_mode, bge.render.getWindowWidth())
# if i>0 and i<=3 :
# screen_width=screen_width_mode[i-1]
# screen_height=screen_height_mode[i-1]
# 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)
# buffer_xml = ET.tostring(rp_config_tree)
# with open("rp_config.xml", "wb") as f:
# f.write(buffer_xml)
# Taille de l'écran - # Taille de l'écran -
def screen_down(cont): def screen_down(cont):
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive : if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive :
@ -236,4 +168,3 @@ def screen_down(cont):
else: else:
scene.objects['About_screen-up'].setVisible(True,True) scene.objects['About_screen-up'].setVisible(True,True)
scene.objects['About_screen-up-colbox'].restorePhysics() scene.objects['About_screen-up-colbox'].restorePhysics()