mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 04:25:08 +00:00
54 lines
1.4 KiB
Text
54 lines
1.4 KiB
Text
{{DISPLAYTITLE:_RESIZEWIDTH}}
|
|
The [[_RESIZEWIDTH]] function returns the user resized screen pixel width if [[$RESIZE]]:ON allows it and [[_RESIZE (function)|_RESIZE]] returns -1
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|newWidth&}} = [[_RESIZEWIDTH]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* [[_RESIZE (function)|_RESIZE]] function must return true (-1) before the requested screen dimensions can be returned by the function.
|
|
* The program should decide if the request is allowable for proper program interaction.
|
|
|
|
|
|
==Availability==
|
|
* '''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") 'QB64's bee from http://www.qb64.net/qb64_trans.png
|
|
|
|
{{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 QB64 bee 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]]
|
|
* [[_RESIZE (function)]]
|
|
* [[_RESIZEHEIGHT]]
|
|
|
|
|
|
{{PageNavigation}}
|