Using LOVE2d for an art application.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Using LOVE2d for an art application.

Post by Muzz »

Hi guys!

So i've been messing with LOVE2d, after i decided i wanted something a bit nicer to play with than MOAI. I was just messing around with LOVEframes, and started making a program that i've had on my mind for a long time to test it out, and got kind of carried away and now people are waiting on me to release this thing to the world.

Now i only know how to program in LUA and usually what you know how to use now is usually a pretty good option to make things, but because LOVE is a game engine and not aimed at making art programs, despite it being able to do everything i need internally, it seems to miss some of the core features i need, which is pretty much just being able to load and export images with the clipboard, and save images via the default windows save dialog.

So just a few questions.

I get that i would need to modify the source do to this, but is it something that is going to be possible for me to implement? I see that copying text to the clipboard is implemented, how much harder would images be? I will need to raise the programs permissions to save in places that are not %APPDATA% correct?

Btw this is what the app looks like.
Image

More stuff here. http://polykarbonbbs.com/showthread.php ... post426145

If i'm a complete idiot trying to use a hammer to drive in a screw, i'd also really like to know. Thanks guys!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Using LOVE2d for an art application.

Post by Nixola »

I strongly believe that you could use LuaJIT's FFI to include C libs and call C functions that would allow you to do this (both bringing up the default OS saving dialog and putting/getting images in clipboard), but you'd need platform specific code I think.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

Oh interesting!

It's fine if i need platform specific code, It's better than diving headfirst into learning C++ to use qt!

I'll look into it and try it out. Thanks so much!
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

Ok so i got text loading via clipboard working via FFI. (yes i know this is already in the love functionality)

Now to try and export an image.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

So looking more into this.

Am i right in thinking that Winapi has all the functionality i would need? Does that mean that i can drop a Winapi .dll into the same folder as love.exe and get this functionality?
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

OK!

So i got this version of WINAPI working.
https://luapower.com/winapi

Sadly the original version of WINAPI doesn't match this version so i'm having to work out things reading through the source. Which is always fun.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

OK!

So i wasted way too much time not realizing that the luapower winapi library is completly different than the steve donovan dll one. The second one is what i wanted, and it's all working.

So now i have a specific problem that i don't know how to handle.

How would i save a file that isn't just a simple .txt file using the .dll.

So for example is it possible to grab that userdata that is the screenshot and save it using the winapi commands?

Code: Select all

  screenshot = love.graphics.newScreenshot( )
  
  require 'winapi'
  local U = winapi.uexpand
  local encode = winapi.encode
  local UTF8 = winapi.CP_UTF8

  --winapi.set_encoding(UTF8)

  local short = winapi.short_path
  local name = short 'OMG.txt'
  os.remove(name)
  print(name)
  local f,err = io.open(name,'w')
  if not f then return print(err) end
  f:write 'a new file\n'
  f:close()
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Using LOVE2d for an art application.

Post by veethree »

The 7th guideline doesn't mention quintuple posting specifically, but i'm sure it's implied. In the future try adding to your reply using the edit button instead of posting a new one.
Muzz
Citizen
Posts: 54
Joined: Sun Jun 28, 2015 1:24 pm

Re: Using LOVE2d for an art application.

Post by Muzz »

Haha, to be fair it was a at least 2 hours between every post >_>.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Using LOVE2d for an art application.

Post by davisdude »

I don't know if that qualifies as
vrld wrote:an appropriate amount of time.
:rofl:
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], YaCy [Bot] and 0 guests