Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Hi, I am making this forum for a question and future questions about toolchain.

My question is how do you use gfx_TransparentSprite()?

I am using a picture of a turtle.

But, when I use this sourcecode,

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

/* Standard headers - it's recommended to leave them included */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Shared libraries */
#include <graphx.h>
#include <fileioc.h>
#include <keypadc.h>
#include "gfx/logo_gfx.h"

void main(void){





I get a weird output of the sprite.

Does anyone know what is going on?
Remember to set your palette.
If you didn't quite understand the above post, the picture above doesn't display correctly because the palette that convpng created is different than the default one (xlibc?) your calculator uses. You see, the ti84+CE can use 16,777,216 different colors, thats a lot of colors... but you can only have a PALETTE of 256 colors (at a time). When you stick your sprites through convpng, convpng makes its own palette, choosing 256 of the 16,777,216 available different colors to maintain as much of the original color as possible.

convpng was able to build the sprite ball_bullet using 100% of the original .png's colors (but that's because I made it by hand... using one color Razz ). More sprites (and thus, colors) = less accuracy. Fortunately, 256 colors is hardly insufficient, and using too many colors should never be an issue.

So with that background, how DO you set up the palette anyway? Well fortunately, convpng already #define's some helpful shortcuts for you, namely _pal and sizeof_ _pal. The numeric values are defined in the header file. How do you use these? Well, if you look at your first line in your convpng.ini file, you named your output file:

#GroupC            : sprites

In my case, I named it "sprites" so... to use the palette convpng is using all you do is:

gfx_SetPalette(sprites_pal,sizeof_sprites_pal, 0);

...And your done!!!

If your curious to see what exactly the palette convpng is using to build your sprites, you can find it in the [name of your #GroupC output file].c (in my case: sprites.c). Also the #define's are, well, defined in the [name of your #GroupC output file].h file. Hoped this helped!
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum