You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
Lua
61 lines
1.5 KiB
Lua
local http = require("socket.http")
|
|
|
|
-- VARIABLES
|
|
sysUser = os.getenv( "HOME" )
|
|
pathDosbox = "/usr/bin/dosbox"
|
|
pathFDD = sysUser.."/.fdd"
|
|
urlGameList="http://fanta.56k.es/fdd/fdd_server/archive.lst"
|
|
screenSizeW = love.graphics.getWidth()
|
|
screenSizeH = love.graphics.getHeight()
|
|
love.window.setTitle( "FDD GUI" )
|
|
font = love.graphics.newFont("res/fonts/old_computer_st.ttf", 12)
|
|
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)
|
|
|
|
-- FUNCIONES
|
|
|
|
function file_check(file_name)
|
|
local f=io.open(file_name, "r")
|
|
if f==nil then print(file_name.." not found. Install it and try again") os.exit() else print(file_name..": OK") end
|
|
end
|
|
|
|
function check_dependencies()
|
|
file_check(pathDosbox)
|
|
end
|
|
|
|
function draw_floppyDiskName(floppydisk_name)
|
|
love.graphics.setColor(255,255,255)
|
|
love.graphics.setFont(font)
|
|
love.graphics.printf(floppydisk_name,(screenSizeW/2)-50,(screenSizeH/2)-3,400,left)
|
|
end
|
|
|
|
function download_gameList(url_gameList)
|
|
os.execute("mkdir -p "..pathFDD)
|
|
local body, code = http.request(url_gameList)
|
|
local f = assert(io.open(pathFDD.."/archive.lst", "wb"))
|
|
f:write(body)
|
|
f:close()
|
|
end
|
|
|
|
|
|
-- FUNCIONES LOVE
|
|
|
|
function love.load()
|
|
check_dependencies()
|
|
download_gameList(urlGameList)
|
|
end
|
|
|
|
function love.update()
|
|
|
|
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")
|
|
end
|