lQuery

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

lQuery

Post by RPG » Wed Mar 02, 2011 5:26 am

lQuery (luaQuery or loveQuery) - tiny framework similar to jQuery in JavaScript.
Documentation: http://lquery.scriptumplus.ru
Downloads: https://github.com/scriptum/lQuery/downloads
Key features:
integrated scene graph manager - all objects merged into one, easy-to-manipulate scene graph.
entity-based - all in the game are entities: menu, widgets, objects, mouse, players. You can specify entity's behavior. Example:

Code: Select all

circle = Entity:new(screen)
:move(400,300)
:draw(function(s) --function that displays entity
    G.circle("fill", s.x, s.y, s.R, 2*s.R)
  end)

Code: Select all

mouse = Entity:new(screen):draw(function(s) --unusual type of entity: mouse cursor position, useful for demonstrations
    love.mouse.setPosition( s.x, s.y )
  end)
asynchronous programming - don't think about time, just write rules for the game
animate anything - small and powerful animation library, multi-queue animation. Example:

Code: Select all

circle:animate({x=100, y=100}) -- move circle from current position to 100, 100

Code: Select all

mouse:animate({x=100, y=100}) -- move mouse cursor from current position to 100, 100

Code: Select all

player:animate({health=100}) -- increase player's health (you can animate any parameter of the entity)
chain methods

Code: Select all

box = Entity:new():move(10,10):animate({x=100}):animate({y=100})
events - specify events for entities similar to JavaScript, multiple handlers per event

Code: Select all

circle:click(function() 
--some action here
end)
Animation queue See below
Small demonstration: animations, events (hover mouse on circle, click on circle)
Image

Repository:
http://github.com/scriptum/lQuery
Last edited by RPG on Sun Nov 06, 2011 1:55 pm, edited 8 times in total.

User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: lQuery

Post by TechnoCat » Wed Mar 02, 2011 6:24 am

Well, you are certainly chaining events like JQuery. That is for sure.

User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: lQuery

Post by BlackBulletIV » Wed Mar 02, 2011 7:38 am

Looks good. Method chaining looks cool.

Using entities is a good practice, I use the idea inside of my Grace framework (although inside of Worlds, with Layers and Tags as well).

Good luck!

User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

Re: lQuery

Post by RPG » Wed Mar 02, 2011 12:24 pm

BlackBulletIV wrote:Looks good. Method chaining looks cool.

Using entities is a good practice, I use the idea inside of my Grace framework (although inside of Worlds, with Layers and Tags as well).

Good luck!
Your work looks great, but... unfortunatly, Grace framework isn't working on my system (Linux). I think this is due to case-sensitive filesystem.

User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: lQuery

Post by BlackBulletIV » Wed Mar 02, 2011 8:55 pm

Mine would be a case-sensitive filesystem (I'm on a Mac) too. If you're grabbing the latest development version (up and coming alpha 5, in branch wrapper) it probably won't work. I haven't tested it in a while because of a huge paradigm shift in the code. But if you've got alpha 4, it should work without crashing on first try. Can you give me the error so I can know where the problem's coming from?

User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

Re: lQuery

Post by RPG » Wed Mar 02, 2011 10:45 pm

Code: Select all

bash-4.1$ love image/
Error: [string "main.lua"]:1: module '../../src.init' not found:
	no field package.preload['../../src.init']
	no file './//////src/init.lua'
	no file '/usr/share/lua/5.1///////src/init.lua'
	no file '/usr/share/lua/5.1///////src/init/init.lua'
	no file '/usr/lib/lua/5.1///////src/init.lua'
	no file '/usr/lib/lua/5.1///////src/init/init.lua'
	no file '/usr/share/lua/5.1///////src/init.lua'
	no file '/usr/share/lua/5.1///////src/init/init.lua'
	no file './//////src/init.so'
	no file '/usr/lib/lua/5.1///////src/init.so'
	no file '/usr/lib64/lua/5.1///////src/init.so'
	no file '/usr/lib/lua/5.1/loadall.so'
	no file './.so'
	no file '/usr/lib/lua/5.1/.so'
	no file '/usr/lib64/lua/5.1/.so'
	no file '/usr/lib/lua/5.1/loadall.so'
	no file "//////src/init" in LOVE game directories.

stack traceback:
	[C]: in function 'require'
	[string "main.lua"]:1: in main chunk
	[C]: in function 'require'
	[string "boot.lua"]:293: in function <[string "boot.lua"]:219>
	[C]: in function 'xpcall'
For all versions:)

User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: lQuery

Post by BlackBulletIV » Thu Mar 03, 2011 12:58 am

Oh yeah, those don't work because Lua converts the dots to slashes, therefore being unable to locate them. You can fix it by bringing the folders out of the tests/examples folder, to the top level, and changing the require to 'src.init'.

(BTW: The image test won't work unless you have some of the image processing code I wrote in the (rather old) image branch)

EDIT: 300 posts! Yay!

User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

Re: lQuery

Post by RPG » Thu Mar 03, 2011 2:38 am

BlackBulletIV wrote:You can fix it by bringing the folders out of the tests/examples folder, to the top level, and changing the require to 'src.init'.
I tried... another errors was there.

New in lQuery
Animation queue. Original feature for incredible animation effects. Animation frames in queue runs in sequence: when previous animation ends, playing next animation frame. If you want to play two different animations simultaneously, just put animation frames into separate queues and they will be independent.
Example:

Code: Select all

ball = Entity:new_circle()
:move(400,300)
:animate({x=30}, {speed=0.5,queue='x'})
:animate({x=500}, {speed=0.5,queue='x'})
:animate({y=30}, {speed=0.8,queue='y'})
:animate({y=500}, {speed=0.2,queue='y'}) --cool animation effect
See in action:
Attachments
cool_animation.love
(3.9 KiB) Downloaded 1046 times
Last edited by RPG on Tue Mar 29, 2011 6:38 am, edited 1 time in total.

User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: lQuery

Post by BlackBulletIV » Thu Mar 03, 2011 3:24 am

RPG wrote:
BlackBulletIV wrote:You can fix it by bringing the folders out of the tests/examples folder, to the top level, and changing the require to 'src.init'.
I tried... another errors was there.
Well, um, could you say what they are? As said, if you're trying the image test, it won't work unless you have the image processing code.

User avatar
RPG
Party member
Posts: 157
Joined: Wed Mar 02, 2011 5:02 am
Location: Russia
Contact:

Re: lQuery

Post by RPG » Thu Mar 03, 2011 7:12 am

Code: Select all

bash-4.1$ love physics/
Error: Syntax error: [string "src/data/Vector2.lua"]:27: 'then' expected near 'return'

stack traceback:
	[C]: ?
	[C]: in function 'require'
	[string "src/data/init.lua"]:4: in main chunk
	[C]: in function 'require'
	[string "src/init.lua"]:19: in main chunk
	[C]: in function 'require'
	[string "main.lua"]:1: in main chunk
	[C]: in function 'require'
	[string "boot.lua"]:293: in function <[string "boot.lua"]:219>
	[C]: in function 'xpcall'

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests