PDA

View Full Version : code



fravado
07-04-2008, 14:54
Hi all :)
Can someone give me the TBasic color codes for text pls ?
like: CONSOLE_FOREGROUND_RED etc.... i like to have all the color codes pls.
Also can anyone tell me what the following letters stand for:

ASM
GUI
RC
TBGL (with some explanation pls ?)

Bye & Thanks to all
Frank.

ErosOlmi
07-04-2008, 15:18
Frank,

in reality there are no equates (constants) for all colors. Only few equates are defined:

%Console_FOREGROUND_BLUE
%Console_FOREGROUND_GREEN
%Console_FOREGROUND_RED
%Console_BACKGROUND_BLUE
%Console_BACKGROUND_GREEN
%Console_BACKGROUND_RED
Maybe we can think about a console function that return the correct color code giving foreground and background pairs.

Regarding meaning of ASM, ...
ASM: assembler
GUI: graphical user interface. We refer to this acronym to indicate a script that implement a standard window with relevant message pump.
RC: resource code. usually text files used by compilers to indicate application resources like icons, bitmaps, program strings, ...
TBGL: it is a thinBasic module (thinBasic language extension) developed by Petr and implementing OpenGL 3D graphics.

Ciao
Eros

fravado
07-04-2008, 15:28
Thanks Eros for the codes.
Does this mean that we can only use this 3 colors in text ?
And what about 3D programming or grafics ,,, do they also have 3 colors ?
If i remember good, in AMIGA BASIC and QBASIC there were many colors and used them as:
Color (1,1) or other numbers depending the color you want. Is this also possible in TB ? :-\
Bye
Frank. :)

ErosOlmi
07-04-2008, 15:37
Frank,

Console applications are one thing. 3D programming another.

In Console script you can have all the 255 foreground colors supported by consoles scren with all 255 background colors available.
See examples in \thinBasic\SampleScripts\Console\ directory. In particular "Console_OutColor.tBasicc" script will show you all colors available.
Also have a look at "Console_OutPutSpeed.tbasic" script that will give you an idea of console output speed in thinBasic.
There are other interesting examples there working with Console.

In 3D programming it is all another matter.
Again, have a look at \thinBasic\SampleScripts\TBGL\ directory and you will find many basic scripts using TBGL module working on 3D
If you want more 3D scripts, go to thinBasic download web site at http://www.thinbasic.com/index.php?option=com_docman&Itemid=66
Than go to "thinBasic Bonus Packs" section and download "thinBasic TBGL Bonus Pack" ZIP file. It is a 10Mb full of 3D script examples both basic and advanced. You will have enought to study for more than 1 year ;)

Let me know.
Ciao
Eros

Petr Schreiber
07-04-2008, 16:12
Hi Frank,

in console you can get lot of color combinations, here is sample made to be usable like in old basics:


uses "Console"

' -- Old basic like color definition
BEGIN CONST
%cBlack = 0
%cBlue ' = 1
%cGreen ' = 2
%cCyan ' = 3 ... this all thinBASIC adds automatically for you
%cRed
%cMagenta
%cYellow
%cWhite

%cLightBlue = %cBlue or 8
%cLightGreen = %cGreen or 8
%cLightCyan = %cCyan or 8
%cLightRed = %cRed or 8
%cLightMagenta = %cMagenta or 8
%cLightYellow = %cYellow or 8
%cLightWhite = %cWhite or 8

END CONST

' -- Here we put something on the screen
SetColor(%cLightRed, %cLightWhite)
CONSOLE_PrintLine("Hi, I am ... line of text")
SetColor(%cBlack, %cLightYellow)
CONSOLE_PrintLine("Hi, I am ... too")

CONSOLE_WaitKey
STOP ' -- End program, optional here :)

' -- Auxiliary procedure

SUB SetColor( foreground AS BYTE, background AS BYTE )
SHIFT LEFT background, 4
CONSOLE_SetTextAttribute( foreground or background )
END SUB


In 3D graphics module, you can render colors in 16 bit ( ~65 000 colors ) or 24/32 bit precision ( 16 millions ).
It uses basic RGB component mechanism, just like the console but with more colors :)


Petr

fravado
07-04-2008, 17:23
Many thanks Petr for the color codes, this will help alot.
Thanks to you & Eros i am one step further in TB.
bye,
Frank.