Jump to content




[LUA] [question] How to set the background color only on a defined area ?


  • You cannot reply to this topic
5 replies to this topic

#1 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 24 November 2012 - 09:02 AM

Hi all !
Well it's almost self explanatory. What I want to do is a pop-up window with a special color background, red for error message for example. How do i do that please ? It's there a setColorBackground but with a area definition ? (For the pop-up itself I want to find myself, i know how to make it ;)/>)

#2 GopherAtl

  • Members
  • 888 posts

Posted 24 November 2012 - 09:10 AM

can't set color by area, you'll have to set the color before drawing your popup window, then redraw the area under it with the original colors when it closes.

#3 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 24 November 2012 - 09:13 AM

This is actually relatively easy. Just write spaces with the specified background color within bounds defined by a for loop

-- a blue box at 10, 10 with width 10 and height 10
term.setBackgroundColor(colors.blue)
for x=10, 20 do
  for y=10, 20 do
    write ' '
  end
end


#4 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 24 November 2012 - 09:18 AM

Thanks you all ! If I want to print something in the area I must fill up the void space with blank character or can I print blank everywhere then overwrite with the text i want to write?

#5 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 24 November 2012 - 09:19 AM

You could just print the blankness, then draw the text wherever you want. Not a problem.

#6 bjornir90

  • Members
  • 378 posts
  • LocationFrance

Posted 24 November 2012 - 09:23 AM

View PostKingdaro, on 24 November 2012 - 09:19 AM, said:

You could just print the blankness, then draw the text wherever you want. Not a problem.
Ok thanks you !





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users