[HELP] Making a Save button

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: [HELP] Making a Save button

Post by nice »

Positive07 wrote:Save to the save directory... that is your best choice.

Then place other button that says something like "Open containing folder..." and when ever it is pressed trigger the command slime posted before
I had a thought about this, is it too complicated (or impossible) to tell the program that save the image and then open the "containing folder"?

If anyone else has a suggestion, I'm open for it.
:awesome: Have a good day! :ultraglee:
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [HELP] Making a Save button

Post by Robin »

You mean a single button that both saves the image and opens the containing folder? That's neither complicated nor impossible.
Help us help you: attach a .love.
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: [HELP] Making a Save button

Post by nice »

Robin wrote:You mean a single button that both saves the image and opens the containing folder? That's neither complicated nor impossible.
Pretty much, When I'm pleased with the image I press the save button and I want it to open up the containing folder.
Do you have an example how that could be done?
:awesome: Have a good day! :ultraglee:
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: [HELP] Making a Save button

Post by undef »

nice wrote:
Robin wrote:You mean a single button that both saves the image and opens the containing folder? That's neither complicated nor impossible.
Pretty much, When I'm pleased with the image I press the save button and I want it to open up the containing folder.
Do you have an example how that could be done?

Code: Select all

function saveButton()
    saveImage( IMAGENAME )
    openFolder()
end
You just call a function that saves your image and then opens the folder.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: [HELP] Making a Save button

Post by nice »

undef wrote:

Code: Select all

function saveButton()
    saveImage( IMAGENAME )
    openFolder()
end
You just call a function that saves your image and then opens the folder.
So I'll need to put that part of the code inside of a clicking function (in this case the save icon) for it to work?
:awesome: Have a good day! :ultraglee:
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: [HELP] Making a Save button

Post by zorg »

Or just call those two from within the clicking function...
that can be as easy as using the love.mousepressed callback, and some math to figure out whether you clicked on your button or not.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: [HELP] Making a Save button

Post by nice »

zorg wrote:Or just call those two from within the clicking function...
that can be as easy as using the love.mousepressed callback, and some math to figure out whether you clicked on your button or not.
Could you please elaborate? The first thing I start to think about is true or false statements (as it seem logical to me) and I have a hunch it might sound like this:
If love.mousepressed false then don't do anything
but
if love.mousepressed true then save image and open container folder
Like I said it's the first thing that pops up in my head..
:awesome: Have a good day! :ultraglee:
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

Re: [HELP] Making a Save button

Post by undef »

Did you try what you've suggested?

Code like "if false then end" doesn't do anything, so it can be omited.
Otherwise you're right, but you will have to check whether the mouse is above your button when you click.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
nice
Party member
Posts: 191
Joined: Sun Sep 15, 2013 12:17 am
Location: Sweden

Re: [HELP] Making a Save button

Post by nice »

undef wrote:Did you try what you've suggested?

Code like "if false then end" doesn't do anything, so it can be omited.
Otherwise you're right, but you will have to check whether the mouse is above your button when you click.
Well I haven't tried anything yet, it's because it's late where I currently live and I'm tired too but I will give it a try tomorrow.
:awesome: Have a good day! :ultraglee:
User avatar
DaedalusYoung
Party member
Posts: 407
Joined: Sun Jul 14, 2013 8:04 pm

Re: [HELP] Making a Save button

Post by DaedalusYoung »

No, love.mousepressed is a callback function. LÖVE calls it automatically when the mouse is pressed, it is your job to write the function.

If you wanted to do it the way you described, you could do it with love.mouse.isDown, but that would trigger every frame, as long as you keep the mouse pressed. You'd need to add additional checks for this, and it isn't really intended to be used like this.
Post Reply

Who is online

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