ochres: HSL palette composer

Showcase your libraries, tools and other projects that help your fellow love users.
spir
Citizen
Posts: 76
Joined: Wed Oct 17, 2012 1:12 pm

Re: ochres: HSL palette composer

Post by spir »

Larsii30 wrote:Looks intresting.
One thing I would like to have was to just hold the left mouse button instead of click everytime to change the settings. ( slider ).
Oh, do you mean sliding the scale by moving up/down the mouse with left button held down (like drag & drop)? If yes, it could be done but a bit costly: all 3 scales (vertical gradual color boxes) must be recomputed every the main color is changed, you see? Each one shows the whole range of one of the h,s,l components for the present value of the other 2 components. So, if you slide one scale with the mouse, then as long as the button is held down and changes the color the program would constantly have to recompute all 3 scales. Or maybe, I could use a timer or counter to do it only every n ms or n frames... What do you think?
Also: is it worth it?

PS: What do you think of the present way to adjust colors (with click for gross setting and arrow keys for finer adjustment)? And, is the help text good enough?

PPS: Has anyone had a look at the code?

Denis
... la vita e estrany ...
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: ochres: HSL palette composer

Post by Nixola »

It doesn't find the help file here, Windows 7 both x86 and x64
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
spir
Citizen
Posts: 76
Joined: Wed Oct 17, 2012 1:12 pm

Re: ochres: HSL palette composer

Post by spir »

Nixola wrote:It doesn't find the help file here, Windows 7 both x86 and x64
Hum, weird... The help file (called just 'help', it's plain text) is well included in the .love (just checked). Would you verify it's there, by you?

Else, the code to read & write it is simplistic:

Code: Select all

composer.write_help_text = function (composer)
   local msg = "Sorry, no help text file found..."
   local text
   
   -- Try and get help text from help file.
   local f = io.open("help", 'r')
   if f then
      text = f:read("*all")
      f:close()
   else
      text = msg
   end
   
   -- Write it on blank screen due to mode "help":
   graf.setColor(BLACK)
   graf.print(text, 15,15)
end
If you like, just add a pair of lines to print out the file handle 'f' after, after the attempt to open:

Code: Select all

print("file handle:", f)
graf.print("file handle: " .. tostring(f), 0,0)
(The second line because I don't know about the terminal on Wondows.)

Thanks,
Denis
... la vita e estrany ...
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: ochres: HSL palette composer

Post by Nixola »

Try using love.filesystem instead of the io Lua module:
love.filesystem.read
love.filesystem.exists
love.filesystem
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
spir
Citizen
Posts: 76
Joined: Wed Oct 17, 2012 1:12 pm

Re: ochres: HSL palette composer

Post by spir »

Nixola wrote:Try using love.filesystem instead of the io Lua module:
love.filesystem.read
love.filesystem.exists
love.filesystem
Right, thank you for the tip.
(May I ask why? what's wrong with Lua io?)
... la vita e estrany ...
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: ochres: HSL palette composer

Post by Robin »

spir wrote:(May I ask why? what's wrong with Lua io?)
Lua io.* can't deal with .loves or merged executables and it doesn't know how to find the save dir, making it pretty much completely useless for LÖVE games. On top of that, SELÖVE disables the io.* functions. ;)
Help us help you: attach a .love.
spir
Citizen
Posts: 76
Joined: Wed Oct 17, 2012 1:12 pm

Re: ochres: HSL palette composer

Post by spir »

Robin wrote:
spir wrote:(May I ask why? what's wrong with Lua io?)
Lua io.* can't deal with .loves or merged executables and it doesn't know how to find the save dir, making it pretty much completely useless for LÖVE games. On top of that, SELÖVE disables the io.* functions. ;)
Thank you, Robin, pretty clear :)
[I really have much to learn... great! lövely!]

Denis
... la vita e estrany ...
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests