vendredi 27 mars 2015

Load image in separate file and draw in main. Processing 2.0

I'm trying to load the image in a separate class and draw it in the main draw function. I get such an error:


The method image(PImage, float, float) in the type PApplet is not applicable for the arguments (main.image, int, int)


Here is the Image class code:



class Image{

PImage img;

Image(){
img = new PImage();
img = loadImage("test.jpg"); }

}


And here is the main file:



Image img;

void setup(){
img = new Image(this);
}

void draw(){
image(img, 0, 0);
}


Can anyone help please?


Aucun commentaire:

Enregistrer un commentaire