Jump to content
  • Advertisement
Sign in to follow this  
fooman_69

Text Dissappearing in Engine

This topic is 4400 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

Hiya! I have a simple game engine that controls itself via a master object that controls all of the sub-classes. When I go into my intro screen I press 'Enter' and the main game state takes over. When a player loses the game and it goes back to the intro state, the title text does not show up... yet my other text/objects are fine. I'm not sure why. Is there anything I should look for to help me figure the issue out? PS. I also am not sure whether or not to actually use the delete keyword when switching states, or simply set the pointer to NULL. With NULL, the destructor is not called correct? Is this an issue when switching back to the state after setting it to NULL however long ago? Here is some code for my controlling class:
/* Call graphics routines as needed
==========================================================*/
bool GameState::Render()
{
    // if 'Escape' has been pressed, end app
    if(keys[VK_ESCAPE])
        end = true;

    // if current state is the main game
    if (currentState == MAINGAME)
    {
        // if not already done so, create the main gamestate
        if(!main)
            main = new MainState(hDC);

        // step through frame
        main->Step(keys);

        // if game has ended
        if(main->end)
        {
            currentState = INTRO;
            //delete main;
            main = NULL;
        }
    }
    // if current state is the intro screen
    else if (currentState == INTRO)
    {
        // if not already done so, create the main gamestate
        if(!intro)
            intro = new IntroState(hDC);

        intro->Step(keys);

        // if game need to be started
        if(intro->end)
        {
            currentState = MAINGAME;    // current state becomes the main game
            //delete intro;
            intro = NULL;
        }
    }

    SwapBuffers(hDC);                   // swap buffers (double buffering)
}

Share this post


Link to post
Share on other sites
Advertisement
youre most likely leaving something on and forgetting to turn it off (or visaversa)
perhaps use glPushAttrib( GL_ALL_ATTRIB_BITS );
glPopAttrib() to track down the problem or use glintercept

Share this post


Link to post
Share on other sites
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!