Difference between revisions of "ScreenMode"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
(Created page with '<center>'''Screen Mode Detection Function'''</center> {{CodeStart}} '' '' {{Cl|DIM}} {{Cl|SHARED}} colors DO {{Cl|PRINT}} {{Cl|PRINT}} {{Cl|PRINT}} " Screen W H …')
 
imported>Clippy
m
Line 3: Line 3:


{{CodeStart}} '' ''
{{CodeStart}} '' ''
{{Cl|DIM}} {{Cl|SHARED}} colors
DO
DO
   {{Cl|PRINT}}
   {{Cl|PRINT}}
Line 40: Line 39:


{{Cl|FUNCTION}} ScreenMode&
{{Cl|FUNCTION}} ScreenMode&
SHARED colors
mode& = -1
mode& = -1
{{Cl|OUT}} {{Cl|&H}}3C7, 1 'set attribute to read
{{Cl|OUT}} {{Cl|&H}}3C7, 1 'set attribute to read
Line 59: Line 59:
{{Cl|IF...THEN|IF}} colors = 1 {{Cl|AND (boolean)|AND}} (wide& <> 640 {{Cl|OR (boolean)|OR}} deep& <> 350) {{Cl|THEN}} mode& = {{Cl|_DEST}} ' 32 bit
{{Cl|IF...THEN|IF}} colors = 1 {{Cl|AND (boolean)|AND}} (wide& <> 640 {{Cl|OR (boolean)|OR}} deep& <> 350) {{Cl|THEN}} mode& = {{Cl|_DEST}} ' 32 bit
{{Cl|IF...THEN|IF}} colors > 17 {{Cl|AND (boolean)|AND}} (wide& <> 320 {{Cl|OR (boolean)|OR}} deep& <> 200) {{Cl|THEN}} mode& = {{Cl|_DEST}} ' 256 colors
{{Cl|IF...THEN|IF}} colors > 17 {{Cl|AND (boolean)|AND}} (wide& <> 320 {{Cl|OR (boolean)|OR}} deep& <> 200) {{Cl|THEN}} mode& = {{Cl|_DEST}} ' 256 colors
IF colors = 17 THEN colors = 16
IF colors = 19 THEN colors = 256
ScreenMode& = mode&
ScreenMode& = mode&
{{Cl|END FUNCTION}}
{{Cl|END FUNCTION}}
{{CodeEnd}}
{{CodeEnd}}


''See also:''
''See also:''

Revision as of 22:30, 20 June 2012

Screen Mode Detection Function


DO PRINT PRINT PRINT " Screen W H C " PRINT " 0 80/40 (25) 17 " PRINT " 1 (320) (200) 4 " PRINT " 2 (640) 200 2 " PRINT " ....................... " PRINT " 7 320 200 17 " PRINT " 8 640 200 17 " PRINT " 9 (640) 350 17 " PRINT " 10 (640) 350 1 " PRINT " 11 (640) 480 2 " PRINT " 12 (640) 480 17 " PRINT " 13 320 200 19 " PRINT " _NEWIMAGE screens " PRINT " 14 (600) (600) 1 _32" PRINT " 15 (800) (600) 19 _256" PRINT " 16 (900) (600) _ 13" PRINT PRINT "SCREEN ="; scr&; "mode ="; ScreenMode&; "Colors ="; colors PRINT "_DEST ="; _DEST IF ScreenMode& THEN CIRCLE (200, 100), 50, 3 INPUT "Enter a SCREEN mode 0 to 16: ", scrn$ scr& = VAL(scrn$): mode = -1 IF (scr& < 3 OR scr& > 6) AND scr& < 14 THEN SCREEN scr& IF scr& = 14 THEN handle& = _NEWIMAGE(600, 600, 32): SCREEN handle& IF scr& = 15 THEN handle& = _NEWIMAGE(800, 600, 256): SCREEN handle& IF scr& = 16 THEN handle& = _NEWIMAGE(900, 600, 13): SCREEN handle& LOOP UNTIL scr& > 16 FUNCTION ScreenMode& SHARED colors mode& = -1 OUT &H3C7, 1 'set attribute to read FOR colors = 1 TO 18 'get RGB color settings red = INP(&H3C9): grn = INP(&H3C9): blu = INP(&H3C9) IF red + grn + blu = 0 AND colors <> 16 THEN EXIT FOR NEXT wide& = _WIDTH: deep& = _HEIGHT IF colors = 17 AND wide& = 80 OR wide& = 40 THEN mode& = 0 IF colors = 4 THEN mode& = 1 IF colors = 2 AND deep& = 200 THEN mode& = 2 IF colors = 17 AND wide& = 320 AND deep& = 200 THEN mode& = 7 IF colors = 17 AND wide& = 640 AND deep& = 200 THEN mode& = 8 IF colors = 17 AND deep& = 350 THEN mode& = 9 IF colors = 1 AND wide& = 640 AND deep& = 350 THEN mode& = 10 IF colors = 2 AND deep& = 480 THEN mode& = 11 IF colors = 17 AND deep& = 480 THEN mode& = 12 IF colors > 17 AND wide& = 320 AND deep& = 200 THEN mode& = 13 IF colors = 1 AND (wide& <> 640 OR deep& <> 350) THEN mode& = _DEST ' 32 bit IF colors > 17 AND (wide& <> 320 OR deep& <> 200) THEN mode& = _DEST ' 256 colors IF colors = 17 THEN colors = 16 IF colors = 19 THEN colors = 256 ScreenMode& = mode& END FUNCTION


See also:



Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page