News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

20 sprite with cpctelera 32x16 from bmp 640x16

Started by funkheld, 12:43, 02 August 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld

Hi good afternoon.

how is the picture translated correctly?
bmp is 640x16 pixels

20 (20x32 = 640) individual sprites should be made of it in mode 1. Each sprite should be 32x16 pixels.

------------------------------------
PALETTE = {0 1 3 4 7 9 10 12 13 16 19 20 21 24 25 26}
$ (eval $ (call IMG2SPRITES, src / bild1.bmp, 1, g, 32,16, $ (PALETTE), src / ,,))
--------------------------------------

the result does not come.
the sprite is fully ground.

#include "bild1.h"
// Data created with Img2CPC - (c) Retroworks - 2007-2015
// Tile g_bild1_0: 32x16 pixels, 8x16 bytes.
const u8 g_bild1_0[8 * 16] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};


// Tile g_bild1_1: 32x16 pixels, 8x16 bytes.
const u8 g_bild1_1[8 * 16] = {
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};



greeting

teopl

I don't use cpctelera for image conversion since I want even more control. But I have used it before and it works well if you use correct parameters.

Also you could upload complete project to be sure that we are solving the correct problem - for example you have some spaces which are invalid and wouldn't even compile in the "src <SPACE> / <SPACE> bild1.bmp")

But what I really suggest for you is to take a look at examples folder in cpctelera and try to put your images there and modify the examples step by step to experiment. Also, then you can compare the working code to your code and see where is the problem that way.

funkheld

#2
the spaces appear only in the forum, for me the conversion command has no spaces.

I see you weren't happy with that either.
did you write your program yourself?




I also find no relationship in the help for:
mode 0, mode 1, mode 2 for then image2sprites
thank you.


not help:
-----------------------------

#define SP_W   8
#define SP_H   16
-----------------------------

not help:
----------------------------

#define SP_W   4
#define SP_H   16
----------------------------
here is the project:

teopl

Actually there is nothing wrong with the image conversion of cpctelera except that it's part of the make process and I wanted to do some other memory calculations before the make process which depend on the image generation.

I did not write image conversion tool, infact I do use the cpctelera script but not from the makefile (like I said I need more control), you can try this:

cpct_img2tileset --mode 1 --no-tileset --output-format bin --palette-firmware { 0 3 16 25 } --tile-width 92 --tile-height 22 ${FILE_IN}

(the cpct_*** are the cpctelera useful scripts)

you can also check the various options provided in each script (very good documented)

since the mentioned script converts to binary, you can then convert the binary to c source if you want (again using cpctelera script)

cpct_bin2c ${BIN_OUTPUT} -an g_teopl_binary_${BIN_OUTPUT_BASENAME} >${BIN_OUTPUT_C}

funkheld


Hello, thanks for your help.
can you please put your program in here for me?

it works now.
the background had to be black.

greeting

teopl

which program?

I have sent you relevant lines needed for "manual" image conversion.

I have also seen problem with your code (the error was visible on screen when you compile):

[PROCESSING] Converting tiles to CPCtelera's C code using Img2CPC...
Error.
There must be at least one palette value and 5 palette values maximum.
Couldn't parse conversion options. Use img2cpc --help for more information.
ERROR! Some error happened while processing file with img2cpc. Please, review files and image conversion optins to fix the problem.

So when I put 4 colors (not sure why it says 5 since mode 1 needs 4 colors) the:

make clean
make

works...

you just need to select correct palette and to fix this line:

cpct_drawSprite(g_bild1_00, pvideomem, 4, 16);

funkheld


Hello thanks for the information.

I have to look at the scripts again.
I do not know the connection to make.

greeting

Powered by SMFPacks Menu Editor Mod