(Solved) Text limits and Screeninfo

New to FreeBASIC? Post your questions here.
Morganite
Posts: 3
Joined: Jan 30, 2019 13:51

(Solved) Text limits and Screeninfo

Postby Morganite » Jan 30, 2019 20:54

Solution:I just needed to use the Width command to figure out length and width.

Long story short:I just want to figure out the text limit using Screeninfo after the screen has been set with a Screen (Mode Number).

Hi, so I'm writing this "simple" text library to make my life easier, and I sort of want to do this math on the fly. I just want to say I'm using the DOS version now so certainly tricks might not work.

Let's say I have this code.

Code: Select all

Declare Function Center (a As String, b As Integer)
Function Center (a As String, b As Integer)
...
End Function


What I do in the function later on isn't important, however, it DOES require me to figure out the character limits of the screen mode to use in some math. I assume Screeninfo is somehow capable of getting the text limits of the screen(for example:Screen Mode 16 has a limit of 64x24 or 64x48 characters, I want to know which limit is there currently.) I am just not sure how to do this. How would I do this? I'm sorry for my poorly worded question, I just wasn't sure how to convey what I wanted.
Last edited by Morganite on Jan 30, 2019 22:46, edited 1 time in total.
MrSwiss
Posts: 3190
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Text limits and Screeninfo

Postby MrSwiss » Jan 30, 2019 22:17

Hi,

ScreenInfo() returns pixels only. (this info by itself isn't sufficient, for your purpose)
You therefore have to additionally know the currently set Font sizes (w, h) ... or
set them yourself.

Code: Select all

ScreenRes(800, 600, 32)   ' more versatile, than oldfashioned Screen statement
Width 800 \ 8, 600 \ 16   ' font size: 8x16 (w / h)
Morganite
Posts: 3
Joined: Jan 30, 2019 13:51

Re: Text limits and Screeninfo

Postby Morganite » Jan 30, 2019 22:23

MrSwiss wrote:Hi,

ScreenInfo() returns pixels only. (this info by itself isn't sufficient, for your purpose)
You therefore have to additionally know the currently set Font sizes (w, h) ... or
set them yourself.

Code: Select all

ScreenRes(800, 600, 32)   ' more versatile, than oldfashioned Screen statement
Width 800 \ 8, 600 \ 16   ' font size: 8x16 (w / h)

I literally just needed the width command, I am an idiot. Thank you!
(And to be clear, the Screen command is a lot easier to quickly set up, especially when first making a program, hence my usage.)
badidea
Posts: 1417
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Text limits and Screeninfo

Postby badidea » Jan 30, 2019 22:26

width can also be used to get the number of rows and columns of the display.
See: https://freebasic.net/wiki/wikka.php?wakka=KeyPgWidth
Morganite
Posts: 3
Joined: Jan 30, 2019 13:51

Re: Text limits and Screeninfo

Postby Morganite » Jan 30, 2019 22:45

badidea wrote:width can also be used to get the number of rows and columns of the display.
See: https://freebasic.net/wiki/wikka.php?wakka=KeyPgWidth

Yes, which... Was what I needed...
elissasmart
Posts: 1
Joined: Mar 04, 2019 11:29

Re: (Solved) Text limits and Screeninfo

Postby elissasmart » Mar 04, 2019 11:30

Width doesn't work this way
counting_pine
Site Admin
Posts: 6170
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: (Solved) Text limits and Screeninfo

Postby counting_pine » Mar 04, 2019 14:00

elissasmart wrote:Width doesn't work this way

Hi elissasmart, welcome to the forum.

Can you provide a short example of what you're trying, and how the result differs from what you expect?

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 12 guests