• Keine Ergebnisse gefunden

// Aufgabe05_b final int BREITE=750; final int HOEHE=400; final int MAX=9;

N/A
N/A
Protected

Academic year: 2021

Aktie "// Aufgabe05_b final int BREITE=750; final int HOEHE=400; final int MAX=9;"

Copied!
5
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)
(2)
(3)

// Aufgabe05_b

final int BREITE=750;

final int HOEHE=400;

final int MAX=9;

PImage[] images;

int[][] xyImages=new int [MAX][2]; // Array mit Bildern int index=-1; // welches Bild wurde "angeklickt"

int mouseXOld; // speichert die akt. Mauskoordinaten f. Verschieben int mouseYOld;

void setup() {

size(BREITE, HOEHE);

// lokale Variable, überdeckt die obere Variable

PImage [] images= new PImage [MAX];// erstellen der 9 PImage

// erstellen der Matrix

// Schleife mit: Laden der Bilder, setzen der Zufallskoordinaten for (int i=0; i<MAX; i++) {

images[i]= loadImage("Image"+(i+1)+".jpg"); xyImages[i][0]=(int) random(0,BREITE);

xyImages[i][1]=(int) random(0,HOEHE);

} }

void draw() { background(255);

for(int i=0;i<MAX;i++){

// error

println("index: "+i);

image(images[i], xyImages[i][0], xyImages[i][1]);

(4)

}

// nur eine Schleife mit der Anzeige der MAX-Bilder

}

void mousePressed() { int j;

println("Pressed: mouseX: "+mouseX+" mouseY:"+mouseY);

// Schleife übder alle Bilder

// Ueberpruefen, ob ein Bild angeklickt mittels der Methode checkImage // wenn gefunden, globale Variablen index, mouseXOld, mouseYOld setzen }

// komplett

void mouseDragged() {

println("Dragged: mouseX: "+mouseX+" mouseY:"+mouseY);

setNewCoords();

}

// fast komplett, es fehlt am Schluss eine Zeile void mouseReleased() {

println("Released: mouseX: "+mouseX+" mouseY:"+mouseY);

setNewCoords();

}

int checkImage(int x, int y) { return -1; // erst mal pro forma }

// komplett

void setNewCoords() {

(5)

if (index>=0) {

xyImages[index][0] += mouseX-mouseXOld;

xyImages[index][1] += mouseY-mouseYOld;

mouseXOld=mouseX;

mouseYOld=mouseY;

} }

Referenzen

ÄHNLICHE DOKUMENTE

The purpose of such categorization is the same as for the electrons: loose muons are input to the MVA that separates prompt leptons from non-prompt lepton; fakeable muons are used

These questions relate both to the Professional Development needs relating to International student programmes in the tertiary sector, and to issues relating to the mandatory Code

Wolfgang Prodinger, MME (Bern), Vice Rector for Teaching and Study Matters Approved by the Vice Rector for Teaching and Study Matters YES NO..

Wolfgang Prodinger, MME (Bern), Vice Rector for Teaching and Study Matters Approved by the Vice Rector for Teaching and Study Matters YES NO..

3 detailed qualitative illustrations of the diversity and range of experience and needs of those affected by the Troubles: contained in both exhibitions and in the

Du point de vue des fabricants, les préoccupations principales concernent la réduction des doses de rayons X et l’augmentation de puissance pour obtenir de meilleures

public static final class Memento { private final int state;. private Memento(int state) { this.state

Es wird keine Haftung übernommen für Schäden durch die Verwendung von Informationen aus diesem Online-Angebot oder durch das Fehlen von Informationen.. Dies gilt auch für