Stretch processing sketch to full screen resolution meanwhile it still remain the same pixel as well

edited July 2017 in Android Mode

I developing this game by using this resolution size(600, 800); and every code has been developed based on 600pixels x 800pixels. But then when I tried to scale it to fullScreen();, everything messed and goes wrong. Therefore, I'm seeking the solution of what if only stretch the game to fullscreen but still remain same(600, 800) sketch pixels.

1) 600pixels x 800pixel (develop based on this pixels) but after compiled apk and install to my android phone, it became smaller resolution: https://www.dropbox.com/s/f18bq75eamxar4k/non-fullscreen.jpg?dl=0

size(600, 800, P2D);

2)after I scale it to fullScreen(); it looked like this: https://www.dropbox.com/s/qltaescdo421u0z/fullscreen.jpg?dl=0

fullScreen();

PFont bitoem;
PImage birdImg, bgImg, obsImg, menuImg, startBtn;
int score = 0, highScore = 0, genestate = 1, x = -200, y, vy = 0,  wx[] = new int[2], wy[] = new int[2];

void setup() {

  fullScreen();
  //size(600, 800, P2D);

  //game images
  birdImg = loadImage("chosenBird_8Bit.png");
  bgImg = loadImage("background_color002(1680x800).jpg");
  obsImg = loadImage("obstacle_long.jpg");
  menuImg = loadImage("startMenu.jpg");
  startBtn = loadImage("startBtn.jpg");
  bitoem = loadFont("8BITWONDERNominal-48.vlw");

  //fonts style
  textFont(bitoem, 24);
  fill(255,255,255);
  textSize(28);

}

void draw() { //runs 60 times a second
  //background image loop
  if(genestate == 0) {
    //background(255,255,255);
    imageMode(CORNER);
    image(bgImg, x, 0);
    image(bgImg, x+bgImg.width, 0);

    x -= 3;
    vy += 1;
    y += vy;

    if(x == -1680) x=0;

    //generate obstacle imgs
    for(int i = 0; i < 2; i++){
      imageMode(CENTER);
      image(obsImg, wx[i], wy[i] - ((obsImg.height/2)+100));
      image(obsImg, wx[i], wy[i] + (obsImg.height/2+100));
      if(wx[i] < 0 ){
        wy[i] = (int)random(200,height -200);
        wx[i] = width;
      }

      //accumulative score
      if(wx[i] == width/2){
        //playerScore.play();
        //playerScore = minim.loadFile("sfx_point.wav");
        highScore = max(++score, highScore);
      }

      //bird image touch obstacle img, it will goes to genestate1
      if(y>height || y<0 || (abs(width/2-wx[i])<25 && abs(y-wy[i]) > 100))
      genestate=1;
      wx[i] -= 6;


    }

    image(birdImg, width/2, y, 46, 30.5);

    //calculate the score while middle pixel goes through the pipe
    text(""+score, width/2-15, 70);
  }

  else{
      imageMode(CENTER);
      image(menuImg, width/2, height/2);
      image(startBtn, width/2, 500); 
      text(highScore, 350, width/2-15);

   }
}

void mousePressed(){
  vy =- 17;


  if(genestate == 1){
    wx[0] = 600;
    wy[0] = y = height/2;
    wx[1] = 900;
    wy[1] = 600;
    x = genestate = score = 0;    
  }
}

Answers

Sign In or Register to comment.