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.

45
cine.py
View File

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

View File

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

Binary file not shown.