Author Topic: A simple..fast getpixel routine to select colors.  (Read 1903 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1645
  • Particle Hawk
    • View Profile
Use the image below the code to go with this.
Yes, DDGui has a color picker too, but it is used differently.
Here, CPColor Value# is the color you pick from an external image.
Code: (glbasic) [Select]
loadsprite "colorpicker420.png",0
TheColor:
IF init_color=FALSE; init_color=TRUE
LOCAL  mx,my,mb1,mb2
  CPColor=RGB(255,255,255)
   ENDIF

DRAWSPRITE 0,0,0 // draw pick color image

//grab a color
MOUSESTATE mx,my,mb1,mb2
IF mb1
CPColor=GETPIXEL(mx-1,my-1)
ENDIF

//show color selected box
DRAWRECT 500,100,100,100,RGB(255,255,255)
DRAWRECT 504,104,92,92,RGB(0,0,0)
DRAWRECT 504,104,92,92,CPColor


SHOWSCREEN
GOTO TheColor

[attachment deleted by admin]
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)