commit b7c4763703f6ffe0251e4edd97b0690969526e5a Author: guillaume Date: Sat Dec 3 15:24:18 2022 +0100 [INIT] FE emu diff --git a/conf/config.ini b/conf/config.ini new file mode 100644 index 0000000..443773c --- /dev/null +++ b/conf/config.ini @@ -0,0 +1,20 @@ +[Media] + +#x_resolution = 800 +#y_resolution = 600 + +square_size = 350 + +x_resolution = 1920 +y_resolution = 1080 + +force_resolution = y + + + +background = ./media/wallpaper.png + + + + + diff --git a/conf/games.ini b/conf/games.ini new file mode 100644 index 0000000..c526dc0 --- /dev/null +++ b/conf/games.ini @@ -0,0 +1,7 @@ +[emulateurs] + +EmulateurList=["mame","neogeo","fba"] + +[mame] + +mameList=["p75","space-invader"] \ No newline at end of file diff --git a/data/emu/bin/fba.sh b/data/emu/bin/fba.sh new file mode 100644 index 0000000..e69de29 diff --git a/data/emu/bin/gameboy.sh b/data/emu/bin/gameboy.sh new file mode 100644 index 0000000..e69de29 diff --git a/data/emu/bin/mame.sh b/data/emu/bin/mame.sh new file mode 100644 index 0000000..e69de29 diff --git a/data/emu/bin/megadrive.sh b/data/emu/bin/megadrive.sh new file mode 100644 index 0000000..e69de29 diff --git a/data/emu/bin/neogeo.sh b/data/emu/bin/neogeo.sh new file mode 100644 index 0000000..e69de29 diff --git a/data/emu/media/fba.png b/data/emu/media/fba.png new file mode 100644 index 0000000..9ceaa65 Binary files /dev/null and b/data/emu/media/fba.png differ diff --git a/data/emu/media/gameboy.png b/data/emu/media/gameboy.png new file mode 100644 index 0000000..0c1cc76 Binary files /dev/null and b/data/emu/media/gameboy.png differ diff --git a/data/emu/media/mame.png b/data/emu/media/mame.png new file mode 100644 index 0000000..689cd05 Binary files /dev/null and b/data/emu/media/mame.png differ diff --git a/data/emu/media/megadrive.png b/data/emu/media/megadrive.png new file mode 100644 index 0000000..df25122 Binary files /dev/null and b/data/emu/media/megadrive.png differ diff --git a/data/emu/media/neogeo.png b/data/emu/media/neogeo.png new file mode 100644 index 0000000..d38f6ff Binary files /dev/null and b/data/emu/media/neogeo.png differ diff --git a/modules/__pycache__/arrow.cpython-310.pyc b/modules/__pycache__/arrow.cpython-310.pyc new file mode 100644 index 0000000..e539ba2 Binary files /dev/null and b/modules/__pycache__/arrow.cpython-310.pyc differ diff --git a/modules/__pycache__/emulateur_display.cpython-310.pyc b/modules/__pycache__/emulateur_display.cpython-310.pyc new file mode 100644 index 0000000..49dbbf3 Binary files /dev/null and b/modules/__pycache__/emulateur_display.cpython-310.pyc differ diff --git a/modules/arrow.py b/modules/arrow.py new file mode 100644 index 0000000..2013738 --- /dev/null +++ b/modules/arrow.py @@ -0,0 +1,24 @@ +#def KeyBind(): + + + +def Escape(event): + print("ESC key pressed") + window.quit() + + + + + + +def leftKey(event): + global cpt + cpt = cpt - 1 + print("DEBUG : " + str(cpt)) + + +def rightKey(event): + global cpt + cpt = cpt + 1 + print("DEBUG : " + str(cpt)) + diff --git a/modules/calcul_geo.py b/modules/calcul_geo.py new file mode 100644 index 0000000..8eec1f2 --- /dev/null +++ b/modules/calcul_geo.py @@ -0,0 +1,10 @@ +def IdEmu(list): + for Id in list: + print(list) + + +class Consol: + def __init__(self,Liste): + self.Liste=Liste + def getVal(self): + return self.val*self.val \ No newline at end of file diff --git a/modules/emulateur_display.py b/modules/emulateur_display.py new file mode 100644 index 0000000..31b7478 --- /dev/null +++ b/modules/emulateur_display.py @@ -0,0 +1,7 @@ + +def Display_left(MiddleSquareX, MiddleSquareY, MiddleSquareX2, MiddleSquareY2): + Cnv.create_rectangle ( MiddleSquareX, MiddleSquareY, MiddleSquareX2, MiddleSquareY2,fill='black' ) + +def IdEmu(list): + print(list) + diff --git a/start.py b/start.py new file mode 100755 index 0000000..07227ca --- /dev/null +++ b/start.py @@ -0,0 +1,177 @@ +#!/usr/bin/env python3 + +global cpt +FirstRun = 1 +cpt = 0 +import configparser +from collections import Counter +from tkinter import * +from tkinter import ttk +from PIL import Image, ImageTk +import PIL.Image +import PIL.ImageTk +import sys +from modules.arrow import * +from modules.emulateur_display import * +import time +import os +sys.path.append( './modules/') +from arrow import * + + + + +def ViewEmu(cL,xL,yL,cM,xM,yM,cR,xR,yR): + NfL="./data/emu/media/" + res[cL] + ".png" + print("DEBUG : " + str(cL) + " || FILE : " + NfL ) + PNfL = PhotoImage(file = NfL) + LabelPNfL = Label(arkadeus, image=PNfL) + LabelPNfL.PNfL = PNfL + Cnv.create_image(xL, yL, image=PNfL) + + NfM="./data/emu/media/" + res[cM] + ".png" + print("DEBUG : " + str(cM) + " || FILE : " + NfM ) + PNfM = PhotoImage(file = NfM) + LabelPNfM = Label(arkadeus, image=PNfM) + LabelPNfM.PNfM = PNfM + Cnv.create_image(xM, yM, image=PNfM) + + NfR="./data/emu/media/" + res[cR] + ".png" + print("DEBUG : " + str(cR) + " || FILE : " + NfR ) + PNfR = PhotoImage(file = NfR) + LabelPNfR = Label(arkadeus, image=PNfR) + LabelPNfR.PNfR = PNfR + Cnv.create_image(xR, yR, image=PNfR) + + Cnv.pack(fill = "both", expand = True) + + + +def leftKey(): + global cpt + cpt = cpt - 1 + if cpt < 0: + cpt = EmuCpt + Lcpt = cpt + Mcpt = cpt + 1 + Rcpt = cpt + 2 + if Mcpt > EmuCpt: + Mcpt = 0 + Rcpt = 1 + if Rcpt > EmuCpt: + Rcpt = 0 + + ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY) + +def rightKey(): + global cpt + global cpt + cpt = cpt + 1 + if cpt > EmuCpt: + cpt = 0 + Lcpt = cpt + Mcpt = cpt + 1 + Rcpt = cpt + 2 + if Mcpt > EmuCpt: + Mcpt = 0 + Rcpt = 1 + if Rcpt > EmuCpt: + Rcpt = 0 + + + ViewEmu(Lcpt,LeftSquareX, LeftSquareY,Mcpt,MiddleSquareX, MiddleSquareY,Rcpt,RightSquareX, RightSquareY) + +def Escape(event): + print("ESC key pressed") + arkadeus.quit() + + +arkadeus= Tk() + +global res +res = [] + +dir_path = r'./data/emu/bin/' + +# Iterate directory +for path in os.listdir(dir_path): + if os.path.isfile(os.path.join(dir_path, path)): + FileName=os.path.splitext(path)[0] + res.append(FileName) + print("DEBUG : " + FileName) + +cnt = Counter(res) +global EmuCpt +EmuCpt=len(cnt) - 1 +print(" Nmbre emulateur : " + str(EmuCpt)) + + +config_obj = configparser.ConfigParser() +config_obj.read("./conf/config.ini") +Media = config_obj["Media"] +ForceRes = Media["force_resolution"] +Background = Media["background"] +Square = int(Media["square_size"]) + +config_rom = configparser.ConfigParser() +config_rom.read("./conf/games.ini") + +Emulateur = config_rom["emulateurs"] + +print(Emulateur["EmulateurList"]) +IdEmu(Emulateur["EmulateurList"]) + + +arkadeus.attributes('-fullscreen', True) +arkadeus.title("Arkadeus") + + + +if ForceRes == "y": + Xsize = int(Media["x_resolution"]) + Ysize = int(Media["y_resolution"]) +else: + Xsize = arkadeus.winfo_screenwidth() + Ysize = arkadeus.winfo_screenheight() + + +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) +MiddleSquareY=(Ysize/2) +MiddleSquareX2=MiddleSquareX + Square +MiddleSquareY2=MiddleSquareY + Square + +LeftSquareX=(Xsize/3) +LeftSquareY=(Ysize/3) + +LeftSquareX2=LeftSquareX + Square +LeftSquareY2=LeftSquareY + Square + +RightSquareX=(Xsize*2/3) +RightSquareY=(Ysize/3) + +RightSquareX2=RightSquareX + Square +RightSquareY2=RightSquareY + Square + + +ViewEmu(cpt,LeftSquareX, LeftSquareY,cpt+1,MiddleSquareX, MiddleSquareY,cpt+2,RightSquareX, RightSquareY) + + +arkadeus.bind("", lambda event: leftKey()) +arkadeus.bind("", lambda event: rightKey()) + + +arkadeus.bind('',Escape) + +arkadeus.mainloop()