mirror of https://git.56k.es/fanta/fddgui.git
peta en beta
This commit is contained in:
parent
c2264db87f
commit
2856916b33
59
main.lua
59
main.lua
|
@ -11,14 +11,14 @@ screenSizeW = love.graphics.getWidth()
|
|||
screenSizeH = love.graphics.getHeight()
|
||||
|
||||
love.window.setTitle( "FDD GUI" )
|
||||
font = love.graphics.newFont("res/fonts/old_computer_st.ttf", 12)
|
||||
font = love.graphics.newFont("res/fonts/COMPUTERRobot.ttf", 20)
|
||||
|
||||
monitor = {}
|
||||
monitor.img = love.graphics.newImage("res/imgs/disquete.png")
|
||||
monitor.width = 200
|
||||
monitor.height = 200
|
||||
monitor.x = (screenSizeW/2)-(monitor.width/2)
|
||||
monitor.y = (screenSizeH/2)-(monitor.height/2)
|
||||
disquete = {}
|
||||
disquete.img = love.graphics.newImage("res/imgs/disquete.png")
|
||||
disquete.width = 200
|
||||
disquete.height = 200
|
||||
disquete.x = (screenSizeW/2)-(disquete.width/2)
|
||||
disquete.y = (screenSizeH/2)-(disquete.height/2)
|
||||
|
||||
rkey = {}
|
||||
rkey.img = love.graphics.newImage("res/imgs/keyboard_key_r.png")
|
||||
|
@ -47,9 +47,9 @@ function check_dependencies()
|
|||
end
|
||||
|
||||
function draw_floppyDiskName(floppydisk_name)
|
||||
love.graphics.setColor(255,255,255)
|
||||
love.graphics.setColor(2550,255,255)
|
||||
love.graphics.setFont(font)
|
||||
love.graphics.printf(floppydisk_name,(screenSizeW/2)-50,(screenSizeH/2)-3,400,left)
|
||||
love.graphics.printf(floppydisk_name,335,292,400,left)
|
||||
end
|
||||
|
||||
function download_gameList(url_gameList)
|
||||
|
@ -82,16 +82,34 @@ function download_listGames(file)
|
|||
return arr
|
||||
end
|
||||
|
||||
function check_numberGames()
|
||||
os.execute("ls -1 /home/fanta/.fdd/ | wc -l")
|
||||
function load_games()
|
||||
n=0
|
||||
game = {}
|
||||
for l in io.lines(pathFDD.."/archive.lst") do
|
||||
n=n+1
|
||||
g = split_string(l, ";")
|
||||
table.insert(game, g[2])
|
||||
end
|
||||
max=n
|
||||
print(n.." games")
|
||||
end
|
||||
|
||||
function next_game()
|
||||
if n==max then
|
||||
n=1
|
||||
else
|
||||
n=n+1
|
||||
end
|
||||
print("ch game: "..game[n])
|
||||
end
|
||||
|
||||
|
||||
-- FUNCIONES LOVE
|
||||
|
||||
function love.load()
|
||||
check_dependencies()
|
||||
download_gameList(urlGameList)
|
||||
check_numberGames()
|
||||
load_games()
|
||||
end
|
||||
|
||||
function love.update()
|
||||
|
@ -105,8 +123,8 @@ end
|
|||
|
||||
function love.draw()
|
||||
love.graphics.setBackgroundColor( (170/255), (100/255), (70/255) )
|
||||
love.graphics.draw(monitor.img,monitor.x,monitor.y)
|
||||
draw_floppyDiskName("Darkseed")
|
||||
love.graphics.draw(disquete.img,disquete.x,disquete.y)
|
||||
draw_floppyDiskName(game[n])
|
||||
love.graphics.draw(rkey.img, rkey.x, rkey.y)
|
||||
end
|
||||
|
||||
|
@ -118,7 +136,18 @@ function love.keypressed(key)
|
|||
|
||||
if key == "r" then
|
||||
print("re-check game repository")
|
||||
download_listGames("/home/fanta/.fdd/archive.lst")
|
||||
download_listGames(pathFDD.."/archive.lst")
|
||||
end
|
||||
|
||||
if key == "right" then
|
||||
next_game()
|
||||
--download_listGames(pathFDD.."/archive.lst")
|
||||
end
|
||||
|
||||
if key == "return" then
|
||||
print("run !")
|
||||
os.execute("tar xfvz "..pathFDD.."/"..game[n].." -C "..pathFDD.."/")
|
||||
os.execute("name=$(echo "..game[n].."|cut -d . -f 1); bash "..pathFDD.."/$name/dos-*")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue