Custom Sprites [v1.5]
Re: Custom Sprites [v1.5]
I'm actually surprized that so few people commented on this one, and i just wanted to say a big thanks to you Lux for making our lives easier dealing and managing all these putpixel commands
Re: Custom Sprites [v1.5]
Hi alex,
Luxs program is great. However later you will find you can load pngs straight from the GDI which is easier.
I know use directx sprites which are even easier to use. Working on a small game now, but still have to finish my model before I can carry on with it heh heh.
Luxs program is great. However later you will find you can load pngs straight from the GDI which is easier.
I know use directx sprites which are even easier to use. Working on a small game now, but still have to finish my model before I can carry on with it heh heh.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Custom Sprites [v1.5]
Thank you so so much for making this! I was going crazy thinking about the sprites I would have to manually make, Thanks a lot ^-^
Re: Custom Sprites [v1.5]
Hi guys,
did I miss something ? I can download the EXE / rar file of this code at the beginning of this thread, but I do not find the VB code itself, despite the fact that some of you are talking about this code...
did I miss something ? I can download the EXE / rar file of this code at the beginning of this thread, but I do not find the VB code itself, despite the fact that some of you are talking about this code...
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Custom Sprites [v1.5]
Sorry to say, but LuX hasn't been active in these forums for three years now. I don't think he ever posted the full source code, but on page two or three he posted a snippet of the code. If you are specifically looking for VB code then I'm not sure what to say, but chili does have a sprite conversion to the mass putpixel calls written in C++ called fukbmp. His source code is downloadable from that thread.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
- krautersuppe
- Posts: 91
- Joined: September 14th, 2015, 10:58 pm
- Location: Istanbul
Re: Custom Sprites [v1.5]
While at it, did LuX ever release his"Purity" somewhere?
DSU
Discord: dsu1, GitHub: https://github.com/DSpUz
Discord: dsu1, GitHub: https://github.com/DSpUz
Re: Custom Sprites [v1.5]
Here is a simple single-file program that will convert images to putpixel code. It should be easy enough to modify to suit various purposes.
Code: Select all
#define NOMINMAX
#include <windows.h>
#include <algorithm>
namespace Gdiplus
{
using std::min;
using std::max;
}
#include <gdiplus.h>
#include <fstream>
#include <string>
#include <experimental\filesystem>
#pragma comment(lib,"gdiplus.lib")
namespace fs = std::experimental::filesystem::v1;
namespace gdi = Gdiplus;
const std::string in_path = "images";
const std::string out_path = "code";
const std::string out_ext = ".txt";
const gdi::Color alphakey( 192,192,192 );
int main()
{
gdi::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
gdi::GdiplusStartup( &gdiplusToken,&gdiplusStartupInput,nullptr );
for( const auto& e : fs::directory_iterator( in_path ) )
{
if( e.status().type() == fs::_File_type::regular )
{
const fs::path p = e;
if( p.extension() == ".png" )
{
std::ofstream out_file( out_path + "\\" + p.stem().generic_string() + out_ext );
gdi::Bitmap bitmap( p.c_str() );
for( size_t y = 0; y < bitmap.GetHeight(); y++ )
{
for( size_t x = 0; x < bitmap.GetWidth(); x++ )
{
gdi::Color pixel;
bitmap.GetPixel( x,y,&pixel );
if( pixel.GetValue() != alphakey.GetValue() )
{
out_file << "\tgfx.PutPixel( " << x << " + x," << y << " + y,"
<< int( pixel.GetR() ) << ","
<< int( pixel.GetG() ) << ","
<< int( pixel.GetB() ) << " );\n";
}
}
}
}
}
}
gdi::GdiplusShutdown( gdiplusToken );
return 0;
}
Chili