Getting the SCREEN mode
#28
Hi Terry
my two cents:
I remember an example of QBasic that get the screenmode using a mechanical method by error trapping (on error goto).

The news  of 32 bit screens aren't an exception to this... but the power of QB64 to create for example _NEWIMAGE(100,60,0) make needing the use of _WIDTH and _HEIGHT more than the ON ERROR GOTO way to get the screen MODE.

....
on the other hand I see in WikiHelp a function by Ted Weissgerber that should work and it uses INP and OUT

look at this
Code: (Select All)
FUNCTION ScreenMode&
SHARED colors 'share number of colors with main program
mode& = -1
_DEST 0 'destination zero always current screen mode
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 'get screen dimension
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 _PIXELSIZE = 0 THEN mode& = 0 'screen 0 any size
IF mode& = -1 THEN mode& = _DEST 'must be a QB64 screen
IF colors = 1 THEN colors = 4
IF colors = 17 THEN colors = 16
IF colors > 17 THEN colors = 256
IF _PIXELSIZE = 4 THEN colors = 32
ScreenMode& = mode&
END FUNCTION
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Code by Ted Weissgerber ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ

You can find it in the wiki help of IDE.
Reply


Messages In This Thread
Getting the SCREEN mode - by TerryRitchie - 09-29-2022, 04:04 PM
RE: Getting the SCREEN mode - by Pete - 09-29-2022, 08:25 PM
RE: Getting the SCREEN mode - by TerryRitchie - 09-29-2022, 08:36 PM
RE: Getting the SCREEN mode - by Pete - 09-29-2022, 08:45 PM
RE: Getting the SCREEN mode - by RhoSigma - 09-29-2022, 09:00 PM
RE: Getting the SCREEN mode - by mnrvovrfc - 09-29-2022, 11:06 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 12:04 AM
RE: Getting the SCREEN mode - by TerryRitchie - 09-30-2022, 02:30 AM
RE: Getting the SCREEN mode - by mnrvovrfc - 09-30-2022, 03:15 AM
RE: Getting the SCREEN mode - by TerryRitchie - 09-30-2022, 03:12 PM
RE: Getting the SCREEN mode - by mnrvovrfc - 09-30-2022, 04:21 PM
RE: Getting the SCREEN mode - by TerryRitchie - 09-30-2022, 04:38 PM
RE: Getting the SCREEN mode - by mnrvovrfc - 09-30-2022, 05:46 PM
RE: Getting the SCREEN mode - by RhoSigma - 09-30-2022, 08:15 AM
RE: Getting the SCREEN mode - by TerryRitchie - 09-30-2022, 03:05 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 02:37 AM
RE: Getting the SCREEN mode - by bplus - 09-30-2022, 02:38 AM
RE: Getting the SCREEN mode - by bplus - 09-30-2022, 02:57 AM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 03:01 AM
RE: Getting the SCREEN mode - by bplus - 09-30-2022, 03:10 AM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 03:21 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 04:24 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 04:47 PM
RE: Getting the SCREEN mode - by TerryRitchie - 09-30-2022, 04:51 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 05:00 PM
RE: Getting the SCREEN mode - by Pete - 09-30-2022, 05:58 PM
RE: Getting the SCREEN mode - by mnrvovrfc - 09-30-2022, 05:59 PM
RE: Getting the SCREEN mode - by TempodiBasic - 10-03-2022, 11:13 PM
RE: Getting the SCREEN mode - by TempodiBasic - 10-04-2022, 11:22 PM
RE: Getting the SCREEN mode - by SMcNeill - 10-07-2022, 09:56 AM
RE: Getting the SCREEN mode - by TempodiBasic - 10-08-2022, 02:57 AM
RE: Getting the SCREEN mode - by Kernelpanic - 10-07-2022, 03:14 PM
RE: Getting the SCREEN mode - by TempodiBasic - 10-08-2022, 03:01 AM



Users browsing this thread: 7 Guest(s)