[SDL] SDL_CreateRGBSurface is black?

mutable rswhite4 at gmail.com
Sun Jul 11 15:28:06 PDT 2010


I have dissolved the problem, i have add simply 
Code:
0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff

 to SDL_CreateRGBSurface.
But now i can get the individual tile but not the total map.
For this i have the following code:

Code:

SDL_Surface * map = SDL_CreateRGBSurface(
	SDL_SWSURFACE,
	cast(ushort) (5 * 16),
	cast(ushort) (5 * 16),
	32,
	0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff
);

ushort gid = std.conv.to!(ushort)(item_child.tag.attr["gid"]);
SDL_Surface * tile = tileset.getTile(gid);
if (!tile) {
	writefln("Tile '%d' konnte nicht geladen werden", gid);
	exit(0);
}

ushort[2] pos = [
	cast(ushort) (column * 16),
	cast(ushort) (line * 16)
];
SDL_Rect rect = {
	pos[0], pos[1],
	16, 16
};

SDL_BlitSurface(map, null, tile, &rect);

column += 1;
if (column >= 5) {
	column = 0;
	line += 1;
}




What's now the problem? :/




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100711/a0e86b83/attachment-0008.htm>


More information about the SDL mailing list