realbasic-games
[Top] [All Lists]

Re: fast, smooth updates

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: fast, smooth updates
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Mon, 21 Jul 2003 07:27:08 -0700
At 2:25 AM -0400 7/21/03, John Balestrieri wrote:
Short & sweet, here it is a simple framework for benching Rb3D animation frame controllers:

http://www.tinrocket.com/personal/realbasic/FrameController_Bench_1.0.0.rb.sit

Great!  Thanks for doing this, John.

I found it easier to see the graph when I made two little changes: I fill the area below each graph point (and erase above), rather than plotting a single pixel, and when I get to the end, I just start over at the beginning but don't erase the graph (which I found I was often still studying when it disappeared). So GraphCanvas.Plot would be:

Sub Plot(valueY as double)
  #pragma DisableBackgroundTasks
  dim range as Double
  Dim h, y As Integer

  if currentX > me.Width then currentX = 0

  h = me.height
  y = h - (h * (valueY / maxY))
  me.Graphics.ForeColor = &cBF0000
  me.Graphics.DrawLine currentX, Y, currentX, h-1
  me.Graphics.ForeColor = &cFFFFFF
  me.Graphics.DrawLine currentX, 1, currentX, Y-1
  me.Window.UpdateNow

  currentX = currentX + 1

End Sub

(And as an aside, note that there's no benefit to #pragma disableBackgroundTasks in a function with no loops -- though it doesn't hurt anything either.)

Unfortunately this clobbers the time labels; perhaps those could be moved into StaticTexts or drawn outside the plot area.

Still looking at the results... more on that later!

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'

---
A searchable archive of this list is available at:
<http://support.realsoftware.com/listarchives/search.php>

Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
.


<Prev in Thread] Current Thread [Next in Thread>