[UPDATE] navigation base emu/rom

This commit is contained in:
Guillaume Astier Ruiz 2022-12-04 15:08:35 +01:00
parent 7325dfa122
commit 793627a265
3 changed files with 36 additions and 17 deletions

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python3
global cpt
global EmuMod
FirstRun = 1
cpt = 0
import configparser
@ -19,9 +21,11 @@ import os
#from arrow import *
#EmuMod :
# 0 : Emu select
# 1 : Rom select
EmuMod = 1
RomMod = 0
EmuMod = 0
#def EmuMod():
@ -56,10 +60,10 @@ def BackgroundEmu():
LabelBgEmu.BgEmu = BgEmu
Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw")
def EnterEmu():
EmuMod=0
RomMod=1
def EnterEmu(GetEmuMod):
global EmuMod
global cpt
EmuMod=1
runMcpt = cpt + 1
if runMcpt > EmuCpt:
runMcpt = 0
@ -100,7 +104,7 @@ def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR):
Cnv.create_image(xR, yR, image=PNfR)
print("Curent Emu : " + str(res[cM]))
def leftKey():
def leftKey(GetEmuMod):
global cpt
cpt = cpt - 1
if cpt < 0:
@ -113,10 +117,11 @@ def leftKey():
Rcpt = 1
if Rcpt > EmuCpt:
Rcpt = 0
if GetEmuMod == 0:
print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt))
ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY)
ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY)
def rightKey():
def rightKey(GetEmuMod):
global cpt
cpt = cpt + 1
if cpt > EmuCpt:
@ -131,11 +136,25 @@ def rightKey():
Rcpt = 0
ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY)
if GetEmuMod == 0:
print("DEBUG : " + str(EmuMod) + " Emu : " + str(cpt))
ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY)
def Escape(GetEmuMod):
if GetEmuMod == 0:
print("Ciao !!")
arkadeus.quit()
if GetEmuMod == 1:
#Cnv.delete("all")
global EmuMod
global cpt
cpt = 0
EmuMod = 0
BackgroundEmu()
ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY)
def Escape(event):
print("ESC key pressed")
arkadeus.quit()
arkadeus= Tk()
@ -214,10 +233,10 @@ Cnv.pack(fill = "both", expand = True)
BackgroundEmu()
ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY)
arkadeus.bind("<Left>", lambda event: leftKey())
arkadeus.bind("<Right>", lambda event: rightKey())
arkadeus.bind("<Return>", lambda event: EnterEmu())
arkadeus.bind('<Escape>',Escape)
arkadeus.bind("<Left>", lambda event: leftKey(EmuMod))
arkadeus.bind("<Right>", lambda event: rightKey(EmuMod))
arkadeus.bind("<Return>", lambda event: EnterEmu(EmuMod))
arkadeus.bind('<Escape>',lambda event : Escape(EmuMod))
arkadeus.mainloop()