Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to clear a buffer quickly?
#11
ah yes, i forgot the "* len( integer )" deal. whoops :oops:
Reply
#12
On looking closer at the clear function I figured out that I can set the second parameter to a value other than 0 and it will 'clear' the array and set all elements to that value. So now I'm using

Code:
CLEAR YMIN(0), SCREENHEIGHT, (SCREENWIDTH - 1) * len(integer)

to reset YMIN to 800. Works great.

BTW, I'm no longer using tinyPTC and therefore no longer trying to clear the screen buffer array. However I use 2 arrays in my code that i want to reset as quickly as possible.


FBWiki (http://www.freebasic.net/wiki/wikka.php?...KeyPgClear ) is not very clear on what the 2nd parameter does. I looked at it many times without realizing what the 2nd param was for. I eventually guessed what it did after wondering if clear could set all elements to an arbitrary value.


When I use: clear BYVAL ....


my program shows no display and crashes.

If I use BYREF instead of BYVAL as shown in the FBWiki, the code doesn't compile and I get "argument count mismatch, found 'BYREF'."

If I leave byref and byval out, it works perfectly. :???:



Aaaaaaaaaaanywho, my code now runs faster thanks to the clear function and some other optimizations I have in place and I;m also using const to define some values that should have been constants from the git go. I'm now getting 22 to 30 FPS on average and sometimes better.
Reply
#13
yeah, i believe in order to use byval, you have to send a pointer. i.e.

clear( byval @ymin(0), etc, etc )

you don't even need to worry about it though =)

glad you got it running good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)