1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00

Update help files [ci-skip]

This commit is contained in:
FellippeHeitor 2021-10-09 14:39:20 -03:00
parent ba9f0ec3c6
commit 0c99b7ddc4
2 changed files with 51 additions and 1 deletions

View file

@ -24,8 +24,9 @@ A '''SUB''' procedure is a procedure within a program that can calculate and ret
* SUB procedures can save program memory as all memory used in a SUB is released on procedure exit except for [[STATIC]] values.
* [[_DEFINE]] can be used to define all new or old QB64 variable [[TYPE]] definitions instead of DEF***.
* [[$INCLUDE]] text library files with needed SUB and [[FUNCTION]] procedures can be included in programs after all sub-procedures.
* '''QB64 ignores all procedural DECLARE statements!''' Define all ''parameter'' [[TYPE]]s in the SUB procedure.
* '''QB64 ignores all procedural DECLARE statements.''' Define all ''parameter'' [[TYPE]]s in the SUB procedure.
* '''Images are not deallocated when the [[SUB]] or [[FUNCTION]] they are created in ends. Free them with [[_FREEIMAGE]].'''
* In order to use OpenGL commands you need a [[SUB]] [[_GL]] in your program.
''Example 1:'' Text [[PRINT]] screen centering using [[PEEK]] to find the SCREEN mode width. Call and SUB procedure code:
@ -75,6 +76,7 @@ exit 1
''See also:''
* [[FUNCTION]], [[CALL]]
* '''SUB''' [[_GL]]
* [[BYVAL]], [[SCREEN (statement)]]
* [[EXIT]], [[END]]

48
internal/help/_GL.txt Normal file
View file

@ -0,0 +1,48 @@
{{DISPLAYTITLE:_GL}}
In order to use OpenGL drawing commands, you must do so from inside a [[SUB]] procedure called '''_GL''', which enables the commands to be rendered.
{{PageSyntax}}
:[[SUB]] _GL
:: ''REM Your OpenGL code here
: [[END]] [[SUB]]
{{PageDescription}}
* OpenGL commands are valid outside of '''SUB _GL''', as long as the sub procedure exists in your code.
* Attempting to use OpenGL commands without having '''SUB _GL''' in a program will result in a '''Syntax error''', even if the syntax is valid.
* SUB '''_GL''' cannot be invoked manually. The code inside it will be called automatically at approximately 60 frames per second.
* Using [[INPUT]] inside SUB '''_GL''' will crash your program.
* If your program needs to perform any operations before SUB _GL must be run, it is recommended to use a shared variable as a flag to allow SUB _GL's contents to be run. See example below.
==Example==
{{CodeStart}} '' ''
{{Cl|DIM}} allowGL {{Cl|AS}} {{Cl|_BYTE}}
'perform startup routines like loading assets
allowGL = -1 'sets allowGL to true so SUB _GL can run
{{Cl|DO}}
{{Cl|_LIMIT}} 1 'runs the main loop at 1 cycle per second
'notice how the main loop doesn't do anything, as SUB _GL will be running
'continuously.
{{Cl|LOOP}}
{{Cl|SUB}} {{Cl|_GL}}
{{Cl|IF}} NOT allowGL {{Cl|THEN}} {{Cl|EXIT}} {{Cl|SUB}} 'used to bypass running the code below until
' startup routines are done in the main module
'OpenGL code starts here
'The code in this area will be run automatically at ~60fps
{{Cl|END}} {{Cl|SUB}} '' ''
{{CodeEnd}}
{{PageSeeAlso}}
* [[_GLRENDER]]
* [[SUB]]
{{PageNavigation}}