Brief description
Entities
lQuery - framework, which manages entities. Entity - any logically or physically object in the game: mouse, sprite, player, timer, menu and so on. All entities are merged into a tree: each entity has parent and some entities have childs. Parent of all entities - logical entity named "screen".
Graphically, this can be represented as follows:
Such a structure makes it easy to quickly switch contexts in your game: objects can hide and show, all child elements will also hide. From our example (image above), if you hide entity "board", then all players also disappear. Hidden entities doesn't display and doesn't handle events.
Events
lQuery has its own event system, similar to JavaScript's events. Forget about love.update, love.draw and so on, just write game logic.
lQuery supports these events:
- click - fires when player clicks on entity
- mouseover - fires when player moves mouse over entity
- mouseout - fires when mouse leaves entity
- mousepress - fires when mouse button is pressed
- mouserelease - fires when mouse button is released
- mousewheel - fires when mouse wheel rotates over entity
- mousemove - fires when mouse moves over entity. Unlike mouseover, this event fires every frame, until mouse leaves entity, and mouseover fires only one time
- keypress - fires when keyboard key pressed
- keyrelease - fires when key released
- keyrepeat - similar to keypressed, but this event repeats frequently while key is pressed
- update - event, that fires when any parameter of entity is changed (for example, when changed "x" coordinate)
Example:
Code: Select all
player:click(function(x,y,button)
--do something here
end)
This is the key feature of lQuery: you can create smooth transitions for any numberic parameter of entity. lQuery provides very powerful, extensible animation system. Example:
Code: Select all
player:animate({x = 500, y = 300}, {speed = 0.7, queue = "move"})
:animate({r = 255, g = 255, b = 0, a = 127},
{queue = "color", speed = 1, easing = "linear", callback = function() print('Animation done!') end})
new
set
move
scale
size
radius
rotate
color
hide
show
toggle
append
animate
delay
stop
bound
draw
draggable
lQuery.addhook
lQuery.fx
Objects
Useful objects with pre-defined boundary functions.
circle
image
border_image
point
Platform-independent
lQuery may works not only with LOVE, but with any LUA engine (for example, Scrupp)
DOWNLOAD lQuery:
https://github.com/downloads/scriptum/l ... pha.tar.gz
In this archive you'll find many examples.
Repository:
https://github.com/scriptum/lQuery
Documentation:
http://lquery.scriptumplus.ru/