GetRGB

Post your coding questions such as 'how to' here.
Post Reply
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

GetRGB

Post by coolw »

How do I use

Code: Select all

GetRGB(value, component)
?
I assume it can get each R,G,B value, but how do I use it?
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
otto90x
Advanced Member
Posts: 349
Joined: Mon Aug 27, 2007 9:00 pm
Location: Lapinjärvi, Finland
Contact:

Re: GetRGB

Post by otto90x »

I think that example is faulty, so i might as well give you working one:

Code: Select all

Repeat
    Color 255,0,255
    Color 128,255,0
    r=GetRGB(RED)
    g=GetRGB(GREEN)
    b=GetRGB(BLUE)
    Text 0,0,r+" "+g+" "+b
    Drawscreen
Forever
RED GREEN and BLUE are constants and their values are 1, 2 and 3. So if you want you can replace them with corresponding numbers.

Keep in mind that it returns only current color components.
Otto Martikainen a.k.a. MetalRain, otto90x, kAATOSade.
Runoblogi, vuodatusta ja sekoiluja.
User avatar
valscion
Moderator
Moderator
Posts: 1599
Joined: Thu Dec 06, 2007 7:46 pm
Location: Espoo
Contact:

Re: GetRGB

Post by valscion »

This code is very efficient when you want to store the color before you make any changes to it and restore it back later, for example in some functions.
cbEnchanted, uudelleenkirjoitettu runtime. Uusin versio: 0.4.1 — Nyt myös sorsat GitHubissa!
NetMatch - se kunnon nettimättö-deathmatch! Avoimella lähdekoodilla varustettu
vesalaakso.com
coolw
Newcomer
Posts: 39
Joined: Wed Aug 29, 2007 11:17 pm
Location: West Virginia
Contact:

Re: GetRGB

Post by coolw »

otto90x wrote:I think that example is faulty, so i might as well give you working one:

Code: Select all

Repeat
    Color 255,0,255
    Color 128,255,0
    r=GetRGB(RED)
    g=GetRGB(GREEN)
    b=GetRGB(BLUE)
    Text 0,0,r+" "+g+" "+b
    Drawscreen
Forever
RED GREEN and BLUE are constants and their values are 1, 2 and 3. So if you want you can replace them with corresponding numbers.

Keep in mind that it returns only current color components.
Thanks, worked like a charm :D
My car game! (WIP)
viewtopic.php?f=18&t=53

Code: Select all

Coolw is the best! :)
Post Reply