ScreenRes + Width display or compiler problem [SOLVED]

Windows specific questions.
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

ScreenRes + Width display or compiler problem [SOLVED]

Postby Trinity » Sep 16, 2017 17:39

Hello ,
I am completely new to Free Basic so I have spent most of today experimenting trying to get some example programs to run.
Mainly I have been using FBIDE and FB 32 bit on a Windows 7 , 64 bit installation.
To try to find out about about screen output I modified an example program using Google help (Docs didn't seem to include any actual help on how to insert GFX_FULLSCREEN into the program)(fbgfx.bi & Using FB ' namespace) , anyway I ran and compiled the program listed below many times with different values windowed without using the GFX_FULLSCREEN and then I ran it one time using GFX_FULLSCREEN having set the value of Const H = 680 (Const W = 1024, H = 680) which ran fine fullscreen despite the odd H = 680 value . Then second (or third) time I ran the program full screen I set H=768 and all I got were a black screen , now no matter which values I use for W & H then all I get full screen is a black screen using FBC 32 bit compiler.
I have tried using physical screen reset and recompiled the program multiple times using both FBIDE and FBC 32 bit compiler , also also tried another physical monitor , have also tried uninstall and both over-writing and re-install of the compiler (and IDE) but nothing helps it seem as something has been written somewhere to file or disc that makes the behavior stick for the 32 bit version.
At last I was rather desperate so I tried also compiling the program with a FB 64 bit compiler and then that ran fine and displayed text full screen as it is supposed to do.
So now my question is , has any of the experts here any suggestion as to what the problem is and how to get the program to display correctly again using the FB 32 compiler ? (something is screwed up at present) , help to rectify the situation would be appreciated.

Code: Select all

#include "fbgfx.bi"
Using FB ' namespace

''Set up a graphics screen
Const W = 1024, H = 768

ScreenRes W, H , , , (GFX_FULLSCREEN)

Dim As Integer twid, tw, th

'' Fetch and print current text width/height:
twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Default for current screen (8*8)"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Width W\8, H\16 '' Use 8*16 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*16 font"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Width W\8, H\14 '' Use 8*14 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*14 font"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Width W\8, H\8 '' Use 8*8 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*8 font"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Last edited by Trinity on Sep 22, 2017 10:20, edited 1 time in total.
fxm
Posts: 7269
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: ScreenRes + Width display or compiler problem

Postby fxm » Sep 18, 2017 19:14

To begin,see the SCREENLIST page to find the fullscreen video modes supported by your PC.
D.J.Peters
Posts: 7099
Joined: May 28, 2005 3:28
Location: Germany

Re: ScreenRes + Width display or compiler problem

Postby D.J.Peters » Sep 18, 2017 20:39

Your OS doesn't support 8-bit color pallete modes in Fullscreen.
Try this (if you like)

Joshy

Code: Select all

#include "fbgfx.bi"
Using FB ' namespace

''Set up a graphics screen
Const as integer W = 1024, H = 768

ScreenRes W, H ,32,1,GFX_FULLSCREEN

Dim As Integer twid, tw, th

'' Fetch and print current text width/height:
twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Default for current screen (8*8)"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Width W\8, H\16 '' Use 8*16 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*16 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep

Width W\8, H\14 '' Use 8*14 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*14 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep

Width W\8, H\8 '' Use 8*8 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*8 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep
dodicat
Posts: 4336
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: ScreenRes + Width display or compiler problem

Postby dodicat » Sep 18, 2017 21:30

Win 10 here.
Win 10, here, can only use a 32 bit screen for full screen.
If I try anything else I get a bad crash, in some cases I must switch off the computer at the socket.
I don't know if that is the case for every Win 10
Even with 32 bits it is a bit dodgy.
Sometimes the desktop icons are re-arranged after full screen.
If I want a big screen I would just maximize the screenres to (almost) cover the desktop (using no frame if desired to cover it)
Your code:

Code: Select all


dim as integer W,H
screeninfo W,H  'monitor dimensions

screenres W,H,,, &h08  '&h08 is no frame (see fbgfx.bi in the inc folder)



Dim As Integer twid, tw, th

'' Fetch and print current text width/height:
twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Default for current screen (8*8)"
Print "Width:  " & tw
Print "Height: " & th
Sleep

Width W\8, H\16 '' Use 8*16 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*16 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep

Width W\8, H\14 '' Use 8*14 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*14 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep

Width W\8, H\8 '' Use 8*8 font

twid = Width()
tw = LoWord(twid): th = HiWord(twid)
Print "Set to 8*8 font"
Print "Width:  " & tw
Print "Height: " & th
print "press a key ..."
Sleep
sleep
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

Re: ScreenRes + Width display or compiler problem

Postby Trinity » Sep 18, 2017 22:36

Thank you very much all for your very kind help :-) Your help solved the problem !
I just find it a little mind boggling that it could display correctly once and then after that not running with the 32 bit compiler . That it would not run more than once on the 32 bit compiler but every time if using the 64 bit compiler is more understandable with your explanations though it still puzzle me.
But thank you very much for the lessons :-)
MrSwiss
Posts: 1922
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: ScreenRes + Width display or compiler problem

Postby MrSwiss » Sep 18, 2017 22:55

Well, the two Compilers have different (default) backends:
FBC 32 - ASSEMBLY (-gen GAS)
FBC 64 - GCC (-gen GCC)
(on Windows "standalone" mode), this may be a reason, for differing behavior.
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

Re: ScreenRes + Width display or compiler problem

Postby Trinity » Sep 19, 2017 10:27

MrSwiss wrote:Well, the two Compilers have different (default) backends:
FBC 32 - ASSEMBLY (-gen GAS)
FBC 64 - GCC (-gen GCC)
(on Windows "standalone" mode), this may be a reason, for differing behavior.


Thank you very much for the information :-)
I am interested in the subject of the actual construction of the Free BASIC. Do you know of any descriptions of the broader lines of the construction of the Free BASIC (the more the better) where it is dumbed-down enough for a "BASIC" programmer to have any meaning ? (I have a slight many years old knowledge of non-PC assembler programming and have sniffed to a lot of other stuff also but nothing that will make me understand other programming languages sufficiently to get much meaning from reading e.g. the "source code" - which I have downloaded anyway) .
I mean there could possibly exist a sort of a flowchart like description of all the parts to understand how they fit together (?)
MrSwiss
Posts: 1922
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: ScreenRes + Width display or compiler problem

Postby MrSwiss » Sep 20, 2017 21:53

See here, in FB's Documentation (online).
Just about anything there is to know about the Compiler ...
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

Re: ScreenRes + Width display or compiler problem

Postby Trinity » Sep 20, 2017 22:07

MrSwiss wrote:See here, in FB's Documentation (online).
Just about anything there is to know about the Compiler ...


Thank you very much , I immediately made a link to the Information for hacking on FreeBASIC page on my local browser start pages so that it is ready for perusing when I am ready :-)

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 1 guest