Hello, I am a self-taught beginner, and I have learned to do some simple programs in c++. I have looked all over the internet and nowhere can I find tutorials for putting images into c++. All of the things I see assume that the person already has half of the knowledge on it. Could you guys please maybe point me in the right direction, like giving me a link, or tell me how to do it? I truly do appreciate it. I want to get better lols. Thanks in advance guys.
What is it that you want to do exactly? You want to load an image into the console window? You can not do this...you will need to write a routine that gets the pixel value and set all the console text locations to the corresponding values.
Use these libraries and learn their functions.
Note: You'll have to know how to manage individual pixels and their format (a,r,g,b), because this library assumes you want full control of your image.
I also suggest you do some research about a bitmap format and how to make a bitmap before using this, because a png is ultimately a z-compressed bitmap with different headers and an (optional) alpha channel.
@MW130
The best answer depends on the kind of things you are trying to do. Are you trying to write a side-scroller game? Or a 3D one? Do you just want to have a window with some pictures in it? Do you want to write a normal application with pretty graphics? A sudoku solver? A spreadsheet? An image editor?
Tell us what you want to do and we can give some specific advice.
sorry guys I will delete the threads I was just tearing up. I have finally figured out and made sdl work. I do not know bitmaps and all I want to know atm is how to put an image in to my program. I just want to put in a 2d image and really apreciate all threads.
I put frameworks.sdl into my library/frameworks folder as was told, and yet when i do #include <sdl.h> in xcode, it says sdl file not found. When I go into link binaries with libraries, I dont see sdl.h to add as a framework, so i drag it. This still doesn't help, the error still shows saying that sdl.h file not found.I have done endless google browsing. Please help me guys. I am really frustrated. I am using c++ if it matters
I already gave you all the tools you need to know to make a png image. As in, writing to a file in C++ that you use with programs as a valid image format. Maybe you should look into that?
It's as simple as creating an array of bytes, initializing the structures, and then passing the array and the structure(s) to actually write the file. The library abstracts away the tediousness of writing the headers. So All you have to do is specify the image size, channels, RGB value for each pngbyte.
Do you want an example?