You are viewing our Forum Archives. To view or take place in current topics click here.
[C++] Rendering a message on screen problems (+rep)
Posted:

[C++] Rendering a message on screen problems (+rep)Posted:

-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Hey, in my current program I am having trouble getting my message to render on-screen before it starts to fade out.

It should show for a few seconds then begin to fade out however, I am currently only seeing it appear when it begins the fade out part of my code.


   float delta = Game::DeltaTime; //Get the delta time between frames.

   if (m_currentTime > 0) //If there is still time remaining
   {
      m_currentTime -= delta; //Decrease total time remaining by the delta time.
      if (m_currentTime > 0 && m_currentTime <= m_fadeTime) //If the timer is between 0 and the fadeTime.
      {
         m_colour.a = (m_currentTime / m_fadeTime); //Set the alpha channel of the colour to the amount of time left to fade (0.0f -> 1.0f)
      }
      AssetManager::Singleton()->DrawFont(m_font, m_xPos, m_yPos, m_text, m_colour, Font::eAlign::ALIGN_LEFT); //Draw the message on-screen.
   }
   else
   {
      m_visible = false; //The timer has run out so set the visibility to false.
   }


Now, surely, the text should be rendered at any time when m_currentTime is greater than 0 or can someone spot something most likely incredibly simple that I am missing?
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.