Hey Shadowraix.
Not bad for an educational project.
One thing I would say is that UI can be pretty complicated but you've managed it OK with this example.
I would suggest a loop for things like:
Code: Select all
Button.Pound = {PosX = 5,PosY = 5,SizeX = 80,SizeY = 50,Text = "Pound",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Pound"
elseif ConvertTo == "None" then
ConvertTo = "Pound"
end
end}
Button.Francs = {PosX = 95,PosY = 5,SizeX = 80,SizeY = 50,Text = "Francs",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Francs"
elseif ConvertTo == "None" then
ConvertTo = "Francs"
end
end}
Button.Lire = {PosX = 185,PosY = 5,SizeX = 80,SizeY = 50,Text = "Lire",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Lire"
elseif ConvertTo == "None" then
ConvertTo = "Lire"
end
end}
Button.Mark = {PosX = 275,PosY = 5,SizeX = 80,SizeY = 50,Text = "Mark",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Mark"
elseif ConvertTo == "None" then
ConvertTo = "Mark"
end
end}
Button.Pesetas = {PosX = 365,PosY = 5,SizeX = 80,SizeY = 50,Text = "Pesetas",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Pesetas"
elseif ConvertTo == "None" then
ConvertTo = "Pesetas"
end
end}
Button.Dollar = {PosX = 455,PosY = 5,SizeX = 80,SizeY = 50,Text = "Dollar",CallBack = function()
if ConvertFrom == "None" then
ConvertFrom = "Dollar"
elseif ConvertTo == "None" then
ConvertTo = "Dollar"
end
end}
and:
Code: Select all
--Pounds Button--
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Pound.PosX,Button.Pound.PosY,Button.Pound.SizeX,Button.Pound.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Pound.Text,(Button.Pound.PosX + Button.Pound.SizeX/2)-font:getWidth(Button.Pound.Text)/2,(Button.Pound.PosY + Button.Pound.SizeY/2)-font:getHeight(Button.Pound.Text)/2)
--Francs Button
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Francs.PosX,Button.Francs.PosY,Button.Francs.SizeX,Button.Francs.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Francs.Text,(Button.Francs.PosX + Button.Francs.SizeX/2)-font:getWidth(Button.Francs.Text)/2,(Button.Francs.PosY + Button.Francs.SizeY/2)-font:getHeight(Button.Francs.Text)/2)
--Lire Button--
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Lire.PosX,Button.Lire.PosY,Button.Lire.SizeX,Button.Lire.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Lire.Text,(Button.Lire.PosX + Button.Lire.SizeX/2)-font:getWidth(Button.Lire.Text)/2,(Button.Lire.PosY + Button.Lire.SizeY/2)-font:getHeight(Button.Lire.Text)/2)
--Mark Button--
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Mark.PosX,Button.Mark.PosY,Button.Mark.SizeX,Button.Mark.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Mark.Text,(Button.Mark.PosX + Button.Mark.SizeX/2)-font:getWidth(Button.Mark.Text)/2,(Button.Mark.PosY + Button.Mark.SizeY/2)-font:getHeight(Button.Mark.Text)/2)
--Pesetas Button--
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Pesetas.PosX,Button.Pesetas.PosY,Button.Pesetas.SizeX,Button.Pesetas.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Pesetas.Text,(Button.Pesetas.PosX + Button.Pesetas.SizeX/2)-font:getWidth(Button.Pesetas.Text)/2,(Button.Pesetas.PosY + Button.Pesetas.SizeY/2)-font:getHeight(Button.Pesetas.Text)/2)
--Dollar Button--
love.graphics.setColor(83,185,210)
love.graphics.rectangle("fill",Button.Dollar.PosX,Button.Dollar.PosY,Button.Dollar.SizeX,Button.Dollar.SizeY)
love.graphics.setColor(255,255,255)
love.graphics.print(Button.Dollar.Text,(Button.Dollar.PosX + Button.Dollar.SizeX/2)-font:getWidth(Button.Dollar.Text)/2,(Button.Dollar.PosY + Button.Dollar.SizeY/2)-font:getHeight(Button.Dollar.Text)/2)
Other than that, good job.