5 Replies - 510 Views - Last Post: 17 April 2009 - 08:37 AM Rate Topic: -----

#1 failed.314159  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-April 09

Is there any way to improve the framerate when using system("cls&

Post icon  Posted 17 April 2009 - 06:55 AM

For my project in Microsoft visual C++ 2008
I'm creating a 2-Dimensional Array that appears on the screen and constantly refreshes itself...
in order to refresh it and clear the screen to allow the next frame to take its place i used system ("cls")
which isn't a C++ command, but for my purposes... it works

But when i run the program... the array that appears is incredibly flickery and
I want to fix that in order to prevent giving anyone an epileptic seizure and to just make it look better...

Is there a way to improve the frame-rate or just make it stop flickering?

and is there another way to clear the screen to do this?

Thnx

Is This A Good Question/Topic? 0
  • +

Replies To: Is there any way to improve the framerate when using system("cls&

#2 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 988
  • View blog
  • Posts: 5,135
  • Joined: 28-September 06

Re: Is there any way to improve the framerate when using system("cls&

Posted 17 April 2009 - 07:09 AM

It would be trivial to slow down the refresh rate by inserting a sleep() or wait() call before the 'cls'.

Would that be an acceptable way to avoid rapid flickering?

I'm not sure what kind of game it is so I have no idea of what the assumptions are.

Speeding up the refresh rate of 'cls' is not going to be practicable. If you need it faster you are going to move out of the CLI world into real graphics in a windowed environment.
Was This Post Helpful? 1
  • +
  • -

#3 failed.314159  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-April 09

Re: Is there any way to improve the framerate when using system("cls&

Posted 17 April 2009 - 07:11 AM

oh...
um
its a sidescrolling "shooter" type game...
and I'll try it to see if it works!
thnx
Was This Post Helpful? 0
  • +
  • -

#4 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 988
  • View blog
  • Posts: 5,135
  • Joined: 28-September 06

Re: Is there any way to improve the framerate when using system("cls&

Posted 17 April 2009 - 07:16 AM

View Postfailed.314159, on 17 Apr, 2009 - 06:11 AM, said:

oh...
um
its a sidescrolling "shooter" type game...
and I'll try it to see if it works!
thnx

Ahhhh
My suggestion is probably not that great then.
But, as you say, it might be worth a try and see if it is still playable at a lower refresh rate.
Maybe a few milliseconds could be a good compromise, maybe.
Was This Post Helpful? 0
  • +
  • -

#5 NickDMax  Icon User is online

  • Can grep dead trees!
  • member icon

Reputation: 2245
  • View blog
  • Posts: 9,234
  • Joined: 18-February 07

Re: Is there any way to improve the framerate when using system("cls&

Posted 17 April 2009 - 08:33 AM

...well the problem really is that system("cls") is a terrible solution even for your purposes.

You can create your own CLS and see if that helps. I have a snippet called Windows Console Output that has several useful functions. One of them is the "ClearScreen" function which should work faster than cls.
Was This Post Helpful? 1
  • +
  • -

#6 failed.314159  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 08-April 09

Re: Is there any way to improve the framerate when using system("cls&

Posted 17 April 2009 - 08:37 AM

yeah... i guess...

I realized that the problem was yes: system("cls"); isn't very good
AND
the major problem was that it would take too long for the array to be outputted...

Is there a solution to that? if so I could really use it now
because i noticed that the farther from the coordinates map[0][0]
the character got the more flickery the character was

and i couldn't tell when it wasn't far away because most of the other spaces are blanks...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1