1. An example of how to get palette colours returned.
- Posted by David Alan Gay <moggie at INTERLOG.COM> Feb 15, 1997
- 1143 views
Here you go, Vic. One Euphoria program that demonstrates how to get the RGB values of a passed colour. include \euphoria\include\graphics.e function get_palette_colours(atom colour) object original_palette integer Red_, Green_, Blue_ Red_ = 0 Green_ = 0 Blue_ = 0 -- set colour received to all zeroes, causing the original RGB colours to be stored in a -- object original_palette = palette(colour, {Red_, Green_, Blue_}) -- extract colours into individual variables Red_ = original_palette[1] Green_ = original_palette[2] Blue_ = original_palette[3] -- reset colour received back to original value using palette saved from previous palette() original_palette = palette(colour, original_palette) -- Tah-da! The colours are returned for the specified palette. return {Red_, Green_, Blue_} end function -- Example code object returned_RGB if graphics_mode(18) then puts(1, "Mode Set Failure") abort(1) end if returned_RGB = get_palette_colours(YELLOW) if graphics_mode(-1) then puts(1, "Mode Set Failure") abort(2) end if print(1,returned_RGB) puts(1,'\n')
2. Re: An example of how to get palette colours returned.
- Posted by Vic <cybrgod at IBM.NET> Feb 15, 1997
- 1136 views
Hi David, The code works! Thanks alot... What I'm trying to so is write a bunch of fade scripts and the starfield effect and other neat stuff and...the code was really needed. Thanks again, /ViC./ ______________________________________________________________________ | http://www.geocities.com/SiliconValley/Heights/8858/home.htm | | Veni vidi, vici. Fiat lux. | |______________________________________________________________________|
3. Re: An example of how to get palette colours returned.
- Posted by David Alan Gay <moggie at INTERLOG.COM> Feb 15, 1997
- 1135 views
- Last edited Feb 16, 1997
> Hi David, > The code works! Thanks alot... > What I'm trying to so is write a bunch of fade scripts and the starfield > effect and other neat stuff and...the code was really needed. > Thanks again, > /ViC./ You're welcome. Glad I could help. Is this for a game you are writing in Euphoria? :) David Gay http://www.interlog.com/~moggie/Euphoria "A Beginner's Guide To Euphoria"
4. Re: An example of how to get palette colours returned.
- Posted by Vic <cybrgod at IBM.NET> Feb 16, 1997
- 1159 views
>Is this for a game you are writing in Euphoria? :) > >David Gay >http://www.interlog.com/~moggie/Euphoria >"A Beginner's Guide To Euphoria" I will try :) /ViC./ ______________________________________________________________________ | http://www.geocities.com/SiliconValley/Heights/8858/home.htm | | Veni vidi, vici. Fiat lux. | |______________________________________________________________________|