Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

TrueColor library for AngelScript

Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

Mar 13, 2016, 11:33 PM
Violet CLM is offline
Reply With Quote
TrueColor library for AngelScript


Download

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 jjPIXELMAP, jjANIMFRAME, and jjDraw* 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 .bmp files instead of custom .j2a files.

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

To use, write
Code:
#include "TrueColor.asc"
in your script file and then use some portion of the API, which is all described in the opening comment of truecolor.asc. Alternatively, look through beach2.j2as 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

JCF Member

Joined: Aug 2006

Posts: 853

PurpleJazz is OFF DA CHARTPurpleJazz is OFF DA CHARTPurpleJazz is OFF DA CHART

Mar 15, 2016, 03:32 AM
PurpleJazz is offline
Reply With Quote
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

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

Feb 19, 2017, 04:13 PM
Violet CLM is offline
Reply With Quote
TrueColor v1.1 is out.
  • TrueColor images are drawn at 50% opacity if jjANIMFRAMES::transparent is true for the first animframe in an image. (New property bool TrueColor::Coordinates::transparent is added for setting this.)
  • New function TrueColor::EnableCaching 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 TrueColor::Bitmap, including one from jjSTREAM, plus a swizzle method to save time.
  • If the filename passed to the TrueColor::Bitmap string constructor already ends in ".bmp" (case insensitive) then ".bmp" will not be added to it.
  • Fixed bug of TrueColor::Coordinates' hotspot/coldspot/gunspot properties not being applied by TrueColor::Bitmap::saveToAnimFrames, only by TrueColor::AllocateSpriteSheet.
  • The width and height properties of TrueColor::Bitmap 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

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

Feb 8, 2018, 06:15 PM
Violet CLM is offline
Reply With Quote
TrueColor has been uploaded to J2O after holding off on it for two years. It's now version 1.2 and fixes a major bug from previous versions impacting color gradation, plus it supports swinging vines.
__________________
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

May 3, 2019, 06:12 PM
Violet CLM is offline
Reply With Quote
TrueColor v1.3 is out. 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.

Here's another example showing some crabs with antialiasing.
__________________

Last edited by Violet CLM; May 3, 2019 at 07:17 PM.
DennisKainz

JCF Member

Joined: Dec 2005

Posts: 422

DennisKainz is notorious for his worthless posts

May 30, 2019, 09:58 AM
DennisKainz is offline
Reply With Quote
This... Is... AWESOME!!!
Could this feature be theoretically used to create 16bit color "tilesets" by using sprites as tiles? That would be REALLY awesome!
__________________
Free will was a mistake.
- God
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,047

Violet CLM has disabled reputation

May 30, 2019, 09:01 PM
Violet CLM is offline
Reply With Quote
Yeah sure. FPS could be an issue, but sure you could draw sprites and pretend they were tiles if you wanted to.
__________________
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 03:30 PM.