ALLOWFULLSCREEN: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Protected "ALLOWFULLSCREEN" ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite)))
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 17: Line 17:




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


Line 24: Line 24:
''Example 1:'' Allowing only one fullscreen mode with square pixels and no antialiasing:
''Example 1:'' Allowing only one fullscreen mode with square pixels and no antialiasing:
{{CodeStart}}
{{CodeStart}}
{{Cl|_ALLOWFULLSCREEN}} {{Cl|_SQUAREPIXELS}}, {{Cl|OFF}}
{{Cl|_ALLOWFULLSCREEN}} {{Cl|_SQUAREPIXELS}} , {{Cl|OFF}}
{{CodeEnd}}
{{CodeEnd}}


----


''Example 2:'' Disabling _FULLSCREEN with Alt+ENTER so the combo can be manually trapped:
''Example 2:'' Disabling _FULLSCREEN with Alt+ENTER so the combo can be manually trapped:
Line 33: Line 34:
     {{Cl|CLS}}
     {{Cl|CLS}}


     {{Cl|LOCATE}} 7
     {{Cl|LOCATE}} {{Text|7|#F580B1}}
     {{Cl|PRINT}} "    - Press ALT+ENTER to test trapping the combo..."
     {{Cl|PRINT}} {{Text|<nowiki>"    - Press ALT+ENTER to test trapping the combo..."</nowiki>|#FFB100}}
     {{Cl|PRINT}} "    _ Press SPACEBAR to allow fullscreen again..."
     {{Cl|PRINT}} {{Text|<nowiki>"    _ Press SPACEBAR to allow fullscreen again..."</nowiki>|#FFB100}}


     k& = {{Cl|_KEYHIT}}
     k& = {{Cl|_KEYHIT}}


     {{Cl|IF}} k& = 13 {{Cl|THEN}}
     {{Cl|IF}} k& = {{Text|13|#F580B1}} {{Cl|THEN}}
         {{Cl|IF}} {{Cl|_KEYDOWN}}(100307) {{Cl|OR}} {{Cl|_KEYDOWN}}(100308) {{Cl|THEN}}
         {{Cl|IF}} {{Cl|_KEYDOWN}}({{Text|100307|#F580B1}}) {{Cl|OR (boolean)|OR}} {{Cl|_KEYDOWN}}({{Text|100308|#F580B1}}) {{Cl|THEN}}
             altEnter = altEnter + 1
             altEnter = altEnter + {{Text|1|#F580B1}}
         {{Cl|END IF}}
         {{Cl|END IF}}
     {{Cl|ELSEIF}} k& = 32 {{Cl|THEN}}
     {{Cl|ELSEIF}} k& = {{Text|32|#F580B1}} {{Cl|THEN}}
         fullscreenEnabled = {{Cl|NOT}} fullscreenEnabled
         fullscreenEnabled = {{Cl|NOT}} fullscreenEnabled
     {{Cl|END IF}}
     {{Cl|END IF}}


     {{Cl|LOCATE}} 14
     {{Cl|LOCATE}} {{Text|14|#F580B1}}
     {{Cl|IF}} fullscreenEnabled {{Cl|THEN}}
     {{Cl|IF}} fullscreenEnabled {{Cl|THEN}}
         {{Cl|_ALLOWFULLSCREEN}} {{Cl|_ALL}}, {{Cl|_ALL}}
         {{Cl|_ALLOWFULLSCREEN}} {{Cl|_ALL}} , {{Cl|_ALL}}
         altEnter = 0
         altEnter = {{Text|0|#F580B1}}
         {{Cl|PRINT}} "_ALLOWFULLSCREEN _ALL, _ALL"
         {{Cl|PRINT}} {{Text|<nowiki>"_ALLOWFULLSCREEN _ALL, _ALL"</nowiki>|#FFB100}}


         {{Cl|LOCATE}} 18
         {{Cl|LOCATE}} {{Text|18|#F580B1}}
         {{Cl|PRINT}} "ALT+ENTER will trigger all four fullscreen modes now."
         {{Cl|PRINT}} {{Text|<nowiki>"ALT+ENTER will trigger all four fullscreen modes now."</nowiki>|#FFB100}}
     {{Cl|ELSE}}
     {{Cl|ELSE}}
         {{Cl|_ALLOWFULLSCREEN}} {{Cl|OFF}}
         {{Cl|_ALLOWFULLSCREEN}} {{Cl|OFF}}
         {{Cl|PRINT}} "_ALLOWFULLSCREEN OFF"
         {{Cl|PRINT}} {{Text|<nowiki>"_ALLOWFULLSCREEN OFF"</nowiki>|#FFB100}}
     {{Cl|END IF}}
     {{Cl|END IF}}


     {{Cl|IF}} altEnter {{Cl|THEN}}
     {{Cl|IF}} altEnter {{Cl|THEN}}
         {{Cl|LOCATE}} 18
         {{Cl|LOCATE}} {{Text|18|#F580B1}}
         {{Cl|PRINT}} "ALT+ENTER manually trapped"; altEnter; "times."
         {{Cl|PRINT}} {{Text|<nowiki>"ALT+ENTER manually trapped"</nowiki>|#FFB100}}; altEnter; {{Text|<nowiki>"times."</nowiki>|#FFB100}}
     {{Cl|END IF}}
     {{Cl|END IF}}


     {{Cl|_DISPLAY}}
     {{Cl|_DISPLAY}}
     {{Cl|_LIMIT}} 30
     {{Cl|_LIMIT}} {{Text|30|#F580B1}}
{{Cl|LOOP}}
{{Cl|LOOP}}
{{CodeEnd}}
{{CodeEnd}}


{{PageSeeAlso}}
{{PageSeeAlso}}

Latest revision as of 13:12, 19 March 2023

The _ALLOWFULLSCREEN statement allows setting the behavior of the ALT+ENTER combo.


Syntax

_ALLOWFULLSCREEN [{_STRETCH|_SQUAREPIXELS|OFF|_ALL}][, {_SMOOTH|OFF|_ALL}]


Description

  • Calling the statement with no parameters enables all four possible full screen modes (and is the default state when a program is started): both _STRETCH (_SMOOTH and _OFF) and _SQUAREPIXELS (_SMOOTH and _OFF).
  • _ALLOWFULLSCREEN only affects the behavior of ALT+ENTER. The _FULLSCREEN statement is not bound by _ALLOWFULLSCREEN's settings so all modes can be accessed programmatically.
  • To limit just the mode but allow both _SMOOTH + _OFF antialiasing modes, pass just the first parameter: Example: _ALLOWFULLSCREEN _SQUAREPIXELS
  • To allow multiple modes with _SMOOTH or _OFF as default, pass just the second parameter. Example: _ALLOWFULLSCREEN , _SMOOTH
  • Any possible permutation of the parameters is allowed.
  • With _ALLOWFULLSCREEN _OFF you can trap Alt+Enter manually in your program and reassign it. See example 2 below.


Availability

  • Version 1.3 and up.


Examples

Example 1: Allowing only one fullscreen mode with square pixels and no antialiasing:

_ALLOWFULLSCREEN _SQUAREPIXELS , OFF

Example 2: Disabling _FULLSCREEN with Alt+ENTER so the combo can be manually trapped:

DO
    CLS

    LOCATE 7
    PRINT "    - Press ALT+ENTER to test trapping the combo..."
    PRINT "    _ Press SPACEBAR to allow fullscreen again..."

    k& = _KEYHIT

    IF k& = 13 THEN
        IF _KEYDOWN(100307) OR _KEYDOWN(100308) THEN
            altEnter = altEnter + 1
        END IF
    ELSEIF k& = 32 THEN
        fullscreenEnabled = NOT fullscreenEnabled
    END IF

    LOCATE 14
    IF fullscreenEnabled THEN
        _ALLOWFULLSCREEN _ALL , _ALL
        altEnter = 0
        PRINT "_ALLOWFULLSCREEN _ALL, _ALL"

        LOCATE 18
        PRINT "ALT+ENTER will trigger all four fullscreen modes now."
    ELSE
        _ALLOWFULLSCREEN OFF
        PRINT "_ALLOWFULLSCREEN OFF"
    END IF

    IF altEnter THEN
        LOCATE 18
        PRINT "ALT+ENTER manually trapped"; altEnter; "times."
    END IF

    _DISPLAY
    _LIMIT 30
LOOP


See also



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