Skip to content

“settings” bug #945

Closed as duplicate
Closed as duplicate
@Whiteeth-princess

Description

@Whiteeth-princess

Most appropriate sub-area of Processing 4?

PDE, Core/Environment/Rendering

Processing version

4.3.2

Operating system

Windows

Steps to reproduce this

reported:Duplicate method settings() in type test why?

snippet

// Paste your code below :)
PImage img;
int[][] tilesX, tilesY;
int tileSize = 50;

void settings() {
  size(displayWidth, displayHeight);
}

void setup() {
  smooth();
  img = loadImage("1.jpg");

  int cols = (int) ceil(displayWidth / (float) tileSize);
  int rows = (int) ceil(displayHeight / (float) tileSize);

  tilesX = new int[cols][rows];
  tilesY = new int[cols][rows];

  for (int i = 0; i < cols; i++) {
    for (int j = 0; j < rows; j++) {
      tilesX[i][j] = i * tileSize;
      tilesY[i][j] = j * tileSize;
    }
  }
}



void draw() {
  background(255);
  int mouseXTile = (int) floor(mouseX / (float) tileSize);
  int mouseYTile = (int) floor(mouseY / (float) tileSize);

  image(img, mouseXTile * tileSize, mouseYTile * tileSize,
    tileSize, tileSize,
    mouseXTile * tileSize, mouseYTile * tileSize,
    tileSize, tileSize);
}


### Additional context

_No response_

### Would you like to work on the issue?

yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions