1. Momoro

    OP Momoro The Dark One
    Member

    Joined:
    Oct 7, 2019
    Messages:
    111
    Country:
    United States
    I've been dabbling in making mini 3DS C++ video games / homebrew apps, and it's been a blast. (For some reason, Switch just isn't as fun for me.)

    But, I've been having some trouble with displaying images.

    I would like to display my logo image on the upper / top screen, but I have no idea how to do this in C++ for 3DS.

    Any help? Thanks!
     
  2. dwain12435

    dwain12435 GBAtemp Regular
    Member

    Joined:
    Aug 20, 2020
    Messages:
    251
    Country:
    United States
    When you figure out you photo issue, perhaps you could make a homebrew to convert BMP files to JPEG files? Also a homebrew to compress folders to ZIP? Would be very nice.
     
    3DScool likes this.
  3. sup3rgh0st

    sup3rgh0st Top Tier Ghost
    Member

    Joined:
    Apr 22, 2010
    Messages:
    420
    Country:
    United States
    You probably want to use a library like SDL to handle that pretty easily. However if you're committed to rolling your own code, another route is to have your images in saved as some kind of uncompressed bitmap (.bmp) file format and just copy the color values into the frame buffer.

    This code is like 5 years old now so things may have changed, but you can grab the top and bottom frame buffers and write to them as you wish.
    Code:
    u8* fbTop = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
    u8* fbBottom = gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL);
    
    paint_pixel(fbTop, 10, 10, 255, 255, 255);
    
    Code:
    // FrameBuffer, XPos, YPos, R,G,B
    void paint_pixel(u8* fb, u16 x, u16 y, u8 red, u8 green, u8 blue) {
    	if ((x>=400) || (x<0)) {return;}
    	if ((y>=240) || (y<0)) {return;}
    	
    	fb[3*(y+x*240)] = blue;
    	fb[3*(y+x*240)+1] = green;
    	fb[3*(y+x*240)+2] = red;
    }
    
     
    Last edited by sup3rgh0st, Oct 31, 2020 - Reason: Code Snippit
    Momoro, Scott_pilgrim and IC_ like this.
  4. Momoro

    OP Momoro The Dark One
    Member

    Joined:
    Oct 7, 2019
    Messages:
    111
    Country:
    United States
    Hmm! Thanks :)

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

    Unless you need it for 3ds homebrew, just find an online converter, e.g. "bmp to jpeg online"
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - display, quality, screen