Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Identifying colour attributes with negative numbers
#1
Something QB64 does just like QB45, and I like it.

I've got somebody in another forum wondering why anybody would ever want that.

I'm thinking why wouldn't you want the ability to cycle through colour attributes in either direction and be able to loop around to the other side when you reach an end?

I can't think off the top of my head how I would use it, but it instantly struck me as "that can be really frigging useful," especially when setting up custom palettes that have nice colour transitions through the circle of colours, regardless of direction.

Just bringing that up here in case folk were unaware of that, or in case anybody has a ready example in their back pocket, or in case anybody has thoughts one way of the other.
Reply
#2
Oops, I thought that was something that worked with anything related to colours.

That works for the colour attribute specified in PSET, but not with the COLOR statement.

Sample code:

Code: (Select All)
1 SCREEN 13
2 DEFINT A-Z
3 L = (L + 1) AND 255
4 PALETTE L, (255 - L) \ 4
5 IF L = 0 THEN GOTO 6 ELSE GOTO 3
6 FOR ix = 1 TO 399
7 FOR iy = 1 TO 199
8 PSET (ix, iy), ((ix - L) XOR (iy + L)) XOR ((ix + L) XOR (iy - L))
' in the PSET statement above, the formula for the colour parameter does return negative values
9 NEXT iy, ix
10 L = (L + 1) AND 255
11 IF INKEY$ <> "" THEN SCREEN 0 ELSE GOTO 6
Reply




Users browsing this thread: 1 Guest(s)