mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-28 11:17:46 +00:00
55 lines
1.5 KiB
Text
55 lines
1.5 KiB
Text
{{DISPLAYTITLE:_RESIZE (function)}}
|
|
The [[_RESIZE]] function returns true (-1) when a user has attempted to resize the program window and [[$RESIZE]]:ON has allowed it.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: IF '''_RESIZE''' THEN rx& = [[_RESIZEWIDTH]]: ry& = [[_RESIZEHEIGHT]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* The function returns -1 if a program screen resize was attempted by the user.
|
|
* After the function returns -1, [[_RESIZEWIDTH]] and [[_RESIZEHEIGHT]] can return the new requested dimensions in pixels.
|
|
* The [[$RESIZE]]:ON [[metacommand]] must be used so the program is created with a user resizable window.
|
|
|
|
|
|
{{PageAvailability}}
|
|
* Version 1.000 and up.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Resize the current screen image according to user's request.
|
|
{{CodeStart}}
|
|
{{Cl|$RESIZE}}:ON
|
|
|
|
s& = {{Cl|_NEWIMAGE}}(300, 300, 32)
|
|
{{Cl|SCREEN}} s&
|
|
|
|
bee& = {{Cl|_LOADIMAGE}}("qb64_trans.png") 'replace with your own image
|
|
|
|
{{Cl|DO}}
|
|
{{Cl|IF}} {{Cl|_RESIZE (function)|_RESIZE}} THEN
|
|
oldimage& = s&
|
|
s& = _NEWIMAGE(_RESIZEWIDTH, _RESIZEHEIGHT, 32)
|
|
SCREEN s&
|
|
{{Cl|_FREEIMAGE}} oldimage&
|
|
END IF
|
|
|
|
{{Cl|CLS}}
|
|
|
|
'Center the image:
|
|
x = {{Cl|_WIDTH (function)|_WIDTH}} / 2 - _WIDTH(bee&) / 2
|
|
y = {{Cl|_HEIGHT}} / 2 - _HEIGHT(bee&) / 2
|
|
{{Cl|_PUTIMAGE}} (x, y), bee&
|
|
{{Cl|_DISPLAY}}
|
|
{{Cl|_LIMIT}} 30
|
|
{{Cl|LOOP}}
|
|
{{CodeEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[$RESIZE]] {{text|(metacommand)}}
|
|
* [[_RESIZE]]
|
|
* [[_RESIZEWIDTH]], [[_RESIZEHEIGHT]] {{text|(requested pixel dimensions)}}
|
|
|
|
|
|
{{PageNavigation}}
|