Hi!
After many tries to make a sofisticated game library for
Processing, I' ve decided to make something simplest.
So, here is
GALI (a games library template for Processing).
It consists of many
Tabs which you' ll have to add to your sketch depending on what you want to achieve.
The library is not fully complete, and I hope this comunity will help improving it
http://nicolas.atek.perso.sfr.fr/processing/template/appletThere is no help file atm, I wil add brieve description of each command to the sources.
gNode and
gali Tabs are mandatory. The
gKey Tab add easy keyboard functions.
Each sketch needs at least gNode and gali Tabs and must looks like this:
Code:import processing.opengl.*;
GALI gali;
void setup() {
size(400, 400, OPENGL); // GALI only works with openGl
gali = new GALI(); // Library initialisation
}
void draw() {
background(0);
gali.render(); // Render nodes(images, text, canvas, ...)
}
How to add an image:
Code:import processing.opengl.*;
GALI gali;
gImage myImage;
gNode myImageNode;
void setup() {
size(400, 400, OPENGL); // GALI only works with openGl
gali = new GALI(); // Library initialisation
// Load an image and add it to a new node
myImage = gali.newImage("url of your image");
myImageNode = gali.addNode(myImage, 200, 200);
}
void draw() {
background(0);
gali.render(); // Render nodes(images, text, canvas, ...)
}
Now you can manipulate myImageNode with methods like:- myImageNode.setPos(x, y);
- myImageNode.setScale(scale);
- myImageNode.turn(amount);
- ...
Or by modifying some properties:- myImageNode.blend = true;
- myImageNode.z = -1;
- myImageNode.alpha = 0.5;
- ...
You can also add an empty node and parent your myImageNode to it.
Adding a text node is so simple:- myTextNode = gali.addNode(PFont processingFont, "put your text here", 50, 50);
- myTextNode = gali.addNode("put your text here", 50, 50); // will use the default Courrier font
gCanvas type will let you create and access a JAVA2D graphics buffer with the ability to define a grid for realtime manipulations.
Feel free to modify and send links of your templates and or demos.
Questions? Help? Ideas for optimisations or improvements? -> use this topic