|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 11/12/2008 6:31:21 AM
Posts: 4,
Visits: 12
|
|
I am currently designing an experiment that relies heavily on the use of sprite animation and have downloaded the Sprite Animation Example (Last Updated: 12/17/2007 3:52:45 PM) from the E-Prime sample listing page.
The sample is just what I was looking for and should serve as a foundation for my own experiment. However, when running the above sample (within E-Prime 1.2) I've encountered a problem - there seems to be some considerable variability in response detection from both the mouse and the keyboard. On some runs, the animation stops promptly upon a key or mouse button press, but on most runs there is a variable delay of up to half a second. Since real-time modification of the ongoing animation is a key part of my experiment, this poses considerable difficulty.
The sample employs direct drawing to the screen canvas and a continuous polling of a Wait object to detect user responses. I tried to overcome the problem by eliminating the use of the Wait object (EnableInput), and checking for mouse button clicks 'directly' by replacing:
Loop Until EnableInput.RT <> 0
with
Loop Until (Mouse.Buttons AND ebMouseButton1)
However, the problem persists. Has anyone else encountered this problem while using E-Prime for sprite animation, and is there a workaround? Also, is this an E-Prime bug - does the use of Canvas objects for animation in InLine code adversely affect the accurate detection of user input?
Any help would be greatly appreciated!
|
|
|
|
|
Forum MVP
      
Group: Administrators
Last Login: Yesterday @ 9:26:59 AM
Posts: 576,
Visits: 1,254
|
|
| Try sticking the following just above the Loop line so its inside your Canvas loop. Sleep 10 DoEvents
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 11/12/2008 6:31:21 AM
Posts: 4,
Visits: 12
|
|
Brandon.Cernicky (7/7/2008) Try sticking the following just above the Loop line so its inside your Canvas loop.
Sleep 10
DoEvents
Thanks very much Brandon! Your code fragment sorted the problem. I just have a few questions:
1) How does this workaround work - does the DoEvents statement speed the processing of the peripheral event queue by the OS, or speed the passing of the events to E-Prime?
2) Why is this workaround needed - is there a bug in E-Prime?
3) Does the use of DoEvents increase the chance of a missed frame refresh (Display.WaitForVerticalBlank)?
Thanks again for your help.
|
|
|
|