RESIZE (function): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{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...")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:


{{PageDescription}}
{{PageDescription}}
* The function returns -1 if a program screen resize was attempted by the user.  
* 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.
* 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.
* The [[$RESIZE]]:ON [[metacommand]] must be used so the program is created with a user resizable window.




==Availability==
{{PageAvailability}}
* '''Version 1.000 and up'''.
* '''Version 1.000 and up'''.


Line 25: Line 25:
{{Cl|SCREEN}} s&
{{Cl|SCREEN}} s&


bee& = {{Cl|_LOADIMAGE}}("qb64_trans.png") 'QB64's bee from http://www.qb64.net/qb64_trans.png
bee& = {{Cl|_LOADIMAGE}}("qb64_trans.png") 'any image


{{Cl|DO}}
{{Cl|DO}}
Line 48: Line 48:


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[$RESIZE]] {{text|(metacommand)}}
* [[$RESIZE]]
* [[_RESIZE]]
* [[_RESIZE]]
* [[_RESIZEWIDTH]], [[_RESIZEHEIGHT]] {{text|(requested pixel dimensions)}}
* [[_RESIZEWIDTH]], [[_RESIZEHEIGHT]]




{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 21:27, 2 February 2023

The _RESIZE function returns true (-1) when a user has attempted to resize the program window and $RESIZE:ON has allowed it.


Syntax

IF _RESIZE THEN rx& = _RESIZEWIDTH: ry& = _RESIZEHEIGHT


Description

  • 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.


Availability

  • Version 1.000 and up.


Examples

Example: Resize the current screen image according to user's request.

$RESIZE:ON

s& = _NEWIMAGE(300, 300, 32)
SCREEN s&

bee& = _LOADIMAGE("qb64_trans.png") 'any image

DO
    IF _RESIZE THEN
        oldimage& = s&
        s& = _NEWIMAGE(_RESIZEWIDTH, _RESIZEHEIGHT, 32)
        SCREEN s&
        _FREEIMAGE oldimage&
    END IF

    CLS

    'Center the QB64 bee image:
    x = _WIDTH / 2 - _WIDTH(bee&) / 2
    y = _HEIGHT / 2 - _HEIGHT(bee&) / 2
    _PUTIMAGE (x, y), bee&
    _DISPLAY
    _LIMIT 30
LOOP


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link