LPP Breaks When I Try to Show an Image

Discussion in '3DS - Homebrew Development and Emulators' started by legofan623, Oct 7, 2015.

  1. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    I'm not really sure what's up with this. Do the .png files need to be in some special format, or am I just doing this wrong?

    EDIT: "/assets/question.png" is supposed to be "/question.png" in index.lua.
     

    Attached Files:

    • test.zip
      File size:
      726.6 KB
      Views:
      54
    Last edited by legofan623, Oct 7, 2015


  2. VinsCool

    VinsCool Insecure

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,494
    26,859
    Jan 7, 2014
    Canada
    Another World
    try "question.png" only
     
  3. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Oops, meant to change that. It should already be "/question.png". Still wont run, just a black screen.
     
  4. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Bump, if I can fix this I can help put an end to GBATemp cancer, I swear!
     
  5. keanutah

    keanutah GBAtemp Regular

    Member
    173
    130
    Sep 18, 2015
    United States
    Try doing something like "System.currentDirectory()../assets/question.png"
     
  6. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    That gets me "Error: [string "?"]:2: wrong number of arguments"
     
  7. Megalegacy98

    Megalegacy98 ( ͡° ͜ʖ ͡°)™

    Member
    505
    259
    Aug 11, 2015
    United States
    Just around the corner™
    question = Screen.loadImage(System.currentDirectory() .. "/assets/question.png")
     
  8. keanutah

    keanutah GBAtemp Regular

    Member
    173
    130
    Sep 18, 2015
    United States
    What he said. That's what I meant.
     
  9. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Nope, still black screen. My text isn't even showing up.
     
  10. Megalegacy98

    Megalegacy98 ( ͡° ͜ʖ ͡°)™

    Member
    505
    259
    Aug 11, 2015
    United States
    Just around the corner™
    Maybe position it like this?
    Code:
    question = Screen.loadImage("/assets/question.png")
    while true do
       Screen.waitVblankStart()
       Screen.refresh()
       Screen.drawImage(400,240,question,TOP_SCREEN)
       Screen.debugPrint(0,0,"Press B to exit",Color.new(255,255,255),BOTTOM_SCREEN)
       Screen.flip()
    
     
  11. keanutah

    keanutah GBAtemp Regular

    Member
    173
    130
    Sep 18, 2015
    United States
    You have a few different problems in your code. I didn't run this since I'm not on the right computer but give this a shot :)

    Code:
    question = Screen.loadImage(System.currentDirectory().."/assets/question.png")
    
    while true do
      Screen.waitVblankStart()
      Screen.refresh()
    
       Screen.drawImage(0,0,question,TOP_SCREEN) -- you want the coordinates to the start x position and the start y position. 0,0 would be the top left corner of the screen
       Screen.debugPrint(0,0,"Press B to exit",Color.new(255,255,255),BOTTOM_SCREEN)
    
      if Controls.check(Controls.read(),KEY_B) then
      System.exit()
      end
    
       Screen.flip()
    end
    
     
    Last edited by keanutah, Oct 7, 2015
  12. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Nope and nope... If someone wants to just make a code from scratch that does nothing but display a png I can go off of that.
     
  13. keanutah

    keanutah GBAtemp Regular

    Member
    173
    130
    Sep 18, 2015
    United States
    Have you tried using any of the example lua files that are provided with the download?
     
  14. 730

    730 Professional Shitposter

    Member
    465
    376
    Apr 2, 2015
    Argentina
    Code:
    img = Screen.loadImage(imageLocation)
    while true do
        Screen.waitVblankStart()
        Screen.refresh()
        Screen.clear(TOP_SCREEN)
        --Screen.clear(BOTTOM_SCREEN) <-- if necessary
        Screen.drawImage(0, 0, img, TOP_SCREEN)
        Screen.flip()
    end
    edit: ehh shit clean() is actually clear()
     
    Last edited by 730, Oct 7, 2015
  15. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Yeah but the image one doesn't include "file.bmp"

    — Posts automatically merged - Please don't double post! —

    Nope... this is driving me crazy!
     
  16. 730

    730 Professional Shitposter

    Member
    465
    376
    Apr 2, 2015
    Argentina
    You are clearly doing something very wrong, most likely your image placement.
     
  17. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    Can you make a .zip file of everything EXACTLY coded and placed correctly?
     
  18. keanutah

    keanutah GBAtemp Regular

    Member
    173
    130
    Sep 18, 2015
    United States
    So all I did was take the code I placed above and move your question.png into an /assets folder. Works fine in Citra.
     

    Attached Files:

    • test.zip
      File size:
      698.6 KB
      Views:
      42
  19. 730

    730 Professional Shitposter

    Member
    465
    376
    Apr 2, 2015
    Argentina
    Not at home right now. All you should know is that when loading the image, "/img.png" would try to load img.png from the root. System.currentDirectory() returns the directory where the 3dsx is located, therefore System.currentDirectory() .. "/img.png" ends up loading "3ds/<homebrew>/img.png".
    Also is your script named "index.lua" and placed next to the lpp 3dsx?
     
  20. legofan623
    OP

    legofan623 GBAtemp Fan

    Member
    418
    196
    Oct 3, 2011
    United States
    Puyallup, WA
    This works perfectly. I know the picture was misplaced in the code, the .zip was missing the assets folder, but the one I was testing was ordered just like this... Oh well, thanks for getting it to work!