CrossFire is a project that I started working on today. My goal is to re-create the same look and feel of the XMB. Currently I'm using LövePotion, because it is the most convenient option for creating a blueprint. At this stage I don't have any files to share, although the source code is freely available. Everything will work as is, should you decide to copy the code and paste it into a main.lua file.
Code:
-- Jonny Quest
-- CrossFire 0.1.1
-- November 6, 2016
selection = 1
selection_text = ""
spacing = 0
function love.load()
users = {
x = 70,
y = 50
}
settings = {
x = 140,
y = 50
}
photo = {
x = 210,
y = 50
}
music = {
x = 280,
y = 50
}
video = {
x = 350,
y = 50
}
game = {
x = 420,
y = 50
}
network = {
x = 490,
y = 50
}
friends = {
x = 560,
y = 50
}
selected = {
w = 35,
h = 35
}
unselected = {
w = 30,
h = 30
}
end
function love.update()
end
function love.draw()
love.graphics.setScreen("top")
if selection == 1 then
selection_text = "Users"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", users.x-2, users.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", users.x, users.y, unselected.w, unselected.h)
end
if selection == 2 then
selection_text = "Settings"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", settings.x-2, settings.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", settings.x, settings.y, unselected.w, unselected.h)
end
if selection == 3 then
selection_text = "Photo"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", photo.x-2, photo.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", photo.x, photo.y, unselected.w, unselected.h)
end
if selection == 4 then
selection_text = "Music"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", music.x-2, music.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", music.x, music.y, unselected.w, unselected.h)
end
if selection == 5 then
selection_text = "Video"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", video.x-2, video.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", video.x, video.y, unselected.w, unselected.h)
end
if selection == 6 then
selection_text = "Game"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", game.x-2, game.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", game.x, game.y, unselected.w, unselected.h)
end
if selection == 7 then
selection_text = "Network"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", network.x-2, network.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", network.x, network.y, unselected.w, unselected.h)
end
if selection == 8 then
selection_text = "Friends"
love.graphics.setColor(255,0,0)
love.graphics.rectangle("fill", friends.x-2, friends.y-2, selected.w, selected.h)
else
love.graphics.setColor(255,255,255)
love.graphics.rectangle("fill", friends.x, friends.y, unselected.w, unselected.h)
end
if string.len(selection_text) == 4 then spacing = 4
elseif string.len(selection_text) == 5 then spacing = 3
elseif string.len(selection_text) == 7 then spacing = 9
elseif string.len(selection_text) == 8 then spacing = 9
end
love.graphics.setColor(255,255,255)
love.graphics.print(selection_text, 70-spacing, 90)
love.graphics.print("CrossFire 0.1.1", 295, 225)
end
function love.keypressed(key)
if key == 'dleft' and selection <= 7 then
users.x = users.x - 70
settings.x = settings.x - 70
photo.x = photo.x - 70
music.x = music.x - 70
video.x = video.x - 70
game.x = game.x - 70
network.x = network.x - 70
friends.x = friends.x - 70
selection = selection + 1
end
if key == 'dright' and selection >= 2 then
users.x = users.x + 70
settings.x = settings.x + 70
photo.x = photo.x + 70
music.x = music.x + 70
video.x = video.x + 70
game.x = game.x + 70
network.x = network.x + 70
friends.x = friends.x + 70
selection = selection - 1
end
end