Bugfix : mouse-over des icônes play et pause

This commit is contained in:
Philippe Roy 2023-07-13 02:12:52 +02:00
parent 107c9e1208
commit f0390c7ce4
6 changed files with 36 additions and 13 deletions

Binary file not shown.

35
cine.py
View File

@ -97,12 +97,17 @@ def keyboard(cont):
anim_pause() anim_pause()
scene.objects['Pause'].setVisible(False,False) scene.objects['Pause'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Pause'].suspendPhysics()
scene.objects['Play'].setVisible(True,False) scene.objects['Play'].setVisible(True,False)
scene.objects['Play'].restorePhysics()
else: else:
anim_play() anim_play()
scene.objects['Pause']['MO_desactive']=True # Rester avec Pause-Hl -> Desactive le MO
scene.objects['Play'].setVisible(False,False) scene.objects['Play'].setVisible(False,False)
scene.objects['Play-Hl'].setVisible(False,False) scene.objects['Play-Hl'].setVisible(False,False)
scene.objects['Play'].suspendPhysics()
scene.objects['Pause'].setVisible(True,False) scene.objects['Pause'].setVisible(True,False)
scene.objects['Pause'].restorePhysics()
# Touche H -> Cacher l'objet (hide) # Touche H -> Cacher l'objet (hide)
if JUST_ACTIVATED in keyboard.inputs[bge.events.HKEY].queue: if JUST_ACTIVATED in keyboard.inputs[bge.events.HKEY].queue:
@ -144,6 +149,7 @@ def cmd_init():
# UI : Commands # UI : Commands
scene.objects['Play-Hl'].setVisible(False,False) scene.objects['Play-Hl'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Play'].suspendPhysics()
scene.objects['Reset-colors-Hl'].setVisible(False,False) scene.objects['Reset-colors-Hl'].setVisible(False,False)
scene.objects['Reset-view-Hl'].setVisible(False,False) scene.objects['Reset-view-Hl'].setVisible(False,False)
scene.objects['Help-cmd-Hl'].setVisible(False,False) scene.objects['Help-cmd-Hl'].setVisible(False,False)
@ -165,12 +171,14 @@ def cmd_hl(cont):
# Activation # Activation
if cont.sensors['MO'].status == JUST_ACTIVATED and scene.objects['Mecanism']['manip_mode']==0: if cont.sensors['MO'].status == JUST_ACTIVATED and scene.objects['Mecanism']['manip_mode']==0:
if obj.name!="Play" and obj.name!="Pause" and obj.name!="Play-Hl" and obj.name!="Pause-Hl":
# Autres que Play et Pause
if obj.name!="Play" and obj.name!="Pause":
obj.setVisible(False,True) obj.setVisible(False,True)
scene.objects[obj.name+'-Hl'].setVisible(True,True) scene.objects[obj.name+'-Hl'].setVisible(True,True)
# obj.color = color_cmd_hl # obj.color = color_cmd_hl
# Play et pause # Play ou Pause
if obj.name=="Pause" or obj.name=="Play": if obj.name=="Pause" or obj.name=="Play":
if scene.objects['Mecanism']['anim'] == True: if scene.objects['Mecanism']['anim'] == True:
scene.objects['Pause'].setVisible(False,False) scene.objects['Pause'].setVisible(False,False)
@ -181,13 +189,23 @@ def cmd_hl(cont):
# Désactivation # Désactivation
if cont.sensors['MO'].status == JUST_RELEASED and scene.objects['Mecanism']['manip_mode']==0: if cont.sensors['MO'].status == JUST_RELEASED and scene.objects['Mecanism']['manip_mode']==0:
if obj.name!="Play" and obj.name!="Pause" and obj.name!="Play-Hl" and obj.name!="Pause-Hl":
# Autres que Play et Pause
if obj.name!="Play" and obj.name!="Pause":
scene.objects[obj.name+'-Hl'].setVisible(False,True) scene.objects[obj.name+'-Hl'].setVisible(False,True)
obj.setVisible(True,True) obj.setVisible(True,True)
# Play et pause # Play ou Pause
if obj.name=="Pause" or obj.name=="Play": if obj.name=="Pause" or obj.name=="Play":
# Rester avec Pause-Hl -> Désactive le MO
if scene.objects['Pause']['MO_desactive']==True:
scene.objects['Pause']['MO_desactive']=False
else:
# MO actif
if scene.objects['Mecanism']['anim'] == True: if scene.objects['Mecanism']['anim'] == True:
if scene.objects['Pause']['MO_desactive']==False:
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Pause'].setVisible(True,False) scene.objects['Pause'].setVisible(True,False)
else: else:
@ -202,20 +220,25 @@ def cmd_click(cont):
obj = cont.owner obj = cont.owner
if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Mecanism']['manip_mode']==0: if cont.sensors['Click'].status == JUST_ACTIVATED and cont.sensors['MO'].positive and scene.objects['Mecanism']['manip_mode']==0:
# Play et pause # Play ou Pause
if obj.name=="Pause" or obj.name=="Run": if obj.name=="Pause" or obj.name=="Play":
# Pause # Pause
if scene.objects['Mecanism']['anim'] == True: if scene.objects['Mecanism']['anim'] == True:
anim_pause() anim_pause()
scene.objects['Pause'].setVisible(False,False) scene.objects['Pause'].setVisible(False,False)
scene.objects['Pause-Hl'].setVisible(False,False) scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Pause'].suspendPhysics()
scene.objects['Play-Hl'].setVisible(True,False) scene.objects['Play-Hl'].setVisible(True,False)
scene.objects['Play'].restorePhysics()
else: else:
# Play # Play
anim_play() anim_play()
scene.objects['Pause']['MO_desactive']=True # Rester avec Pause-Hl -> Desactive le MO
scene.objects['Play'].setVisible(False,False) scene.objects['Play'].setVisible(False,False)
scene.objects['Play-Hl'].setVisible(False,False) scene.objects['Play-Hl'].setVisible(False,False)
scene.objects['Play'].suspendPhysics()
scene.objects['Pause-Hl'].setVisible(True,False) scene.objects['Pause-Hl'].setVisible(True,False)
scene.objects['Pause'].restorePhysics()
# Reset-colors # Reset-colors
if obj.name=="Reset-colors" : if obj.name=="Reset-colors" :

View File

@ -1,7 +1,7 @@
<data> <data>
<screen> <screen>
<width>1548</width> <width>1412</width>
<height>871</height> <height>795</height>
<quality>1</quality> <quality>1</quality>
</screen> </screen>
</data> </data>

Binary file not shown.