Jump to content
  • Advertisement
Sign in to follow this  

const init within a class

This topic is 4522 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

MSVC8 express wont let me compile with the constant, BALL_VELOCITY outside of the initializer list(like below). Is it something im doing wrong, or this a rule? Ball::Ball(int bv)
{
	pBallBitmap = SDL_LoadBMP("ball.bmp");
	SDL_SetColorKey(pBallBitmap, SDL_SRCCOLORKEY, SDL_MapRGB(pBallBitmap->format, 255,0,255));

	mBallRect;                       //rect for bitmap position info
	mBallRect.x = 6;
	mBallRect.y = 6;
	mBallRect.w = 14;
	mBallRect.h = 14;
	mpBallRect = &mBallRect;         //pointer to ballrect

	BALLx = 300;
	BALLy = 400;
	BALL_VELOCITYx = bv; // or BALL_VELOCITYx = 500; ?
	BALL_VELOCITYy = bv; // or BALL_VELOCITYy = 500; ?
	ballVelx = 0;
	ballVely = -1;
}

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!