Hi good afternoon.
how do you make a sprite transparent in cpctelrea?
the color problem is almost solved.
greeting
If you're working in Mode 1, you only need four colors instead of 16. The palette used for conversion is defined in cfg/image_conversion.mk, have a look at that file and correct the palette definition. Then call
cpct_setPalette (my_palette, 4);
cpct_setVideoMode(1);
That should do the trick.
Cheers
hello thanks.
the color problem is a bit solved.
now i would like to make the sprite transparent.
thank you.
greeting
Nice to hear that.
For transparency, you have two options with CPCtelera:
- In the image conversion process, add a per-pixel mask (https://lronaldo.github.io/cpctelera/files/sprites/cpct_drawSpriteMasked-asm.html) to your sprites (see also image_conversion.mk to set the parameters accordingly).
- Create a 256 byte transparency lookup table (https://lronaldo.github.io/cpctelera/files/sprites/transparency_table_macros-h.html#cpctm_createTransparentMaskTable) and use one of your colors as transparency/mask. Then draw your sprites using cpct_drawSpriteMaskedAlignedTable. (https://lronaldo.github.io/cpctelera/files/sprites/cpct_drawSpriteMaskedAlignedTable-asm.html)
If you have more questions like that, the examples of CPCtelera are a gold mine to look at and understand how things are done.
Hope that helps,
Cheers
thanks for the information.
I don't understand the videos from the language.
the demos that are part of cpctelera are too big, go totally into the big which you can not follow.
greeting
You mean the CPCtelera videos by Prof. Ronaldo that are mostly in spanish? You can turn on Subitles > "Automatic translation" > "English" (oder Deutsch :) ), it's not perfect but pretty good. Just reading the code on the screen helps as well.
No, the demos/examples are actually quite small and easy to follow IMO, they're split into easy, medium, advanced etc. just for that reason. Fitting to this topic, there's a specific example for masked sprites: https://github.com/lronaldo/cpctelera/tree/master/examples/medium/maskedSprites (https://github.com/lronaldo/cpctelera/tree/master/examples/medium/maskedSprites). In the other examples you'll probably find additional uses of masked sprites. Just try playing around with the examples, change a thing here and there and see what happens. I think it helps immensely.
Cheers
hello thanks for the info for cpctelera.
greeting