Skip to main content
gamedev.net
🔒 Locked

Basic Char* Error

Started by CHG-Swampert Jul 26, 2009 at 7:11 AM 2 replies 1.1k views
Original Post
CHG-Swampert
CHG-Swampert
Arcade.Initialize("ACFONT.bmp",256,256,"!","z",16,256);
In the 4th and 5th parameters of this function, it asks for the first character and last character used in a bitmap font in order to use the font. However, it is asking for a char instead of a const char*. How would I go about changing this? Is there something I'm doing wrong? Initialization
void SDL_Bitmap_Font::Initialize(char *filename, int width, int height, char FirstCharacter, char LastCharacter, int NumOfRows, int ColumnLength)
{
	if((surf_Font = SDL_LoadBMP(filename))<0)
	{
		printf("Error Loading Font Image!\n");
	}

	iWidth = width;
	iHeight = height;
	cFirstCharacter = FirstCharacter;
	cLastCharacter = LastCharacter;
	iNumOfRows = NumOfRows;
	iColumnLength = ColumnLength;

	rect_WHUV.w = width;
	rect_WHUV.h = height;
	rect_WHUV.x = 0;
	rect_WHUV.y = 0;
}
hmm html ftw?
Tonni
Tonni
short answer: use single quotes instead of double quotes, like this:
Arcade.Initialize("ACFONT.bmp",256,256,'!','z',16,256);
BigFreak
BigFreak
With "!" and "z", you are passing in a string literal (double quotes denoting a string). Single characters are denoted with single ('z') quotes. That should sort you out.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.