My issues about freebasic

For other topics related to the FreeBASIC project or its community.
Helium5793
Posts: 36
Joined: Jun 21, 2016 13:06

My issues about freebasic

Postby Helium5793 » Mar 07, 2020 17:24

Hi everyone,
I am a linux user and use Fedora 31. I find it runs much faster that Ubuntu on my computers and is always more up to date on software.

I realize I am about to dig myself a hole here, but I want to comment on the problems I see in Freebasic. I have been looking for a good compiled language and am familiar with qb64 and Purebasic, and have issues with both. I have spent a couple of weeks with freebasic (not the qb compatible part). The language has been developed for quite a few years, but in my mind has several drawbacks are holding it back from really gaining a lot more users. I have been trying to rewrite several old shareware programs I had written in the 90s. The basic part works great, but when it comes to displaying things I am having difficulties.
1. The graphics screens. These look like they might be really useful until you see the poor quality fonts available. The 8x8 and 14x8 and 16x8 appear way too small at many graphic levels, and when enlarged they look cartoonish. Pretty much like the characters on my old TRS-80 model 1. If better fonts were built in and easy to access, the usefulness of these screens would be hugely enhanced.
2. FLTK and GTK windows treatments. While these seem to work, their use seems incompatible with the basic language concept. I guess it is nice to be able to access C directly, but if I wanted to learn C I probably would not be programming in basic in the first place. I have always found C stood for cumbersome, and having to translate what I want in windows treatments from C to basic really slows me down and often just stops me. While the examples of their use are nice, they don't cover the more complicated widgets (lists for example, where you want to choose a line and then edit that line)
and so one gets stuck and frustrated. I have learned tkinker when using python and it seems to be fairly simple to use. I have never been very successful with Tk/Tcl as again, it requires me to deal with C way too much. Purebasic seems to handle windows better and more simply than freebasic but I find it has other issues (some of its linux features seem a bit broken). It seems to me that a project (beyond me) to have a C programmer write a bridge between FLTK or GTK that makes the interface similar to tkinter or purebasics, would make freebasic fully functional in a windows or xwindows environment.
3. I use gnome-terminal in linux. When I use screen 0, free basic loads that terminal program. It turns out that it can handle 16 bit color (at least) has a plethora of fonts, and seems to work as well as some of the graphics screens. If I could send commands to it when it is loading as screen 0, I could change its title, color, fonts, # of columns and rows and it would likely be more useful than many of the graphics screens. I can make those changes manually once it is loaded, but that requires one to change it each time. It has a "profile" that makes those changes, and it reads that on the way up, so if the screen 0 could call a profile that matched the basic program it could do all that. Is there a way to make screen 0 read a particular profile?
I have really gotten to like and appreciate freebasic. If I didn't feel blocked by the display options, it would quickly become my favorite language for developing programs. I would appreciate any comments, criticism, discussion of these ideas.

John
badidea
Posts: 2007
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: My issues about freebasic

Postby badidea » Mar 07, 2020 18:29

Sounds like valid points to me. The problem with screen 0 is probably that linux, windows (and dos) work very differently here.
I have seen various font libraries posted (I even have one on my github page, created by someone else, 10 years ago). But finding out which libraries and freebasic bindings are of good quality is not funny.

As for any open-source project one solution is to fork it and add all good libraries to it. We only need someone to do this and maintain it for ever. If successful, this would divide the freebasic community in two and add confusion (I was reading some D-language stuff yesterday).

Also somewhat worrying is that coderJeff seems inactive. Hopefully temporarily.
Helium5793
Posts: 36
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Mar 07, 2020 22:44

I have been lurking on the github project for a while. CoderJeff has been very active letting me know this is in very active development. He probably needs the break. I just wish I were a good enough C coder to take on the project I suggested. Thank you for your comments.
John
caseih
Posts: 1495
Joined: Feb 26, 2007 5:32

Re: My issues about freebasic

Postby caseih » Mar 08, 2020 4:22

for point 1, the FB graphics library could very well incorporate some scaling algorithms. Like DosBox. Not sure what the best way would be to incorporate that into the language.

for point3, I don't know of any way to change the terminal emulator font from within a program. At least no portable way! I think you can cause the title to change with the right escape codes (which varies with the terminal type). Back when terminals were invented no one thought of changing the font!
BasicCoder2
Posts: 3525
Joined: Jan 01, 2009 7:03

Re: My issues about freebasic

Postby BasicCoder2 » Mar 08, 2020 21:27

Yes I dug myself into a big hole when I made some suggestions on making FreeBASIC a more popular language!

FreeBASIC can do almost anything you want if you have the expertise of a professional C++ programmer and the C++ direction taken by the latest additions to FreeBASIC reflect that reality.

As for graphics I stick to the sceenres screenWidth, screenHeight, 32 bit mode and would convert any old code to work with that. I love the ability to easily handle and manipulate bitmaps using FreeBASIC's innate graphic commands.

As for the fonts there are solutions to that as well. Simple fonts are just images for each ascii code.

'' Here we draw a string using the custom font
Draw String (10, 10), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", , myFont
marcov
Posts: 2945
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: My issues about freebasic

Postby marcov » Mar 08, 2020 21:53

Helium5793 wrote:Hi everyone,
I have really gotten to like and appreciate freebasic. If I didn't feel blocked by the display options, it would quickly become my favorite language for developing programs. I would appreciate any comments, criticism, discussion of these ideas.

John


When do you think you can have a first set of patches ready?
badidea
Posts: 2007
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: My issues about freebasic

Postby badidea » Mar 08, 2020 23:10

A list of libraries, like c-sanchez did for FreeBASIC IDEs/Editors, with status, maintainer, platform, licence, etc. would be nice. Things like: How to use fonts, How to use sound, how to use network, which 3d-libraries, etc. For each subject, there are several options posted in the last 10+ years, but scattered throughout the forum mostly.

The wiki would be best for this, but collecting the stuff could be done on the forum first. Currently, on the wiki, there is:
* Community Code Library which is mostly a collection of interesting snippets
* External Libraries Index mostly just links created in 2012.
I'll wait a few days to see if someone wants to make a start, else I will try to do that (I have said that before, but never did it).

It would big job, see e.g. The big review and somewhere in the 7981 posts of D.J.Peters there are lists of his work.
There is more, but this information could be a starting point.
paul doe
Posts: 1175
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: My issues about freebasic

Postby paul doe » Mar 09, 2020 0:08

marcov wrote:When do you think you can have a first set of patches ready?

Why, you've not only beaten me to it, but also did it in a pretty blunt and succint way XD

BTW, this post should be in 'General Discussion' (the usual dumpster for these kind of 'discussions')...
Imortis
Moderator
Posts: 1715
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: My issues about freebasic

Postby Imortis » Mar 09, 2020 1:28

paul doe wrote:BTW, this post should be in 'General Discussion'


I agree that the Linux forum is not the best place for it. Moved to Community Discussion.
BasicCoder2
Posts: 3525
Joined: Jan 01, 2009 7:03

Re: My issues about freebasic

Postby BasicCoder2 » Mar 09, 2020 8:36

badidea wrote:.. and somewhere in the 7981 posts of D.J.Peters there are lists of his work.

viewtopic.php?f=17&t=24043
marcov
Posts: 2945
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: My issues about freebasic

Postby marcov » Mar 09, 2020 10:03

paul doe wrote:
marcov wrote:When do you think you can have a first set of patches ready?

Why, you've not only beaten me to it, but also did it in a pretty blunt and succint way XD


20 years of practice :-)

Nothing ever changes if there are no changes to the code. Also I've learned to mostly ignore any very broad comparisons with other languages. These are usually not that practical.
Last edited by marcov on Mar 09, 2020 12:16, edited 1 time in total.
dodicat
Posts: 6390
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: My issues about freebasic

Postby dodicat » Mar 09, 2020 12:08

Hello Helium5793
Most things in freebasic have to be coded out (e.g. fonts)
For example Windows console fonts:

Code: Select all

#include "windows.bi"

Sub SetFontSize(w As Long, h As Long,ftype As String="consolas")
    Dim As  _CONSOLE_FONT_INFOEX  x
    With x
        .cbsize=Sizeof(_CONSOLE_FONT_INFOEX)
        .nfont=0
        .dwfontsize=Type(w,h)
        .fontfamily=0
        .fontweight=100
        .facename=ftype
    End With
    setcurrentconsolefontex(GetStdHandle(STD_OUTPUT_HANDLE),1, @x )
End Sub

Function GetFontSize() As coord
    Dim As CONSOLE_FONT_INFOEX font
    Font.dwFontSize = GetConsoleFontSize(GetStdHandle(STD_OUTPUT_HANDLE),Font.nFont)
    Return Font.dwFontSize
End Function

Sub SetConsoleSize(cols As Long,lines As Long)
    Shell "MODE CON: COLS="+Str(cols)+ "LINES="+Str(lines)
End Sub

Sub GetConsoleSize(Byref w As Integer,Byref h As Integer)
    w=Loword(Width)
    h=Hiword(Width)
End Sub

'====================
Dim As coord p=GetFontSize
Print "Current (default) font = "; p.x;"  by ";p.y
Print "Press a key"
Sleep

SetFontSize(13,28)
p=GetFontSize
Print "new font size this session = ";p.x;" by ";p.y ' 13 by 28 should be

Dim As String asci
For n As Long=0 To 255
    If n<>7 Then asci+=Chr(n) 'create a string, supress the beep
Next

Locate 10
Print asci


Print "Now change the console size again,  press a key . . ."
Sleep
Cls
SetFontSize(15,30)
SetConsoleSize(50,4)
p=GetFontSize

Print "New console size = COLS=50 LINES=4"
Print "Font size now ";p.x;" by ";p.y   ' 15 by 30 should be
Print "Press a key to end . . . "
Sleep

 

Linux will be likewise (coded out some way), but I have not tried yet.
Helium5793
Posts: 36
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Mar 11, 2020 15:15

caseih wrote:for point 1, the FB graphics library could very well incorporate some scaling algorithms. Like DosBox. Not sure what the best way would be to incorporate that into the language.

for point3, I don't know of any way to change the terminal emulator font from within a program. At least no portable way! I think you can cause the title to change with the right escape codes (which varies with the terminal type). Back when terminals were invented no one thought of changing the font!


I am making progress on this. Gnome-terminal allows for profiles to be loaded with it, and multiple ones can be saved. When FB loads the terminal it automatically loads the current profile. That can include colors, fonts, rows and columns, and G-T even has windows like sliders when it gets beyond one screen. It also has limited mouse capabilities. I am getting close to being able to tell it what profile is the current default. If I can do that with a run command before the screen 0 command, this would be a good solution.

John
Helium5793
Posts: 36
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Mar 11, 2020 15:21

BasicCoder2 wrote:Yes I dug myself into a big hole when I made some suggestions on making FreeBASIC a more popular language!

FreeBASIC can do almost anything you want if you have the expertise of a professional C++ programmer and the C++ direction taken by the latest additions to FreeBASIC reflect that reality.

As for graphics I stick to the sceenres screenWidth, screenHeight, 32 bit mode and would convert any old code to work with that. I love the ability to easily handle and manipulate bitmaps using FreeBASIC's innate graphic commands.

As for the fonts there are solutions to that as well. Simple fonts are just images for each ascii code.

'' Here we draw a string using the custom font
Draw String (10, 10), "ABCDEFGHIJKLMNOPQRSTUVWXYZ", , myFont


I don't see in this line how one gets or makes a custom font "myFont". I saw somewhere that somebody had a ttf2bas program, but I couldn't get it work. I have several hundred ttf fonts. It would be great if I could get some or all of them to work. It is not clear to me how to make a custom font to use with the graphics screen. (what format the letters need to be in?)
BasicCoder2
Posts: 3525
Joined: Jan 01, 2009 7:03

Re: My issues about freebasic

Postby BasicCoder2 » Mar 11, 2020 15:57

Helium5793 wrote:I saw somewhere that somebody had a ttf2bas program, but I couldn't get it work.

Where did you see the program maybe someone here can help you to get it to work?

I personally have never used ttf in a FreeBASIC program but surely someone has?

They talk about using TTF with FreeBASIC's Draw String statement here in the Graphics and Games section?
https://code.google.com/archive/p/fb-extended-lib/

The few times I have used fonts I just roll my own using bitmap images as there is no innate support for them in FreeBASIC.

Some google results:
https://www.freebasic.net/wiki/wikka.ph ... Drawstring
https://www.freebasic.net/wiki/KeyPgWidth
https://freebasic.net/forum/viewtopic.php?t=21916
http://www.phatcode.net/~fb/forum/viewtopic.php?t=9146
Last edited by BasicCoder2 on Mar 12, 2020 0:18, edited 1 time in total.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests