We have a project called “generative art”.
Our goal is to make a program, and that program creates something totally random that works as a form of art.
My idea was the following, and I wanted to base it around the subject ‘Gaming’.
I want to start off drawing a line, let’s say it moves over the Y-axis ( up an ddown) and starts with a certain color.
I want to record keyPressed/inputs from when you are gaming with some sort of KeyLogger, which regenerates a .txt file. Let processing read that .txt and assign certain stuff to that specific key. Basically, let the program follow the assigned variables while gaming. After a 10 minute session (or so), I can see what kind of “art” the program has created.
for instance :
Processing reads .txt file
if key == ‘w’, then make line thicker
if key == ‘a’, change color
and so on.
Then when Processing reads the .txt file, it will draw what has been given to it.
TekenLine drawing;
//String[] data;
String[] buttonLog;
//char[] keys = {'a','w','s','d'};
void setup() {
size(800, 800);
background(255);
//buttonLog = loadStrings("buttonLog.txt");
//data = split(buttonLog[0], ',');
drawing = new TekenLine();
}
void draw() {
drawing.drawLine();
drawing.moveLine();
drawing.bounceLine();
}
with the class:
Class TekenLine {
float x;
float y;
float lineWidth;
float lineHeight;
float xSnelheid;
float ySnelheid;
color lineColorR;
color lineColorG;
color lineColorB;
TekenLine() {
x = width/2;
y = width/2;
lineWidth = 10;
lineHeight = 10;
xSnelheid = 2;
ySnelheid = 2;
lineColorR = 0;
lineColorG = 0;
lineColorB = 0;
}
void drawLine() {
fill(lineColorR, lineColorG, lineColorB);
rect(x, y, lineWidth, lineHeight, 20);
}
void moveLine() {
x += xSnelheid;
}
void bounceLine() {
if (x >= width || x <= 0) {
xSnelheid = -xSnelheid;
}
if (y >= height || y <= 0) {
ySnelheid = -ySnelheid;
}
}
}
I used a certain code in PowerShell to track some keys. I generated a small .txt file that came up with the following input:
"dsdadadasdasdasdasdasdasdasaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and this is just of less than 10 seconds of button mashing/holding.
I know how to let the program fetch the .txt file, but not how to go further with setting up the keys. I believed someone mentioned that I had to make an Array, but no clue how to go further on that after a few attempts.
How could I tackle the following issue?