Say I want to include a .bmp file in my exe to be displayed on screen. How does the bmp file get linked to my code? A simple #include "bmpfile"? If that's the case, how do I know where the bmp file is in memory?
Say I want to include a .bmp file in my exe to be displayed on screen. How does the bmp file get linked to my code? A simple #include "bmpfile"? If that's the case, how do I know where the bmp file is in memory?
starting off with basics, do you know how to load a bitmap from an external file and display it on screen? if not, begin with that
hello, internet!
A good, but non portable way of doing this might be to use an assembler such as NASM to do this.
for instance, you can do this:
And a C header file to go with it:Code:[section .data] global _animage _animage: %incbin "image.bmp"
Produce an object for the assembly file.Code:#ifndef IMAGE_H #define IMAGE_H extern char *animage; #endif
You can use the pointer animage to access the bitmap, just know the filesize before you use it (maybe the bitmap will tell you this?)
When you link up all the objects, including the object from the assembly code, your program should work fine.
.sect signature