PDA

View Full Version : TrueColor library for AngelScript


Violet CLM
Mar 13, 2016, 10:33 PM
<img src="http://shemitz.net/static/files/misc/TrueColorHeader.png" />
<a href="http://shemitz.net/static/files/misc/TrueColor.zip" style="font-size: 2em">Download</a>

I wrote a library that lets you draw sprites using colors that aren't present in the level palette, runnable in the currently released version of JJ2+. It basically recreates much of the <code>jjPIXELMAP</code>, <code>jjANIMFRAME</code>, and <code>jjDraw*</code> code but with a special trick to get around the palette limitations. Even if you don't care about colors, if you're really not a python user, you might like that it reads graphics from <code>.bmp</code> files instead of custom <code>.j2a</code> files.

A sample script, <code>beach2.j2as</code>, is provided that makes the Fish enemies use the piranha sprites from Spelunky HD.

To use, write
#include "TrueColor.asc"
in your script file and then use some portion of the API, which is all described in the opening comment of <code>truecolor.asc</code>. Alternatively, look through <code>beach2.j2as</code> and copy+paste mercilessly until you've got everything working.

Further updates may or may not occur, but I didn't feel this was ready for a J2O upload just yet.

PurpleJazz
Mar 15, 2016, 02:32 AM
Massive props! Indeed, the fact that bitmap images can be used as opposed to .j2a files is a huge convenience even if you are already able to use python. I feel like experimenting with this - I'm sure there's some awesome possibilities here and there.

Violet CLM
Feb 19, 2017, 03:13 PM
TrueColor v1.1 is out. (http://shemitz.net/static/files/misc/TrueColor.zip)


TrueColor images are drawn at 50% opacity if <code>jjANIMFRAMES::transparent</code> is true for the first animframe in an image. (New property <code>bool TrueColor::Coordinates::transparent</code> is added for setting this.)
New function <code>TrueColor::EnableCaching</code> automates the process of regenerating all the animframes every time the palette is changed. (beach2.j2as has been updated to show how much easier this is than doing it by hand.)
Two new constructors for <code>TrueColor::Bitmap</code>, including one from <code>jjSTREAM</code>, plus a <code>swizzle</code> method to save time.
If the filename passed to the <code>TrueColor::Bitmap</code> string constructor <em>already</em> ends in ".bmp" (case insensitive) then ".bmp" will not be added to it.
Fixed bug of <code>TrueColor::Coordinates</code>' hotspot/coldspot/gunspot properties not being applied by <code>TrueColor::Bitmap::saveToAnimFrames</code>, only by <code>TrueColor::AllocateSpriteSheet</code>.
The <code>width</code> and <code>height</code> properties of <code>TrueColor::Bitmap</code> are now read-only, which is technically not backwards compatible but those were not properties you had any business editing so hopefully that won't be a problem.

Violet CLM
Feb 8, 2018, 05:15 PM
<a href="https://www.jazz2online.com/downloads/7810/truecolor-and-resize/">TrueColor has been uploaded to J2O</a> after holding off on it for two years. It's now version 1.2 and <a href="https://cdn.discordapp.com/attachments/171304641970044928/411302162493341696/unknown.png">fixes a major bug</a> from previous versions impacting color gradation, plus it supports swinging vines.

Violet CLM
May 3, 2019, 05:12 PM
<a href="https://www.jazz2online.com/downloads/7810/truecolor-and-resize/">TrueColor v1.3 is out</a>. You can now open and manipulate PNG files, giving you full control over the alpha channel: every pixel in a sprite may have any red, green, blue, and alpha value, independent from every other pixel.

<a href="https://shemitz.net/static/files/misc/ShantaeCrab.zip"><img src="https://i.imgur.com/3HRTLvF.png" /> Here's another example</a> showing some crabs with antialiasing.

DennisKainz
May 30, 2019, 08:58 AM
This... Is... AWESOME!!!
Could this feature be theoretically used to create 16bit color "tilesets" by using sprites as tiles? That would be REALLY awesome!

Violet CLM
May 30, 2019, 08:01 PM
Yeah sure. FPS could be an issue, but sure you could draw sprites and pretend they were tiles if you wanted to.