Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
_RESIZE question
#5
You might want to toggle RESIZE OFF before making manual changes, and see if that helps:

Code: (Select All)
$RESIZE:ON
SCREEN _NEWIMAGE(160, 140, 32)
DO: LOOP UNTIL _RESIZE = -1 'wait for the resize flag to trigger
DO: LOOP UNTIL _RESIZE = 0 'be certain to clear all resize flags
_SCREENMOVE 20, 20
_DISPLAY
DO
    _LIMIT 60
    IF CheckResize(_SOURCE) = -1 THEN
        FOR i = 1 TO 10
            CIRCLE (RND * _WIDTH(0) - 1, RND * _HEIGHT(0) - 1), RND * 100 + 5, _RGB32(RND * 255, RND * 255, RND * 255)
        NEXT
    ELSE
        FOR i = 1 TO 200
            PSET (RND * _WIDTH(0) - 1, RND * _HEIGHT(0) - 1), _RGB32(RND * 255, RND * 255, RND * 255)
        NEXT
    END IF
    _DISPLAY
    k& = _KEYHIT
LOOP UNTIL k& = 27 OR k& = 32
SYSTEM
' *************************************************************************************************
' *                                                                                              *
' *  CheckResize: This FUNCTION checks if the user resized the window, and if so, recreates the  *
' *              ORIGINAL SCREEN image to the new window size.                                  *
' *                                                                                              *
' *              Developer Note: You must use $RESIZE:ON, $RESIZE:SMOOTH, or $RESIZE:SMOOTH at  *
' *                              the beginning of your project for this to work.                *
' *                              This FUNCTION only works in QB64 version 1.000 and up.          *
' *                                                                                              *
' *************************************************************************************************
FUNCTION CheckResize (CurrentScreen AS _UNSIGNED LONG)
    ' *** Define local variable for temporary screen
    DIM TempScreen AS _UNSIGNED LONG
    CheckResize = 0
    ' *** Check to see if the user resized the window. If so, change the SCREEN image to the correct size.
    IF _RESIZE THEN
        _RESIZE OFF
        ' *** First, create a copy of the current SCREEN image.
        TempScreen = _COPYIMAGE(CurrentScreen, 32)
        ' *** Set the SCREEN to the copied image, releasing the current SCREEN image.
        SCREEN TempScreen
        ' *** Remove (FREE) the original SCREEN image.
        _FREEIMAGE CurrentScreen
        ' *** Create a new "original" SCREEN image.
        CurrentScreen = _NEWIMAGE(_RESIZEWIDTH, _RESIZEHEIGHT, 32)
        ' *** Set the SCREEN to the new "original" image, releasing the copied SCREEN image.
        SCREEN CurrentScreen
        '  DRAW PREVIOUS SCREEN ON THE NEW ONE
        _PUTIMAGE (0, 0), TempScreen, CurrentScreen
        _DISPLAY
        ' *** Remove (FREE) the copied SCREEN image.
        _FREEIMAGE TempScreen
        ' *** Tell the caller there was a resize
        CheckResize = -1
        _RESIZE ON
    END IF

END FUNCTION
Reply


Messages In This Thread
_RESIZE question - by TerryRitchie - 06-15-2024, 02:32 AM
RE: _RESIZE question - by SMcNeill - 06-15-2024, 03:02 AM
RE: _RESIZE question - by SMcNeill - 06-15-2024, 03:31 AM
RE: _RESIZE question - by TerryRitchie - 06-15-2024, 03:36 AM
RE: _RESIZE question - by SMcNeill - 06-15-2024, 04:04 AM
RE: _RESIZE question - by TerryRitchie - 06-15-2024, 01:44 PM



Users browsing this thread: 1 Guest(s)