Pölygamy: a collection of LÖVE helper libraries

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Pölygamy: a collection of LÖVE helper libraries

Post by bartbes »

You won't lose the ability. (for now)
User avatar
pygy
Citizen
Posts: 98
Joined: Mon Jan 25, 2010 4:06 pm

Re: Pölygamy: a collection of LÖVE helper libraries

Post by pygy »

To run it, you must put the Polygamy folder wherever you want to, and

Code: Select all

require "path.to.Polygamy.init" 
It will create a global Polygamy object. From there, you can use it as described in the first post of this thread.

There were indeed stray files in the archive. I've uploaded a cleaned up version.

The next version, which I'm polishing right now[*], is more modular. The custom love.run is extracted as library and is optional for both the state and keyboard lib.

Actually, it is extremely similar to the normal love.run loop, except that you can insert, remove and switch callbacks at a predictable point in the loop, ensuring that all callbacks are consistent at any given time. Polygamy works without it, but it makes things more transparent and more efficient.

The next Polygamy is almost self contained.
  • the keyboard lib relies on the presence of the love.keypressed() and love.keyreleased() callbacks.
  • the state lib could relies only on love.update() and love.draw().
  • the upcoming timer lib relies on love.timer.getTime().
  • the upcoming soundtrack lib is a more invasive by design, but it only relies on love.sound.newSource, the presence of a metatable for source objects, source:getVolume and source:setVolume.
The libraries are completely independent, although there's an option to integrate the keyboard and the state library for convenience.

Edit: Refactoring done, the (upcoming) state library is love.run() agnostic.

[*] Lesson learned: never again will I let some half-refactored code rot for a few months.[/size]
Last edited by pygy on Wed Jul 21, 2010 9:48 am, edited 2 times in total.
Hermaphroditism is not a crime. -- LSB Superstar

All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: Pölygamy: a collection of LÖVE helper libraries

Post by bartoleo »

Very good
Thanks a lot
Bartoleo
TimFuchs
Prole
Posts: 1
Joined: Sat Jun 02, 2012 9:22 pm

Re: Pölygamy: a collection of LÖVE helper libraries

Post by TimFuchs »

Pölygamy 0.4.1 doesn't work with Löve 0.8.0
It is easy to fix, just do the following:

in init.lua:
  • replace handlers.q with handlers.quit
    add 'love.event.pump()' before 'for e,a,b,c in love.event.poll() do'
    replace 'a,b,c' with 'a,b,c,d in 'love.event.poll()' loop
    change '1' in love.timer.sleep( 1 ) to 0.001
    remove '..".lua"' from line 259 at 'require(Polygamy.path .."modules/" .. moduleIndex[module_] .. ".lua");'
in PolyKeyboard replace handlers.kp and handlers.kr with handlers.keypressed and handlers.keyreleased.

To make the example 'main.lua' work, also replace "love.event.push('q')" wint "love.event.push('quit')"

Hope that helps somebody
User avatar
pygy
Citizen
Posts: 98
Joined: Mon Jan 25, 2010 4:06 pm

Re: Pölygamy: a collection of LÖVE helper libraries

Post by pygy »

Wow!

Cool to know that someone is still using this :-)

I'll update the library, thanks for the report...
Hermaphroditism is not a crime. -- LSB Superstar

All code published with this account is licensed under the Romantic WTF public license unless otherwise stated.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests