Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics


2D retro grapics engine with true raster effects for creating 8/16 bit style games · By megamarc

Sprite Not Showing Up...

A topic by Rubberduckycooly created Jun 21, 2018 Views: 131 Replies: 2
Viewing posts 1 to 3

Since i haven't got a response on GitHub i thought i might ask here:

I Have Created a Loader to load .gif images that is based off src_lib\loadbitmap.h but when i load a sprite using this method, nothing is displayed...

When i check the values the width, height, bit_depth and palette are all correct and assigned but the image still isn't showing up...

Here is My Code (I am using gif_lib ( to get the data for the .gif images):

#include "..\src\GifLib\gif_lib.h"

static TLN_Bitmap LoadGIF(const char* filename)
	TLN_Bitmap bitmap = NULL;
	GifFileType* Gif = DGifOpenFileName(filename, 0);
	//General Gif Values
	int width = Gif->Image.Width; std::cout << "Image Width = " << width << std::endl;
	int height = Gif->Image.Height; std::cout << "Image Height = " << height << std::endl;
	int bit_depth = Gif->SColorResolution; std::cout << "Colour = " << bit_depth << std::endl;
	bitmap = TLN_CreateBitmap(width, height, bit_depth);
	//Load ScanLines
	int pitch = TLN_GetBitmapPitch(bitmap);
	int l;
	for (l = 0; l<height; l++)
		uint8_t* line = TLN_GetBitmapPtr(bitmap, 0, l);
	//Colour Palette Values
	TLN_Palette pal;
	int palette_entries = Gif->SColorMap->ColorCount;
	int c;
	pal = TLN_CreatePalette(palette_entries);
	std::cout << palette_entries << std::endl;
	for (c = 0; c < palette_entries; c++)
		TLN_SetPaletteColor(pal, c, Gif->SColorMap->Colors[c].Red, Gif->SColorMap->Colors[c].Green, Gif->SColorMap->Colors[c].Blue);
	TLN_SetBitmapPalette(bitmap, pal);
	/* bitmap loaded */
	if (bitmap)
		/* accept only 8 bpp */
		int bpp = TLN_GetBitmapDepth(bitmap);
		if (bpp == 8)
			bitmap = NULL;
	if (!bitmap)
	return bitmap;

Hi dude,

Sorry for the delay. Replied on your original GitHub question thread

No Problem! I have now replied (to the github thread) with more code that might help!