+ 3
How to adapt images' size to Display size in Java ?
I'd like to code a game that runs fullscreen, but if the running display isn't 1080p 16x9, there are going to be errors. I've tried : PImage example; void setup() { example = loadImage("example.jpg"); fullScreen(); scale (displayWidth/1920, displayHeight/1080); } void draw() { image(example, 0, 0); } with the example image being 1920x1080, but when I've tried turning my screen into 1280x720 this didn't work. I'm a beginner. I code on Processing. Thanks for your help đ
10 Answers
+ 1
processing don't allow to set an image as background if is not the same size as the window,
but you could load an image in PImage and use the resize method , then set the PImage as background
search for the reference of the sintax of PImage and resize () in the processing foundation page
+ 2
Thank you very much dude đ I'll try it asap !
+ 2
@Pablo De Laforé There's no resize() method in the documentation, and when I type it it says "The function " resize() " does not exist"
I use Processing 3.3.4 which I think is the latest
+ 2
You're right, when I go to PImage's Doc there's resize() in the attached methods. You got the answer for everything that's unbelievable đ
GG and thank you for help !
+ 1
OK my bad idk what I've done đđ
+ 1
No problem đ
+ 1
Well I tried to go in my Doc and CTRL+F resize but it still doesn't work for some reason, so I'll fav your link đ
+ 1
probably because it's inside PImage class and not displayed in the main index reference
+ 1
haha not for everything but it's nice to be helpful