Re: problems with colors

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Mon, 6 Mar 2000, [iso-8859-2] =A9koda wrote:

> problem no 1:
> can anyone tell me how can i display many different colors at the same
> time on the screen in euphoria dos program?

Your example was a bit confusing so I wrote a working example that
demonstrates using the 'palette' function (note that DOS Euphoria by
itself only supports graphics modes of up to 256 colors):


-- start palette demo code --
include graphics.e
include get.e

object mycolor, n
integer gm

-- need a graphics mode that supports 256 colors
if graphics_mode(19) then
  puts(1, "Need VGA graphics!\n" )
  abort(1)
end if

-- set Palette:
for i =3D 0 to 63 do
  -- color 0-63: shades of red
  mycolor =3D palette( i, {i,0,0} )
  -- color 64-127: shades of green
  mycolor =3D palette( i+64, {0,i,0} )
  -- color 128-191: shades of blue
  mycolor =3D palette( i+128, {0,0,i} )
  -- color 192-255: shades of white
  mycolor =3D palette( i+192, {i,i,i} )
end for

for i =3D 0 to 255 do
  draw_line( i, {{i,0}, {i,199}} )
end for

n =3D wait_key()

-- restore original graphics mode
graphics_mode(-1)

-- end palette demo --

-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu