pakt13

#include "cinder/app/AppBasic.h"
#include "cinder/cairo/Cairo.h"

using namespace ci;
using namespace ci::app;
using namespace std;

const int WIDTH= 640;
const int HEIGHT= 480;

class pakt13App : public AppBasic {
public:
void prepareSettings(Settings *settings);
void setup();
void draw();
int index, n;
float w, h;
float rows, cols;
cairo::Context ctx;
};

void pakt13App::prepareSettings(Settings *settings) {
settings->setWindowSize(WIDTH, HEIGHT);
settings->setResizable(false);
}

void pakt13App::setup() {
index= 0;
w= getWindowWidth();
h= getWindowHeight();
rows= 11.0f;
cols= 11.0f;
ctx= cairo::Context(cairo::createWindowSurface());
ctx.setFillRule(1);
}

void pakt13App::draw() {

cairo::GradientRadial radialGrad(getWindowCenter(), 0, getWindowCenter(), getWindowWidth());
radialGrad.addColorStop(0, Color(0.5, 0.6, 0.5));
radialGrad.addColorStop(1, Color(0, 0, 0));
ctx.setSource(radialGrad);
ctx.paint();

ctx.setSourceRgb(1, 1, 1);
for(int y= 0; y<=rows; y++) {
for(int x= 0; x<=cols; x++) {
ctx.rectangle(Rectf((x/rows*w)+(sin(index+(x*y))*(sin((index+x)*0.0015f)+sin((index+y)*0.0062)*10.0f)), (y/cols*h)+(cos(index+(x*y))*(sin((index+y)*0.0325f)+sin((index+y)*0.0072)*10.0f)), 4.0f, 4.0f));
}
}
ctx.fill();
index++;
}

CINDER_APP_BASIC(pakt13App, Renderer2d)