Original Post
I am making a space launching game, and am using SDL, but i have come across a weird bug that i cant resolve. When i run the debugger, it says that player->thrust_percent=50, which is correct, but, the result of str is "h=0.00, thrust=0.000000". I am wondering if i am not referencing the class correctly. Thanks, John
void Draw_Scene(SDL_Surface* screen, Spaceship *player) {char * str; str=new char[1023]; sprintf(str, "h=%4.2f, thrust=%f",player->height-RADIUSEARTH, player->thrust_percent ); SDL_FillRect(screen, NULL, 0x000000); Draw_Text(screen, str, screen->w/2, screen->h/2, 255,255,255); SDL_Flip(screen); free(str);} class Spaceship{ //theta = angle from verticle to axis of ship //phi = angle frme verticle to angle of V //gamma = angle from top of world to space ship public: double theta, phi, gamma; long double height; double mass, drag,velocity; float thrust_percent; Spaceship() { theta=0; phi=0; gamma=0; height=0; mass=0; drag=0;velocity=0; thrust_percent=0; }