I cannot figure out how to make headers which could replace P1010667_pal.h and P1010667_tile.h from the WIKI page at: http://code.google.com/p/sgdk/wiki/sgdk_tile_functions . I can compile correctly when I use those given files, but I want to use my own images instead. The best I have been able to get is something that is really wrapped and upside-down that almost resembles my art.
If anyone knows how to display a 320x224 image on screen with SGDK, would you please help me with this? Simple step by steps would be greatly appreciated.
thanks.
Having difficulty getting 320x224 image on screen SGDK
Moderator: Stef
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
The simplest method is to use one of these functions :
You just should have your bitmap file in same directory than your sources files or in a "res" sub-directory, the makefile will automatically generate the corresponding bin and header file.
Be sure your bitmap is 16 colors only.
If your bitmap file is named "image.bmp" the resulting header file is "image.h" and so your code will look like :
The code described in the tutorial is not than easy but correspond to the "usual way" of uploading tile data to video processor then use them to display image.
The methods above are not fast enough to be used "in game".
Code: Select all
/**
* Load and draw a Genesis 4 BPP bitmap.
* A Genesis bitmap is a 4 bpp bitmap which has been converted via the bintos tool.
* The resulting file contains bitmap size info and 16 colors palette.
*
* \param genbmp16
* Genesis bitmap data buffer.
* \param x
* X coordinate.
* \param y
* y coordinate.
* \param numpal
* Palette (index) to use to load the bitmap palette information.
*/
void BMP_loadGenBmp16(const u16 *genbmp16, u16 x, u16 y, u16 numpal);
/**
* Load and draw a Genesis 4 BPP bitmap with specified dimension.
* A Genesis bitmap is a 4 bpp bitmap which has been converted via the bintos tool.
* The resulting file contains bitmap size info and 16 colors palette.
* The bitmap is scaled to the specified dimension.
*
* \param genbmp16
* Genesis bitmap data buffer.
* \param x
* X coordinate.
* \param y
* y coordinate.
* \param w
* width (expected to be relative to bitmap resolution : 1 pixel = 1 byte).
* \param h
* height.
* \param numpal
* Palette (index) to use to load the bitmap palette information.
*/
void BMP_loadAndScaleGenBmp16(const u16 *genbmp16, u16 x, u16 y, u16 w, u16 h, u16 numpal);
Be sure your bitmap is 16 colors only.
If your bitmap file is named "image.bmp" the resulting header file is "image.h" and so your code will look like :
Code: Select all
#include "genesis.h"
#include "image.h"
int main()
{
//set up the screen
VDP_setScreenWidth320();
VDP_setHInterrupt(0);
VDP_setHilightShadow(0);
// display bitmap at position (0, 0) and use palette 0
BMP_loadGenBmp16(image, 0, 0, 0);
while(1);
}
The code described in the tutorial is not than easy but correspond to the "usual way" of uploading tile data to video processor then use them to display image.
The methods above are not fast enough to be used "in game".