Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

SFML display() Problem, not Displaying ON SECOND FUNCTION CALL?

$
0
0
I am working on a SFML c++ program that uses two rendering windows passed from main to the function drawmessage in a class textmessage. I was using the second window for displaying debug information that is displayed because I could not get the appropriate information from the SFML object. With that said, here is the part of that function that works the first time through and does not on the second usage. I really have changed the code to try and get it working. For example I created the two objects locally here for testing. I am sorry about the extra commented statements they help convey the message too. There is the same problem though, the statement : string test = message_holder10.getString(); is working and shows "asty" on every run. On the first run of the program there is a display of the text correctly however on the second call there is no display of it. (I am stepping through until the display command.) I feel like I have exhausted my tries so I am asking for help please. If it is the font I will just die, I really don't think it is. sf::Text message_holder10; sf::RenderWindow windowtype3(sf::VideoMode(700, 1000), "a"); if ((space_is_used && on_last_line) || (space_is_used && ((line_number) == (total_lines - 2)))) { //string temp_string = message::Get_Out_Bound_String(); //int length_of_string = temp_string.length(); sf::Font Fontforscore; if (gflag == 0) { gflag = 1; if (!Fontforscore.loadFromFile("ARIALBD.ttf")) { exit(1); } message_holder10.setFont(Fontforscore); message_holder10.setCharacterSize(100); message_holder10.setFillColor(sf::Color::Red); message_holder10.setOrigin(0, 0); message_holder10.setPosition(0, 0); windowtype2.close(); } message_holder10.setString("asty"); //int y_for_space = display_y_setting + (total_lines - 2) * each_vertical_offset_is; //int this_width = 0; //float x = message_holder.getLocalBounds().width; //message_holder.setPosition( ( (first_width - x )/2), y_for_space); //windowtype2.close(); string test = message_holder10.getString(); windowtype3.clear(); windowtype3.draw(message_holder10); windowtype3.display(); //windowtype.display(); Wait_For_Space_Press(); ///////////////////////// Before, the : windowtype3.display() without the clear was drawing other text in this call, just not this one particular text message with it! Thank you so much I am wondering what it can be, Josheir

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>