mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 06:45:09 +00:00
50 lines
1.8 KiB
Text
50 lines
1.8 KiB
Text
{{DISPLAYTITLE:_DISPLAY (function)}}
|
|
The [[_DISPLAY]] function returns the handle of the current image that is displayed on the screen.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:{{Parameter|currentImage&}} = [[_DISPLAY]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* Returns the current image handle value that is being displayed. Returns 0 if in the default [[SCREEN|screen]] image.
|
|
* Not to be confused with the [[_DISPLAY]] statement that displays the screen when not using [[_AUTODISPLAY]].
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Creating a mouse cursor using a page number that '''you create''' in memory without setting up page flipping.
|
|
{{CodeStart}}
|
|
{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(640, 480, 32) 'any graphics mode should work without setting up pages
|
|
{{Cl|_MOUSEHIDE}}
|
|
SetupCursor
|
|
{{Cl|PRINT}} "Hello World!"
|
|
{{Cl|DO}}: {{Cl|_LIMIT}} 30
|
|
{{Cl|DO}} {{Cl|WHILE}} {{Cl|_MOUSEINPUT}}: {{Cl|LOOP}} 'main loop must contain _MOUSEINPUT
|
|
' other program code
|
|
{{Cl|LOOP}}
|
|
|
|
{{Cl|SUB}} SetupCursor
|
|
{{Cl|ON TIMER(n)|ON TIMER}}(0.02) UpdateCursor
|
|
{{Cl|TIMER}} ON
|
|
{{Cl|END SUB}}
|
|
|
|
{{Cl|SUB}} UpdateCursor
|
|
{{Cl|PCOPY}} {{Cl|_DISPLAY (function)|_DISPLAY}}, 100 'any page number as desination with the _DISPLAY function as source
|
|
{{Cl|PSET}} ({{Cl|_MOUSEX}}, {{Cl|_MOUSEY}}), {{Cl|_RGB}}(0, 255, 0)
|
|
{{Cl|DRAW}} "ND10F10L3F5L4H5L3"
|
|
{{Cl|_DISPLAY}} 'statement shows image
|
|
{{Cl|PCOPY}} 100, {{Cl|_DISPLAY (function)|_DISPLAY}} 'with the function return as destination page
|
|
{{Cl|END SUB}} '' ''
|
|
{{CodeEnd}}
|
|
''Note:'' Works with the '''_DISPLAY function''' return as the other page. If mouse reads are not crucial, put the [[_MOUSEINPUT]] loop inside of the UpdateCursor SUB.
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[SCREEN]]
|
|
* [[PCOPY]]
|
|
* [[_DISPLAY]] {{text|(statement)}}
|
|
* [[_AUTODISPLAY]] {{text|(default mode)}}
|
|
* [[_DISPLAYORDER]] {{text|(statement)}}
|
|
|
|
|
|
{{PageNavigation}}
|