Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » extrude tool

This thread is locked; no one can reply to it. rss feed Print
extrude tool
Arvidsson
Member #4,603
May 2004
avatar

Hello!

I have created a small tool for extruding tiles in a tileset (i.e. extending the outermost pixel layer in each tile and then putting these extended tiles back together into a tileset) in order to render stuff pixel perfect in for example Unity. I couldn't find a similar tool that either didn't work correctly with alpha nor costed a lot of money, so I made it on me own in Allegro and it was a fun little project. Hopefully someone might have use for it :)

Rodolfo Lam
Member #16,045
August 2015

It might be useful some day, thanks!

BTW, your code is just the example I needed of how to wrap ALLEGRO_BITMAP on a shared pointer, thanks as well for that!

Arvidsson
Member #4,603
May 2004
avatar

Then it wasn't in vain :)

Here's a tip how to wrap in unique_ptr if you ever have a need:

template<typename T> using deleted_unique_ptr = std::unique_ptr<T, std::function<void(T*)>>;

deleted_unique_ptr<ALLEGRO_BITMAP> bitmap(al_create_bitmap(w, h), [](ALLEGRO_BITMAP* b) { al_destroy_bitmap(b); });

Rodolfo Lam
Member #16,045
August 2015

That's actually a brilliant solution. Maybe I was not understanding how Smart pointers really worked on C++ but this kinda just made it clear.

Go to: