[squeak-dev] The Inbox: MorphicExtras-ct.260.mcz
Chris Cunningham
cunningham.cb at gmail.com
Wed Sep 4 17:23:30 UTC 2019
hmm. I didn't notice the use of TimeStamp. We should stop using that
subclass where possible and not include any new uses in the base image.
On Wed, Sep 4, 2019, 09:39 Chris Cunningham <cunningham.cb at gmail.com> wrote:
> Hi.
>
> I like the changes (especially the switch to DateAndTime), however, if you
> have a FrameRateMorph open when updating, it raises errors and fails to
> work (the time to timestamp gives it issues).
>
> Any chance you could prescript to fix this? Maybe either update existing
> instances with DateAndTimes and stop/start stepping around the update, or
> closing all instances (although I'm not sure if that is advisable with the
> comments about 'stand-alone entity' in initializeToStandAlone, which
> implies there are embedded instances).
>
> -cbc
>
> On Wed, Sep 4, 2019 at 6:54 AM <commits at source.squeak.org> wrote:
>
>> A new version of MorphicExtras was added to project The Inbox:
>> http://source.squeak.org/inbox/MorphicExtras-ct.260.mcz
>>
>> ==================== Summary ====================
>>
>> Name: MorphicExtras-ct.260
>> Author: ct
>> Time: 4 September 2019, 3:53:54.175698 pm
>> UUID: cab65f78-e646-cc40-9d0f-c16114d1bb44
>> Ancestors: MorphicExtras-mt.259
>>
>> Refactor FrameRateMorph: Add accessors for updateInterval and expose
>> measure data. Use TimeStamp instead of Time to avoid clock wrap around.
>>
>> =============== Diff against MorphicExtras-mt.259 ===============
>>
>> Item was changed:
>> StringMorph subclass: #FrameRateMorph
>> + instanceVariableNames: 'lastDisplayTime framesSinceLastDisplay
>> updateInterval mSecsPerFrame framesPerSec'
>> - instanceVariableNames: 'lastDisplayTime framesSinceLastDisplay'
>> classVariableNames: ''
>> poolDictionaries: ''
>> category: 'MorphicExtras-Demo'!
>>
>> Item was added:
>> + ----- Method: FrameRateMorph>>framesPerSec (in category 'accessing')
>> -----
>> + framesPerSec
>> +
>> + ^ framesPerSec!
>>
>> Item was changed:
>> ----- Method: FrameRateMorph>>initialize (in category 'initialization')
>> -----
>> initialize
>> "initialize the state of the receiver"
>> super initialize.
>> ""
>> + lastDisplayTime := TimeStamp new.
>> - lastDisplayTime := 0.
>> framesSinceLastDisplay := 0.
>> + self updateInterval: 500 milliSeconds.
>> self font: (Preferences standardMenuFont emphasized: 1).
>> !
>>
>> Item was added:
>> + ----- Method: FrameRateMorph>>mSecsPerFrame (in category 'accessing')
>> -----
>> + mSecsPerFrame
>> +
>> + ^ mSecsPerFrame!
>>
>> Item was changed:
>> ----- Method: FrameRateMorph>>step (in category 'stepping and
>> presenter') -----
>> step
>> "Compute and display (every half second or so) the current
>> framerate"
>>
>> + | now timePassed newContents |
>> - | now mSecs mSecsPerFrame framesPerSec newContents |
>> framesSinceLastDisplay := framesSinceLastDisplay + 1.
>> + now := TimeStamp now.
>> + timePassed := now - lastDisplayTime.
>> + (timePassed > self updateInterval) ifTrue:
>> + [| mSecs |
>> + mSecs := timePassed asMilliSeconds.
>> + mSecsPerFrame := mSecs // framesSinceLastDisplay.
>> - now := Time millisecondClockValue.
>> - mSecs := now - lastDisplayTime.
>> - (mSecs > 500 or: [mSecs < 0 "clock wrap-around"]) ifTrue:
>> - [mSecsPerFrame := mSecs // framesSinceLastDisplay.
>> framesPerSec := (framesSinceLastDisplay * 1000) // mSecs.
>> newContents := mSecsPerFrame printString, ' mSecs (',
>> framesPerSec printString, ' frame', (framesPerSec = 1 ifTrue: [''] ifFalse:
>> ['s']), '/sec)'.
>> self contents: newContents.
>> lastDisplayTime := now.
>> framesSinceLastDisplay := 0]
>> ifFalse:
>> ["Ensure at least one pixel is drawn per frame"
>> Preferences higherPerformance ifTrue: [self invalidRect:
>> (self position extent: 1 at 1)]]!
>>
>> Item was added:
>> + ----- Method: FrameRateMorph>>updateInterval (in category 'accessing')
>> -----
>> + updateInterval
>> +
>> + ^ updateInterval!
>>
>> Item was added:
>> + ----- Method: FrameRateMorph>>updateInterval: (in category 'accessing')
>> -----
>> + updateInterval: aNumber
>> +
>> + updateInterval := aNumber!
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190904/0fe5f191/attachment-0001.html>
More information about the Squeak-dev
mailing list
|