(XMB Re-creation) CrossFire 0.0.1

Discussion in '3DS - Homebrew Development and Emulators' started by JonnyQuest, Nov 7, 2016.

  1. JonnyQuest
    OP

    JonnyQuest Newbie

    Newcomer
    2
    18
    Nov 6, 2016
    United States
    [​IMG]

    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
    
     
    Gungerino, Kyouken and Joom like this.
  2. Posghetti

    Posghetti Greninja Master

    Member
    1,049
    348
    Mar 15, 2016
    United States
    Michigan
    Looks cool! Good luck with this!
     
  3. Joom

    Joom  ❤❤❤

    Member
    3,890
    2,618
    Jan 8, 2016
    United States
    This would be neat for that home menu replacement project that's going on. The XMB is nostalgic.
     
    Last edited by Joom, Nov 7, 2016
  4. swabbo

    swabbo Wot u doin readin dis m8?

    Member
    531
    185
    Mar 9, 2011
    East Yorkshire/ A Bin
    Pardon my ignorance, but what is XMB? Too tired to Google it ;)
     
  5. Posghetti

    Posghetti Greninja Master

    Member
    1,049
    348
    Mar 15, 2016
    United States
    Michigan
    XMB is basically a cross menu. Take the PS3 for example, it uses a XMB Interface.
     
    swabbo likes this.
  6. Exaltys

    Exaltys GBAtemp Fan

    Member
    335
    77
    Nov 10, 2009
    United States
    Cross Media Bar. It was the interface for the PSP, PS3, and many Sony Blu-Ray players.
     
  7. LiveLatios

    LiveLatios Profesionnal Scalie

    Member
    1,079
    513
    Nov 16, 2015
    Canada
    why
    and the japanese PSX, which is a ps2 dvr thing
     
  8. Gow supremo

    Gow supremo I am playing my 2ds

    Member
    240
    12
    Jan 24, 2016
    Spain
    In the earth
    Very cool