News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

cpctelera :maskedSprites

Started by funkheld, 09:18, 20 December 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld


Hi good afternoon.


I want to create maskedSprites with cpctelera 1.
the example at cpctelera is set too high.


who knows a simple example with the maskedSprites?
or who has ever started doing something like this and then jumped off because it didn't work out?


thanks.
gruaa

SRS

This cpctelera really seems to be a useless thing, that doesn't know what the programmer really wants and makes it automatically ?

And why there are no examples for everyone, that do not need any reading and understanding at all ?
Bad tool !

We could all be great programmers without it.

It does not even support a mouse or even blockchain, c'mon !
I'll stick to brainf*ck with OpenGDL, best tool ever for CPC.





:picard:


funkheld


the cpctelera is not that bad.


some demos of it are set too high, especially when it comes to graphic specialties (masksprite). too much has been taken into the masksprite demo, which does not belong in there and makes it difficult for you.


and you can program the mouse yourself in asm.


greeting

zhulien

your sprites need to wear masks too now?

funkheld

since the new corona plague came to us from england from today: yes      8)

freemac

#5
Quote from: funkheld on 09:18, 20 December 20
I want to create maskedSprites with cpctelera 1.
the example at cpctelera is set too high.
who knows a simple example with the maskedSprites?
or who has ever started doing something like this and then jumped off because it didn't work out? thanks.
gruaa
command lines :
cpct_img2tileset  (without parameter to get help)
cpct_img2tileset -pf {26 1 2 0 11 6} -im -m 0 -nt -tw 32 -th 32 -oph schtroumpf32x32.png

u8* p;
cpct_setPalette(g_tile_palette, 6);
p = cpct_getScreenPtr(CPCT_VMEM_START, 10-1,80-1);
cpct_drawSpriteMasked(g_tile_schtroumpf, p, G_TILE_SCHTROUMPF_W, G_TILE_SCHTROUMPF_H);

funkheld

#6
hello, thanks for the help.
is ok.  :)


greeting.


funkheld


Hi good afternoon.


with which program was your mask sprite png created?


thanks.
greeting

freemac

Quote from: funkheld on 14:28, 22 December 20
Hi good afternoon.


with which program was your mask sprite png created?


thanks.
greeting

It's fully created using cpct_img2tileset command, '-im' using index 0 of given palette.

cpct_img2tileset
  -im  | --interlaced-masks
       Generates transparent sprites with interlaced masks using 0 as the default colour index of the palette to be considered transparent.
  -t   | --transparent-index <colour_index>
       Changes the colour index to be considered transparent and is used to generate masks

funkheld



Hi, Thank You.


with which drawing program was the png created?
what must be considered when creating it?


greeting

freemac

Quote from: funkheld on 17:15, 22 December 20
Hi, Thank You.
with which drawing program was the png created?
what must be considered when creating it?
greeting
Here I used Gimp... I add black spot after resizing it into small picture.
I use a RubikCube for palette https://github.com/renaudhelias/RubikCubePaletteCPC , but here my current project is just "giving a try CPCtelera".

Normaly we use ConvImgCpc that exports picture into asm (or .scr). But with CPCtelera they use cpct_img2tileset line command.

Sometime I use mspaint 16bit bmp that I resave in bmp for input of ConvImgCpc. That approach 27 colors of CPC sometime better than ConvImgCpc alone.

funkheld



I am now using paint.net.
also works wonderfully.


greeting


funkheld


Hi good afternoon.


I made a mask sprite 32x32 sprite.png with four colors in mode 0.
how do you write the palette so that the four colors appear in the sprite. the colors are from the cpc's color collection.


cpct_img2tileset -pf {..............} -im -m 0 -nt -tw 32 -th 32 -oph sprite.png ???


color from sprite :

$ff0000
$00ff00
$ff00ff
$ffff00


thanks.
greeting

gurneyh

http://www.cpcwiki.eu/index.php/Gate_Array


firmware palette at bottom of the page
{6, 8, 18, 24}

?



freemac

#14
Quote from: gurneyh on 20:20, 23 December 20http://www.cpcwiki.eu/index.php/Gate_Array firmware palette at bottom of the page {6, 8, 18, 24} ?

All right. After in code generated it is g_tile_palette with firmware colors (4Bh ...)

cpct_setVideoMode(0);
cpct_setBorder(HW_BLACK);
cpct_setPalette(g_tile_palette, 4); // 4 is length of g_tile_palette array

funkheld


hello freemac.


how do you come up with these 6 colors for the graphic schtroumpf32x32.png: -pf {26 1 2 0 11 6}?
why only 6 colors?


when I make a sprite for mode 0, when a screen image overlaps with the sprite, mixed colors occur when touched. the mixed colors shouldn't be created.


what do you have to consider with the colors on the screen and with the sprite so that there are no mixed colors when they overlap?


thanks.
greeting

freemac

#16
Quote from: funkheld on 13:14, 09 January 21
hello freemac.

how do you come up with these 6 colors for the graphic schtroumpf32x32.png: -pf {26 1 2 0 11 6}?
why only 6 colors?
In mode 0 you have 16 color (16 pens)
* Mode 0: 160×200 pixels with 16 colors (4 bpp)
* Mode 1: 320×200 pixels with 4 colors (2 bpp)
* Mode 2: 640×200 pixels with 2 colors (1 bpp)

Quote from: funkheld on 13:14, 09 January 21
when I make a sprite for mode 0, when a screen image overlaps with the sprite, mixed colors occur when touched. the mixed colors shouldn't be created.

what do you have to consider with the colors on the screen and with the sprite so that there are no mixed colors when they overlap?
You can use cpct_drawSpriteMasked() that run with a sprite generated by command cpct_img2tileset -im

else if you use cpct_drawSpriteBlended() with CPCT_BLEND_OR you can hack the palette manually, some inks being the same on the 16 color palette given.

Think around byte : 2^4=16, so a byte in mode 0 contains 2 pixels.
0xF0
0x11110000

offset :
0 <=> 0000 red
1 <=> 0001 green
2 <=> 0010 blue
4 <=> 0100 yellow
8 <=> 1000 pink
3 <=> 0011 green+blue = ? grey ?
5 <=> 0101 yellow+green = ? grey ?
0111 : yellow+blue+green = ? grey ?

funkheld

hello thanks.



I find these things difficult to recognize with the color palette for mode 1 and mode 0.


greeting

freemac

Extract of an old project
Quote-- byte pixels structure :
    -- mode 1 :
    --   1 byte <=> 4 pixels
    --   [AAAA][BBBB] : layering colors [AAAA] and [BBBB]
    --   A+B=0+0=dark blue (default Amstrad background color)
    --   A+B=0+1=light blue
    --   A+B=1+0=yellow
    --   A+B=1+1=red
    --  for example [1100][0011] with give 2 yellow pixels followed by 2 light blue pixels &C3
    -- mode 0 :
    --   1 byte <=> 2 pixels
    --   [AA][BB][CC][DD] : layering colors of AA, BB, CC, DD
    --   Because it results too many equations for a simple RGB output, they do switch the last equation (alternating at a certain low frequency (INK SPEED))
    -- mode 2 :
    --   1 byte <=> 8 pixels
    --   [AAAAAAAA] : so only 2 colors xD

funkheld

hello, tanks for info.


greeting

Powered by SMFPacks Menu Editor Mod