If I turn on the number 60 on my laptop, the animation begins to move at a breakneck pace.
As if not 60 and all 250 fps.
However, if you put any number less than 60 then the animation speed adequate.
(Laptop have display frame rate 60 hertz)
Yes forgot to clarify. I put the window to splitstsreen (second desktop).
If put window on first desktop speed ok.
Code: Select all
InitSprite()
Global nm_frames, nm_anim
;[ Палитра
Global Dim color.l(16), Dim cl.l(1), *scr_buffer, nm_releases
color(0) = 0 | 0 << 8 | 0 << 16
color(1) = 0 | 0 << 8 | 180 << 16
color(2) = 180 | 0 << 8 | 0 << 16
color(3) = 180 | 0 << 8 | 180 << 16
color(4) = 0 | 178 << 8 | 0 << 16
color(5) = 0 | 178 << 8 | 180 << 16
color(6) = 180 | 178 << 8 | 0 << 16
color(7) = 180 | 178 << 8 | 180 << 16
color(8) = 0 | 0 << 8 | 0 << 16
color(9) = 0 | 0 << 8 | 252 << 16
color(10) = 252 | 0 << 8 | 0 << 16
color(11) = 252 | 0 << 8 | 252 << 16
color(12) = 0 | 254 << 8 | 0 << 16
color(13) = 0 | 254 << 8 | 252 << 16
color(14) = 252 | 254 << 8 | 0 << 16
color(15) = 252 | 254 << 8 | 252 << 16
;]
Procedure scr2image ( *scr )
If StartDrawing( ScreenOutput() )
For y = 0 To 191
pixelLine = 32 * ((y & $C0) | ((y << 3) & $38) | ((y >> 3) & $07))
attr = 6144 + ((y & $F8) << 2)
For x = 0 To 31
chr_pixels = PeekC(*scr + pixelLine + x)
chr_attr = PeekC(*scr + attr + x)
Paper = (chr_attr >> 3) & $0F
ink = (chr_attr & 7) | (Paper & $08)
; If chr_attr & 128 And flash: Swap Paper, ink: EndIf
bit = 128
For z = 0 To 7
If chr_pixels & bit
Plot( x<<3 + z, y, color( ink ))
Else
Plot( x<<3 + z, y, color( Paper ))
EndIf
bit >> 1
Next z
Next x
Next y
StopDrawing()
EndIf
EndProcedure
Procedure DrawScreen()
scr2image( *scr_buffer + nm_anim * 6912 )
nm_anim + 1
If nm_anim = nm_frames: nm_anim = 0: EndIf
EndProcedure
Procedure LoadImages()
Repeat
name$ = "scr/" + RSet(Str(nm_frames+1), 6, "0") + ".scr"
If FileSize( name$ ) <> -1
*scr_buffer = ReAllocateMemory(*scr_buffer, (nm_frames+1) * 6912)
ReadFile(0, name$)
ReadData(0, *scr_buffer + nm_frames * 6912, 6912 )
CloseFile(0)
nm_frames + 1
Else
Break
EndIf
ForEver
EndProcedure
If OpenWindow(0, 0, 0, 230, 90, "Event handling example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindow(1, 192, 0, 256, 192, "Event handling example...", #PB_Window_BorderLess)
OpenWindowedScreen(WindowID(1), 0, 0, 256, 192, 1, 0, 0); #PB_Screen_SmartSynchronization)
ResizeWindow(1, 1920,0, 512,384); jump to second desktop
SetFrameRate(60)
LoadImages()
FlipBuffers()
ClearScreen(0)
FlipBuffers()
ClearScreen(0)
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = 0
End
EndIf
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
FlipBuffers()
DrawScreen()
Delay(1)
ForEver
EndIf
source with screen 4 test - http://zxpress.ru/temp/zxvj.rar (60kb)