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

This commit is contained in:
Philippe Roy 2022-12-05 13:52:53 +01:00
parent 5b3f8baf6f
commit fb5245656b
26 changed files with 128 additions and 17 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_about.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_about.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_config.xml /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_config.xml

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_doc.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_doc.py

View File

@ -44,6 +44,20 @@ def open():
scene.objects['About'].setVisible(True,True) scene.objects['About'].setVisible(True,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()
def close(cont): def close(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 :
if scene.objects['About']['anim'] == True: if scene.objects['About']['anim'] == True:
@ -101,6 +115,40 @@ 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 :
@ -114,6 +162,54 @@ def screen_up(cont):
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height) scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)
bge.render.setWindowSize(screen_width,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()
# 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 :
@ -126,3 +222,18 @@ def screen_down(cont):
screen_height=screen_height_mode[i-1] screen_height=screen_height_mode[i-1]
scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height) scene.objects['About_screen']['Text']= "Taille écran : "+str(screen_width) +" x "+str(screen_height)
bge.render.setWindowSize(screen_width,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()

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_about.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_about.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_config.xml /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_config.xml

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_doc.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_doc.py

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_about.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_about.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_config.xml /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_config.xml

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_doc.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_doc.py

Binary file not shown.

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_about.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_about.py

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_config.xml /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_config.xml

View File

@ -1 +1 @@
/home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic-player/cine_doc.py /home/phroy/Bureau/seriousgames/blender-edutech/git/kinematic_player/cine_doc.py

Binary file not shown.