Repository navigation
Screensync
Home › Screen Functions › ScreenSync
Waits for the display to finish drawing a frame, to reduce flicker.
Declare Function ScreenSync ( ) As LongThis GfxLib statement stops the execution of the program until the graphics card signals it has ended tracing a frame and is going to start the new one.
If the program uses this small interval of time between frames to redraw the image, the flickering is greatly reduced. In that use, ScreenSync is a reminiscence of QB where there was only that equivalent method (Wait &H3DA, 8) to improve the flickering. It is an empirical method because it only allows to synchronize the beginning of the drawing with the fixed dead time between two frames. To be used occasionally to avoid flickering when only very short time of drawing.
Except the purpose to reduce the flickering, ScreenSync can be also used simply as a method of synchronization of graphic drawing with the screen frame tracing (similarly to statement Sleep).
The error code returned by ScreenSync can be checked using Err in the next line. The function version of ScreenSync returns directly the error code as a 32 bit Long.
The use of the QB-compatible form Wait &H3DA, 8 is deprecated.
Zero if successful, or non-zero if a graphics mode was not previously set.
result = ScreenSync
- Not available in the -lang qb dialect unless referenced with the alias
__Screensync.
- New to FreeBASIC.
- QBasic used
Wait &H3DA, 8for this purpose.
'main loop
Do
' do user input
' calculate_a_frame
ScreenSync
' draw_ a_ frame
Loop Until Inkey <> ""Category: Screen Functions
Kind: function
Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing