sdl - TTF_RenderText with integer -
is posible use ttf_render_textsolid controlled 1 integer? try use stringstreams this:
stringstream _minutes; stringstream _seconds; stringstream _miliseconds; _minutes << minutes << ":"; _seconds << seconds << ":"; _miliseconds << miliseconds;
(the variable minutes, seconds , miliseconds scoped)
but when compile this, compile then, run , says : core dumped. error in memory part. mmh happens?
doing along lines of:
stringstream ss; ss << minutes << ":" << seconds << ":" << miliseconds; const string str = ss.str(); sdl_surface* surf = ttf_rendertext_solid(textfont, str.c_str(), textcolor);
should work without problem.
do not store const char*
comes out of though! str
goes out of scope, const char*
won't valid anymore.
Comments
Post a Comment