1
1
Fork 0
mirror of https://github.com/FellippeHeitor/InForm.git synced 2025-01-15 11:59:34 +00:00

#12: New SetFrameRate method to increase the default 30FPS rate.

Intended usage is at __UI_BeforeInit event for applications that require higher framerates like applications that use PictureBox controls for drawing.
This commit is contained in:
FellippeHeitor 2018-03-12 10:03:02 -03:00
parent 54cf8e368c
commit d9f7e7e416
3 changed files with 23 additions and 2 deletions

View file

@ -200,6 +200,7 @@ DIM SHARED __UI_Snapped AS _BYTE
DIM SHARED __UI_SnappedX AS INTEGER, __UI_SnappedY AS INTEGER
DIM SHARED __UI_SnappedXID AS LONG, __UI_SnappedYID AS LONG
DIM SHARED __UI_SnapLines AS _BYTE
DIM SHARED __UI_FrameRate AS SINGLE
'Control types:
DIM SHARED __UI_Type(0 TO 18) AS __UI_Types
@ -357,10 +358,31 @@ SUB __UI_InternalMenus
SetCaption __UI_GetID("__UI_PreviewMenuSelect"), "Select &All"
END SUB
SUB SetFrameRate(FPS AS _UNSIGNED INTEGER)
IF FPS >= 30 THEN
__UI_FrameRate = 1 / FPS
ELSE
__UI_FrameRate = 1 / 30
END IF
IF __UI_RefreshTimer = 0 THEN
__UI_RefreshTimer = _FREETIMER
ON TIMER(__UI_RefreshTimer, __UI_FrameRate) __UI_UpdateDisplay
ELSE
TIMER(__UI_RefreshTimer) OFF
TIMER(__UI_RefreshTimer) FREE
__UI_RefreshTimer = _FREETIMER
ON TIMER(__UI_RefreshTimer, __UI_FrameRate) __UI_UpdateDisplay
TIMER(__UI_RefreshTimer) ON
END IF
END SUB
'---------------------------------------------------------------------------------
SUB __UI_Init
DIM i AS LONG
SetFrameRate 30
__UI_BeforeInit
IF __UI_FormID = 0 THEN SYSTEM
@ -373,6 +395,7 @@ SUB __UI_Init
_DELAY .1
_ICON
_TITLE "InForm"
IF Control(__UI_FormID).CenteredWindow THEN _SCREENMOVE _MIDDLE
IF Control(__UI_FormID).Font = 0 THEN Control(__UI_FormID).Font = SetFont("", 8, "")
@ -413,9 +436,7 @@ SUB __UI_Init
__UI_OnLoad
__UI_EventsTimer = _FREETIMER
__UI_RefreshTimer = _FREETIMER
ON TIMER(__UI_EventsTimer, .008) __UI_DoEvents
ON TIMER(__UI_RefreshTimer, .03) __UI_UpdateDisplay
TIMER(__UI_EventsTimer) ON
TIMER(__UI_RefreshTimer) ON

Binary file not shown.

Binary file not shown.