Image File to gfx.PutPixel Statements Tool
Posted: August 20th, 2016, 1:24 pm
Are you following Chili's Beginner C++ Game Programming Reboot?
Are you interested in drawing sprites from image files using lots and lots gfx.PutPixel functions?
Are you not bothered to painstakingly write out hundreds of these statements with autistic pixel precision to incorporate fancy sprites in you game?
If you answered 'Yes' to any of these questions, look no further!
I wrote a Python application with a user-friendly GUI that allows you to navigate to your image of choice and convert the pixel information into what I've coined as "ChiliCode". From there, you can copy and paste the code directly into your solution.
You will find attached the .zip file containing this program. Note that transparency is supported through the rgb colour (255, 0, 255). So any background you don't want the game to draw should be that colour.
If it doesn't work, or you experience bugs, please leave a reply and I'll try to fix it. If anyone's interested in the source, let me know and I'll include that as soon as I clean it up.
Cheers, Salty Tristan.
PS, the .exe is named image2chilicode.exe and you will find a test image to try out the program in the same directory as the .exe called test_image_with_transparency.png.
EDIT: FUCK I just realised this has been done before by LuX. Well I'm just gonna go cry now. :'(
Are you interested in drawing sprites from image files using lots and lots gfx.PutPixel functions?
Are you not bothered to painstakingly write out hundreds of these statements with autistic pixel precision to incorporate fancy sprites in you game?
If you answered 'Yes' to any of these questions, look no further!
I wrote a Python application with a user-friendly GUI that allows you to navigate to your image of choice and convert the pixel information into what I've coined as "ChiliCode". From there, you can copy and paste the code directly into your solution.
You will find attached the .zip file containing this program. Note that transparency is supported through the rgb colour (255, 0, 255). So any background you don't want the game to draw should be that colour.
If it doesn't work, or you experience bugs, please leave a reply and I'll try to fix it. If anyone's interested in the source, let me know and I'll include that as soon as I clean it up.
Cheers, Salty Tristan.
PS, the .exe is named image2chilicode.exe and you will find a test image to try out the program in the same directory as the .exe called test_image_with_transparency.png.
EDIT: FUCK I just realised this has been done before by LuX. Well I'm just gonna go cry now. :'(