How to display images in a C program

lucascoder777

New Member
Newbie
Joined
Mar 16, 2022
Messages
3
Reaction score
1
Trophies
0
Age
25
Location
bruh
XP
52
Country
Philippines
I'm currently working on a program but I need help. How do you display images in the program?
The language I'm working on is C. Anyone know how? I'm actually a noob in coding on C so yeah.
 
devkitPro provides an example, assuming that's what you're using:
https://github.com/devkitPro/3ds-examples/tree/master/graphics/bitmap/24bit-color
It's very basic though, if you wanted to display images as in common image file formats like BMP, JPEG, PNG, you would also have to integrate the right libraries for reading those formats and interface with them in your code to draw the images on the 3DS screen.
 
devkitPro provides an example, assuming that's what you're using:

It's very basic though, if you wanted to display images as in common image file formats like BMP, JPEG, PNG, you would also have to integrate the right libraries for reading those formats and interface with them in your code to draw the images on the 3DS screen.
i wanted to display a png image. what library will i use
 
i wanted to display a png image. what library will i use
The easiest library I know of for PNG is lodepng. It works in C and C++ and you just need one c/cpp file and one header.

Actually displaying a PNG using Citro2D is a bit trickier though since you can't just give it raw bitmap data. The best thing to do is to do as the example does and convert the images at compile time, it's faster and easier, but if you need to load PNGs at runtime this code from Universal-Updater should work, it's what UU uses to convert screenshots from PNG to what Citro2D wants. (first function is for files, second is for if the PNG is already loaded in RAM)
 

Site & Scene News

Popular threads in this forum