[C] Sprite examples for 32X ?

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
gameblabla
Interested
Posts: 13
Joined: Thu Sep 26, 2013 12:41 am

[C] Sprite examples for 32X ?

Post by gameblabla » Thu May 05, 2016 10:40 pm

Hello guys,
so i managed to compile the toolchain and all and i'm already having some issues with drawing on the 32X.
I was able to show a 32K picture on screen but drawing a sprite that can be anywhere on screen with transparency is a little more difficult...
The examples Chilly provides (32x_images.c) unfortunely seems to be designed to work only in 256 color mode.
Now of course, i could just work only in 256-mode but i don't want that because managing a palette that huge is painful.

Are there any examples/code out there that shows how to display sprites on-screen ?
I'm personally interested to make some 32X games.

Thanks

haroldoop
Very interested
Posts: 110
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Re: [C] Sprite examples for 32X ?

Post by haroldoop » Thu May 05, 2016 11:10 pm

Well, the 32x does not have hardware sprites (unless you use the Genesis' ones, of course), but you can do it via software; maybe you could take a look at Olivier's SuperVDP or, if you want a 32768 color example with software sprites, maybe you could take a look at my slow, unoptimized and still a work-in-progress VN32X.

gameblabla
Interested
Posts: 13
Joined: Thu Sep 26, 2013 12:41 am

Re: [C] Sprite examples for 32X ?

Post by gameblabla » Fri May 06, 2016 2:16 am

haroldoop wrote:Well, the 32x does not have hardware sprites (unless you use the Genesis' ones, of course), but you can do it via software; maybe you could take a look at Olivier's SuperVDP or, if you want a 32768 color example with software sprites, maybe you could take a look at my slow, unoptimized and still a work-in-progress VN32X.
Hey, thanks !
Your routines work pretty well, i must say.
It even supports alpha transparency !

But why do you have to convert your images to 8-bits though ?
To save space ?

I'm kind of surprised you can do 3D on this thing because it's basically a VGA adaptor with 2 powerful cpus...

haroldoop
Very interested
Posts: 110
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Re: [C] Sprite examples for 32X ?

Post by haroldoop » Fri May 06, 2016 10:59 pm

gameblabla wrote:
haroldoop wrote:Well, the 32x does not have hardware sprites (unless you use the Genesis' ones, of course), but you can do it via software; maybe you could take a look at Olivier's SuperVDP or, if you want a 32768 color example with software sprites, maybe you could take a look at my slow, unoptimized and still a work-in-progress VN32X.
Hey, thanks !
Your routines work pretty well, i must say.
It even supports alpha transparency !
I'm glad it's useful. :)
gameblabla wrote: But why do you have to convert your images to 8-bits though ?
To save space ?
Not really, it was mostly lazyness plus lack of time in my part; I didn't want to write my own image converter, so instead I experimented first with micol972's PNG decoder for 32x; it worked okay at first, I even managed to make the alpha channel work, but overall, it was quite slow; if you want to take a look at the original effort, you can access this old revision of the VN32X repository. Later, I tried sixpack; I counldn't manage to make its 15 bit conversion work, but the 256 color version worked like a charm, as long as the width was a multiple of 8. I still had to write a small Python script to add image width and height to the converted data, since sixpack does not include that.

I am thinking about implementing a custom image converter with a custom image format so as to use the full 32768 color palette but, right now, since there are other parts of VN32X that are in need of attention, this will probably be pushed to a later date.
gameblabla wrote: I'm kind of surprised you can do 3D on this thing because it's basically a VGA adaptor with 2 powerful cpus...
Yes, programing the 32x hardware sorta feels like developing a MS-DOS game.

gameblabla
Interested
Posts: 13
Joined: Thu Sep 26, 2013 12:41 am

Re: [C] Sprite examples for 32X ?

Post by gameblabla » Tue May 10, 2016 1:42 am

Ok, so i'm already running out of memory...

The 32X has two framebuffers of 128Ko, right ?
If so, then can i use the other framebuffer to store graphics ?
Can it be used at all for that purprose ?

Because it seems that i can't display more than a 320x202 screen in 32K mode...
I counldn't manage to make its 15 bit conversion work.
I don't know how you couldn't get it to work...
You simply need to set the format to "d15", kind of like this :

Code: Select all

./sixpack -image -pack -target 32x -codec aplib -format d15 -width 320 -height 202 porn.png -o porn.apx

User avatar
Sik
Very interested
Posts: 682
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: [C] Sprite examples for 32X ?

Post by Sik » Tue May 10, 2016 2:23 am

gameblabla wrote:The 32X has two framebuffers of 128Ko, right ?
If so, then can i use the other framebuffer to store graphics ?
Can it be used at all for that purprose ?
Nope. One framebuffer is displayed on screen (and can't be touched at all), the other framebuffer is used to draw into. So you only have access to one framebuffer at a time I'm afraid.
Sik is pronounced as "seek", not as "sick".

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest