Page 3 of 10
Posted: Wed Feb 12, 2014 9:04 am
by Stef
the
Code: Select all
u16 VDP_drawBitmap(u16 plan, const Bitmap *bitmap, u16 x, u16 y);
wait for a Bitmap so you have to directly pass the car variable to it (and not the image data field :
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, car, 3, 3);
Posted: Wed Feb 12, 2014 9:21 am
by matteus
Code
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, car, 3, 3);
Res file
Error
Code: Select all
src\main.c|10|error: incompatible type for argument 2 of `VDP_drawBitmap'|
Posted: Wed Feb 12, 2014 10:41 am
by Mixail
matteus, use sample ...\sample\sprite
Posted: Wed Feb 12, 2014 11:18 am
by matteus
Mixail wrote:matteus, use sample ...\sample\sprite
Hi Mixail, thank you for your response. My project setup is already based on the sample sprite, it copies everything but the main.c and res.
However the sprite example doesn't use VDP_drawBitmap it uses VDP_drawImageEx. I'm attempting to use the Bitmap engine.
Thank you both, for your efforts and patience with a newbie. Once I have a full understanding of the SGDK. I'd like to help create a document of how to use all of the methods within the SGDK.
Posted: Wed Feb 12, 2014 11:52 am
by Mixail
matteus wrote:
I'd like to help create a document of how to use all of the methods within the SGDK.
It would be quite good.
Posted: Wed Feb 12, 2014 12:45 pm
by Stef
matteus wrote:Code
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, car, 3, 3);
Res file
Error
Code: Select all
src\main.c|10|error: incompatible type for argument 2 of `VDP_drawBitmap'|
Oh sorry, my fault, you have to pass the pointer of the structure of course :
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, &car, 3, 3);
And if you intend to use the bitmap engine directly then use the BMP_xxx methods instead
Posted: Wed Feb 12, 2014 3:15 pm
by matteus
Stef wrote:matteus wrote:Code
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, car, 3, 3);
Res file
Error
Code: Select all
src\main.c|10|error: incompatible type for argument 2 of `VDP_drawBitmap'|
Oh sorry, my fault, you have to pass the pointer of the structure of course :
Code: Select all
VDP_drawBitmap(VDP_PLAN_A, &car, 3, 3);
And if you intend to use the bitmap engine directly then use the BMP_xxx methods instead
Well when I say bitmap engine I mean the bitmap based VDP methods
ahh so you pass the pointer to the structure! ooo could we be getting close, I'll try this when I get home from work tonight! I'm excited about getting this working haha how sad am I?
Posted: Wed Feb 12, 2014 7:01 pm
by matteus
Some success!!!
however it's hard to tell what its done to my images colours!
The image is a basic 32 x 16 graphic using about 9 colours
Posted: Wed Feb 12, 2014 7:10 pm
by matteus
Further testing using VDP_drawImage instead of VDP_drawBitmap resulted in a single 8x8 tile being drawn.
Posted: Wed Feb 12, 2014 8:04 pm
by matteus
Right I have some more questions
Code: Select all
VDP_drawImage(VDP_PLAN_A, &car_image, 3, 0);
VDP_drawImage(VDP_PLAN_B, &background_image, 3, 0);
Does PLAN_A and PLAN_B run off the same palette in the SGDK?
I thought the 16th colour in a standard palette was for transparency? if so should I be able to have the car on VDP_PLAN_A with the background on VDP_PLAN_B. Is the transparency colour black?
Posted: Wed Feb 12, 2014 10:55 pm
by Stef
You can use VDP_drawImageEx(..) method so you can specify more parameters (as the palette informations).
And the transparency color is color 0, not color 15.
Posted: Wed Feb 12, 2014 11:39 pm
by matteus
Stef wrote:You can use VDP_drawImageEx(..) method so you can specify more parameters (as the palette informations).
And the transparency color is color 0, not color 15.
Do you have any examples?
Posted: Thu Feb 13, 2014 12:43 am
by matteus
I use the standard VDP_drawImage method and the image is fine but when i use this method the palette colours are incorrect
Does anyone know why?
Code: Select all
#include <genesis.h>
#include "gfx.h"
#include "music.h"
int main()
{
u16 palette[32];
u16 ind;
// initialization
VDP_setScreenWidth320();
// set all palettes to black
VDP_setPaletteColors(0, palette_black, 64);
// load background
ind = TILE_USERINDEX;
VDP_drawImageEx(BPLAN, &background_image, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, ind), 4, 0, FALSE, TRUE);
ind += background_image.tileset->numTile;
VDP_drawImageEx(APLAN, &character_image, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 4, 0, FALSE, TRUE);
ind += character_image.tileset->numTile;
// prepare palette
memcpy(&palette[0], background_image.palette->data, 16 * 2);
memcpy(&palette[16], character_image.palette->data, 16 * 2);
//VDP_drawImage(VDP_PLAN_B, &background_image, 3, 0);
//VDP_drawImage(VDP_PLAN_A, &character_image, 3, 0);
// fade in
VDP_fadeIn(0, (2 * 16) - 1, palette, 20, FALSE);
while(1)
{
VDP_waitVSync();
}
return 0;
}
Posted: Thu Feb 13, 2014 12:46 am
by matteus
Stef wrote:You can use VDP_drawImageEx(..) method so you can specify more parameters (as the palette informations).
And the transparency color is color 0, not color 15.
Which colour does the image conversion turn to colour 0 though?
Posted: Thu Feb 13, 2014 12:38 pm
by matteus
Again thank you both for your help I thought I'd post my work in progess project so I can show I am learning
The car image was my first attempt at getting something to work small scale 32x16 pixels but I was struggling to convert it. So I decided to go with something a lot bigger. . . I draw this image as a vector in macromedia flash and then exported it to a 8bit png.
I know the mega drive is capable of decent art if its handled correctly
I can only get the image to display properly using the VDP_DrawImage method. I can't get the palette to load correctly using the VDP_DrawImageEx code (see my previous post) the colours seem incorrectly mapped.