The text and attribute pages in gfx mode ?

General FreeBASIC programming questions.
Post Reply
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

The text and attribute pages in gfx mode ?

Post by D.J.Peters »

I never used x = screen(r,c,flag) with Q BASIC in old DOS days nor with FreeBASIC before.

Without doing a look in the source code,
it exist for every graphic page a text page with char and color attributes also.

With a call of screenptr() we get the pixel address from current working graphic page (independent how many pages are defined)

Is there a command to get the address of the current text and attribute buffer also ?

Joshy
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: The text and attribute pages in gfx mode ?

Post by dodicat »

I only know of screencontrol returning grapics colours.

Code: Select all

 
screen 20,32
color rgb(10,203,12),rgb(200,40,2)
cls
dim as integer x,y
screencontrol(13,x,y)
locate 5,5
print x,y
print cptr(ubyte ptr,@x)[2],cptr(ubyte ptr,@x)[1],cptr(ubyte ptr,@x)[0]
print cptr(ubyte ptr,@y)[2],cptr(ubyte ptr,@y)[1],cptr(ubyte ptr,@y)[0]
sleep
angros47
Posts: 2324
Joined: Jun 21, 2005 19:04

Re: The text and attribute pages in gfx mode ?

Post by angros47 »

No, there is not. I looked for that, too, when I was looking for a simple way to achieve text output in OpenGL mode (before I patched the graphic library, I hoped to implement a console mode similar to the one of Basic4Gl.... after implementing the complete rendering on OpenGL mode, I dropped that idea)

Also, text is not stored in linear way: each character, in fact, is made with a byte representing the character, and two color parameters. The structure is described in fb_gfx.h:

Code: Select all

typedef struct _GFX_CHAR_CELL {
    FB_WCHAR ch;
    unsigned fg, bg;
} GFX_CHAR_CELL;
It is used in the member "con_pages" inside the struct FBGFX, so if you want to edit the library to add a keyword that will work like ScreenPtr(), you should likely return a pointer to that.
Personally, I think it wouldn't be much useful, since you would still be able to read only one character at time (the format is completely different from a string, for example, so you can't just copy a sequence of bytes into a string and use it)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: The text and attribute pages in gfx mode ?

Post by D.J.Peters »

@angros47 thank you for the info.

joshy
Post Reply