diff --git a/data/emu/media/mame_bg.png b/data/emu/media/mame_bg.png new file mode 100644 index 0000000..859b929 Binary files /dev/null and b/data/emu/media/mame_bg.png differ diff --git a/media/nobg.png b/media/nobg.png new file mode 100644 index 0000000..f179bc8 Binary files /dev/null and b/media/nobg.png differ diff --git a/media/noemu.png b/media/noemu.png new file mode 100644 index 0000000..d0fb53c Binary files /dev/null and b/media/noemu.png differ diff --git a/start.py b/start.py index 0c0789a..c82e953 100755 --- a/start.py +++ b/start.py @@ -15,21 +15,68 @@ from modules.arrow import * from modules.emulateur_display import * import time import os -sys.path.append( './modules/') -from arrow import * +#sys.path.append( './modules/') +#from arrow import * + +EmuMod = 1 +RomMod = 0 + + +#def EmuMod(): + +def BackgroundRom(Emu): + BgFile = "./data/emu/media/" + str(Emu) +"_bg.png" + BgFile = IsImgExist(BgFile,"bg") + BgEmu = PhotoImage(file = BgFile) + LabelBgEmu = Label(arkadeus,image=BgEmu) + LabelBgEmu.BgEmu = BgEmu + Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw") + + +def IsImgExist(AbsPathFile,TypeMedia): + if not os.path.exists(AbsPathFile): + match TypeMedia: + case "emu": + return "./media/noemu.png" + case "bg": + return "./media/nobg.png" + else: + return AbsPathFile + + + + +def BackgroundEmu(): + + BackgroundEmu = Media["background"] + BgEmu = PhotoImage(file = Background) + LabelBgEmu = Label(arkadeus,image=BgEmu) + LabelBgEmu.BgEmu = BgEmu + Cnv.create_image( 0, 0, image = BgEmu, anchor = "nw") + def EnterEmu(): + EmuMod=0 + RomMod=1 global cpt runMcpt = cpt + 1 if runMcpt > EmuCpt: runMcpt = 0 print("Emu : " + str(res[runMcpt])) + #Cnv.delete("all") + BackgroundRom(str(res[runMcpt])) + +#def ParseEmu(): + def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR): NfL="./data/emu/media/" + res[cL] + ".png" + NfL = IsImgExist(NfL,"emu") NfM="./data/emu/media/" + res[cM] + ".png" + NfM = IsImgExist(NfM,"emu") NfR="./data/emu/media/" + res[cR] + ".png" + NfR = IsImgExist(NfR,"emu") PNfL = PhotoImage(file = NfL) LabelPNfL = Label(arkadeus, image=PNfL) @@ -53,12 +100,6 @@ def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR): Cnv.create_image(xR, yR, image=PNfR) print("Curent Emu : " + str(res[cM])) - -# - #Cnv.pack(fill = "both", expand = True) - - - def leftKey(): global cpt cpt = cpt - 1 @@ -148,14 +189,6 @@ else: print("res : " + str(Xsize) + ":" + str(Ysize) ) -bg = PhotoImage(file = Background) - -Cnv = Canvas( arkadeus, width = Ysize , height = Xsize) - -Cnv.pack(fill = "both", expand = True) - - -Cnv.create_image( 0, 0, image = bg, anchor = "nw") MiddleSquareX=(Xsize/2) @@ -175,6 +208,10 @@ RightSquareY=(Ysize/3) RightSquareX2=RightSquareX + Square RightSquareY2=RightSquareY + Square +Cnv = Canvas( arkadeus, width = Ysize , height = Xsize) +Cnv.pack(fill = "both", expand = True) + +BackgroundEmu() ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY) arkadeus.bind("", lambda event: leftKey())