Qbasicnews.com

Full Version: Change palette
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How do i change the palette on screen 12, i want to choose my own colours, if that is possible
i believe the OUT "hack" should be able to do it.

i'll see if i can remember it:
Code:
OUT &h3a9, col_id%
OUT &h3a8, r%
OUT &h3a8, b%
OUT &h3a8, g%

that code may be completely wrong, though

sorry - can't find a copy of the actual code

oz~
The ports are a bit wrong...

Code:
Out &H3C8, col_id
Out &H3C9, red
Out &H3C9, green
Out &H3C9, blue
Port &H3C8 is auto-incrementing.
Quote:The ports are a bit wrong...

Code:
Out &H3C8, col_id
Out &H3C9, red
Out &H3C9, green
Out &H3C9, blue
Port &H3C8 is auto-incrementing.

thanks for the correction

oz~
If you were using fb could'nt you use the RGB(r,g,b) command
Hi,

There is a PALETTE statement in QBASIC (and Quick BASIC) .

c = blue * 65536 + green * 256 + red
PALETTE 15, c

blue, green and red are numbers in the range of 0 to 63 inclusive.

The 15 is just the color of the default printing etc. and is usually bright white. It can be any of the 16 (0 - 15) colors available in screen 12.
Isn't the default printing color 7?
Hi,

Try this.

SCREEN 12
PRINT "this is a test"
LINE (100, 100)-(300, 300), , BF
SLEEP
FOR x = 0 TO 63
c = x * 65536 + x * 256 + x
PALETTE 15, c
t = TIMER
WHILE TIMER - t < .1
WEND
NEXT
I have tried the above examples but i cannot get them to work when i use &H3C9 i can only change the border.

I will try and give you an idea of what i want

in the program the user can pick a colour from the list, but i do not want to use the default colours, i want to make my own and show them on screen.
You mean you don't want to use the colors 0 to 15?
That's impossible in screen 12 because of the size of the
screen memory or something like that.

If you "need" more than 16 colors I would suggest that you either
get some vesa routines (through a library like future library, or by
executing some asm code manually) or continue the developing in
freebasic, which supports hi-res graphics natively.
Pages: 1 2