I have a universitiy assignment, with the following things to achieve:
- draw circles and lines into texture
- split the texture into 10*10 parts
- translate and move them
- move the camera
I managed to draw into texture, split them into different parts but I could not make the camera move. If I assing any other value than the standard camera, the whole bunch of quads dissapear. I checked many examples, none of them worked...
Any help is greatly appreciated, and please note that this is my first processing project, though I have some experience in java.
Here is the code:
final int windowSize = 600;
final int boardSize = 200;
int boardStart = (windowSize/2) - (boardSize/2);
int boardEnd = (windowSize/2) + (boardSize/2);
int ellipseWidth = 20;
int ellipseHeight = 20;
Ellipse tempEllipse;
Line tempLine;
int startX;
int startY;
boolean startedEllipse = false;
boolean startedLine = false;
boolean justDraw = true;
CircleButton btn1;
LineButton btn2;
color currentcolor;
color pressedColor;
color baseColor;
float meret = 10;
float moveX = 0;
float moveY = 0;
float Xrotate = 0;
if(startedEllipse){
ellipse(startX, startY, (mouseX-startX)*2, (mouseX-startX)*2);
}
if(startedLine){
stroke(155, 70, 25);
line(startX, startY, mouseX, mouseY);
}
} else {// this is where I want the movement and the camera to take place
camera(width/2+moveX, height/2, (height/2) / tan(PI*60.0 / 360.0), width/2.0, height/2.0, 0, 0, 1, 0);
class CircleButton extends Button
{
CircleButton(int ix, int iy, int isize, color icolor, color ihighlight)
{
x = ix;
y = iy;
size = isize;
basecolor = icolor;
highlightcolor = ihighlight;
currentcolor = basecolor;
}
class LineButton extends Button
{
LineButton(int ix, int iy, int isize, color icolor, color ihighlight)
{
x = ix;
y = iy;
size = isize;
basecolor = icolor;
highlightcolor = ihighlight;
currentcolor = basecolor;
}
class Ellipse{
int x;
int y;
float a;
float b;
public Ellipse(int x, int y, int width, int height) {
this.x = x;
this.y = y;
a = width/2.0;
b = height/2.0;
}
float getX(){
return this.x;
}