#Unblur rendering in javaFX (rescaling snes base resolution)

1 messages · Page 1 of 1 (latest)

drowsy brook
#

Hello ! I'm new at programmin in java and i need help for a school project. I need to make the bases of a game, and i wanted to recreate the legend of zelda a link to the past, wich is a SNES game, with a base resolution of 256x224, so all my sprites and tiles are in this format (tile is in 16x16 and sprite in 16x24) but when i rescale it, it become blurry. Is there a solution to let the rendering still with apparent pixels ?

I can post my code if needed !

leaden tartanBOT
#

<@&987246487241105418> please have a look, thanks.

drowsy brook
toxic skiff
#

it will be blurry

drowsy brook
#

no possibility to keep big pixels ?

toxic skiff
#

because javafx needs to add pixels which don't exist

toxic skiff
drowsy brook
vast magnet
#

but wouldnt it be possible if you scale by 2x on both axis that it will not be blurry, because you could just give stuff that originally needs 1 pixel, just 2 pixel with the same color?

drowsy brook
toxic skiff
#

let me know if it works

toxic skiff
drowsy brook
vast magnet
#

thats guessing, also which javafx element are you using for the sprite

#

you using canvas?

drowsy brook
#

i am using images but if you have a better solution it would be great !

#

I am still new to java and it's my first project, so I am kind of following a tutorial on Youtube, and I admit i don't understand everything

drowsy brook
toxic skiff
vast magnet
#

so it would be helpful sharing your current setup

drowsy brook
#

Here is how i'm handling the player sprites at this time (I still have some issues) public void getPlayerImage()
{
try {
up1 = new Image("file:res/player/U1.png");
up2 = new Image("file:res/player/U2.png");
down1 = new Image("file:res/player/D1.png");
down2 = new Image("file:res/player/D2.png");
left1 = new Image("file:res/player/R1.png");
left2 = new Image("file:res/player/R2.png");
right1 = new Image("file:res/player/R1.png");
right2 = new Image("file:res/player/R2.png");
} catch (Exception e) {
e.printStackTrace();
}
}

toxic skiff
drowsy brook
#

Oh yess !!

#

sorry

#

missunderstood

vast magnet
#

probably just using Pane with absolute positioning

toxic skiff
drowsy brook
#

I am using public class GamePanel extends Canvas {

vast magnet
#

ah ok

#

thats basically using a canvas

toxic skiff
#

you shouldn't extend it, but ok

drowsy brook
#

Is there a way to share my code ?

vast magnet
#

just post the files here

#

our bot going to upload them automatically

vast magnet
#

for everyone to easily view

drowsy brook
leaden tartanBOT
vast magnet
#

each canvas got a graphics context, you can get it using Canvas#getGraphicsContext2D

#

there you store it as gc variable

#

call the setImageSmoothing method on it

drowsy brook
#

oh yess i see it !

#

so i replace it with gc = GraphicsContext2D#setImageSmoothing(false); ?

toxic skiff
toxic skiff
#

you just call gc.setImageSmoothing(false)

drowsy brook
#

OHHHH THANKS A LOT

drowsy brook
toxic skiff
vast magnet
#

gc is kinda a reserved abbreviation for garbage collector in the context of java/programming

drowsy brook
#

Okay ! thank you very much for your help !

#

I have a lot of issues in my project, i may need your help in the future haha ^^ sorry for the disturbance

vast magnet
#

all good

drowsy brook
#

I admit java is quite of complicated for me so I do not understand everything, but I hope I will someday !

#

Also ! I have an issue with my character sprite

drowsy brook
drowsy brook
toxic skiff
#

freepascal Thinkfused

drowsy brook
toxic skiff
#

I mean

#

I have heard of pascal

#

but freepascal

#

Also I never tho that some school would teach pascal lol

drowsy brook
drowsy brook
#

yeah strange i know

#

I have an issue with the sprites, the tiles are 16x16 pixels but the character is 16x24, so the character is strecht to the size of tile and i don't know how to fix it

#

I can upload the file handling it

toxic skiff
drowsy brook