CPCWiki forum

General Category => Programming => Topic started by: Arnaud on 16:10, 18 March 16

Title: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 16:10, 18 March 16
Hello,
i'm playing with the last version of Cpctelera 1.3.2 and i'm using the build (and very useful) command IMG2SPRITES as in the example blendedSprites.

But when my project is build, the .c and .h files are generated in the same directory of my pictures (ex <my_Project/pictures>, is there a way to IMG2SPRITES to specify the output directory (ex <my_Project/src>) ?
Thanks,
Arnaud.
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: ronaldo on 05:28, 19 March 16
Hi Arnaud,

At the moment, this function does not let you configure output folder. It was thought to work similar to bin2c.

I've added your suggestion to tasklist. However, it will take time, as I'm abroad and won't return 'till the end of this month.

Glad to know it is useful 😊
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 08:19, 19 March 16
Have a nice trip !  :D
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: SRS on 14:21, 19 March 16
How about this in the meantime ->

Edit build_cg.mk

delete or comment (#)
CFILES         := $(IMGCFILES) $(filter-out $(IMGCFILES), $(CFILES))

add here

# Convert images
PALETTE={0 1 3 6 9 12 13 14 23 25 26}
$(eval $(call IMG2SPRITES,src/img/scifi_bg.png,0,g,80,128,$(PALETTE)))
$(eval $(call IMG2SPRITES,src/img/items.png,0,g,8,8,$(PALETTE)))


$(eval $(call mv src/img/*.c src/))
$(eval $(call mv src/img/*.h src/))

Don't forget to change the include from #include "img/items.h" to #include "items.h" i.e.
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 19:55, 19 March 16
Thanks,

i have included the following lines :

# Convert images
PALETTE={0 1 3 6 9 12 13 14 23 25 26}
$(eval $(call IMG2SPRITES,src/img/scifi_bg.png,0,g,80,128,$(PALETTE)))
$(eval $(call IMG2SPRITES,src/img/items.png,0,g,8,8,$(PALETTE)))
$(eval $(call mv src/img/*.c src/))
$(eval $(call mv src/img/*.h src/))


But it does nothing my files are always in /src/img

I don't understand how works this make files  ::)
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: SRS on 20:22, 19 March 16
Quote from: Arnaud on 19:55, 19 March 16
Thanks,

i have included the following lines :

# Convert images
PALETTE={0 1 3 6 9 12 13 14 23 25 26}
$(eval $(call IMG2SPRITES,src/img/scifi_bg.png,0,g,80,128,$(PALETTE)))
$(eval $(call IMG2SPRITES,src/img/,0,g,8,8,$(PALETTE)))
$(eval $(call mv src/img/*.c src/))
$(eval $(call mv src/img/*.h src/))


But it does nothing my files are always in /src/img

I don't understand how works this make files  ::)

Did you put a # in front of
CFILES         := $(IMGCFILES) $(filter-out $(IMGCFILES), $(CFILES)) ?
And what are your IMG Files ? Are they the same name then scifi_bg.png and items.png ?
Else you don't need to add those two lines

And before a new "make", you must use "make cleanall"


If you post or PM me  your build_cg.mk we can have a look at it
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 20:46, 19 March 16
Here my build file.

Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: SRS on 22:12, 19 March 16
please try to change
Quote$(call mv src/sprites/*.c src/)
$(call mv src/sprites/*.h src/)

to
Quote$(eval $(call mv src/img/*.c src/))
$(eval $(call mv src/img/*.h src/))



Question: do you really want to extract tiles with Width 0, Height 0 ? Or is this making the full *.png into one tile ?
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 08:20, 20 March 16
Quote from: SRS on 22:12, 19 March 16
Question: do you really want to extract tiles with Width 0, Height 0 ? Or is this making the full *.png into one tile ?
Yes it's what i want.

Quote from: SRS on 22:12, 19 March 16
please try to change
$(eval $(call mv src/img/*.c src/))
$(eval $(call mv src/img/*.h src/))
Same problem nothing move

And when i comment the line
CFILES         := $(IMGCFILES) $(filter-out $(IMGCFILES), $(CFILES)) ?
The project make compilation error.


Here my test project if you want to take a look.



Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: SRS on 18:24, 20 March 16
I was sure this worked yesterday, but today I can't get it to work, either.  :picard:

BUT (hehe) - why not put the PNG into SRC directory and change
# Convert images
PALETTE={0 1 2 3 4 6 8 9 11 12 13 15 16 18 24 26}
$(eval $(call IMG2SPRITES,src/test.png,0,g,0,0,$(PALETTE)))


Not so elegant, but ...
Title: Re: [CPCTelera] IMG2SPRITES in build_config.mk
Post by: Arnaud on 21:13, 20 March 16
Thanks for searching,
it's as you, said, just a question of elegancy for not mixing code and picture.

My project works in this way it's what matter  ;)
Powered by SMFPacks Menu Editor Mod