Jump to content
  • Advertisement
Sign in to follow this  
ScottSeeker

Code Question

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

I'm new to these boards so I'm not sure if this is the right place to post this but... I am working on a project for school at the moment. The project is to create a word scrambler game. Basically I randomly display 6 letters, and in one minute's time you have to come up with as many words as you can using those 6 letters(word must be atleast 3 letters to score points). This part already works and checks against a dictionary successfully. My question is about screen flicker. My professor has a class made that basically mimics the ostream class, in which he built in a backbuffer function for just this purpose. My problem is, it doesn't work very well for me. Oh, and let me not forget to mention that this is a simple Win32 Console application. If anyone can help me with stopping that flicker I'd appreciate it.

Share this post


Link to post
Share on other sites
Advertisement
make sure your clearing the front buffer and copying the backbuffer over to the front. Proper use of double buffering should stop the flicker...

Share this post


Link to post
Share on other sites
First make sure you are using it right. Make sure you are rendering everything to the backbuffer, then rendering the backbuffer to the screen. I say "render," but I'm not exactly sure how it would work out with text. I guess the idea is the same, using characters instead of pixel colors.

Are you sure the flicker is not supposed to be there?

Its fairly hard to have real-time graphics with console text. Another thing you might want to try is putting "Sleep(1);" somewhere in the game loop. This will limit the framerate to at least 1000 fps. Right now you could be getting hundreds of thousands of frames per second (although, I doubt it because text i/o takes some time).

Does the class clear the screen each frame and how?

A "system("cls");" call will clear the screen and add a not-so-nice flicker. I'm not sure if there is any way around that. Another unintelligent way is to printf("\n\n\n\n\n..."). That will cause some obvious flicker too. The only way I can think of to modify the text is with conio.h functions. They have direct access to the screen's frame buffer and support gotoXY functions to modify individual characters. I suppose it may have some more functions to draw a backbuffer of text to the screen (probably the best option if said function exists :)

That rant may educate you a bit, but I don't think it will solve the problem because you are working with his class. The final answer is, its a bitch to use text with real-time graphics. Good luck.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I appreciate the responses. I'll have to read over his code for using the buffer, and look at his example. The problem with his example is that it's huge and that he programmed it 'stream of conciousness' during lecture, so it's not very organized.

If that fails, I'll check the link you gave me for the MSDN.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!