Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 7
Registered: ‎04-09-2009
My Device: Not Specified

SDL_LoadBMP unable to load resources

[ Edited ]

I'm attempting to use the SDL implementation on github to create an app. However, the following code is not able to load the .PNG file:

 

#include "SDL.h"

int main( int argc, char* argv[])
{
	SDL_Surface* tiles = NULL;
	SDL_Surface* screen = NULL;

	SDL_Init( SDL_INIT_EVERYTHING);
	screen = SDL_SetVideoMode(1200, 600, 32, SDL_SWSURFACE);

	tiles = SDL_LoadBMP("app/native/lofi_environment.bmp");
	if(!tiles)
		printf("Unable to load image");

	SDL_BlitSurface( tiles, NULL, screen, NULL);
	SDL_Flip(screen);
	SDL_Delay(4000);

	SDL_FreeSurface(tiles);
	SDL_Quit();

	return 0;
}

 This code is unable to load the PNG. I have included the PNG in the assets of the project and it appears in the filesystem of the app on the playbook. Please help.

 

Highlighted
Contributor
Posts: 40
Registered: ‎01-15-2012
My Device: Playbook Tablet
My Carrier: MTS

Re: SDL_LoadBMP unable to load resources

you try to load *.BMP, not a PNG.

/rgds
Andrey Yaromenok aka azazello