Closed xen-osd closed 1 year ago
It is particularly noticeable in the panda's eyes
I tried this out as an experiment by using a method where, if the sprite was smaller than the "bounding box" that characters are drawn to, it uses nearest-neighbor, else it uses bilinear:
// determine whether to use NN or bilinear scaling based on
// whether the character sprite fits into the bounding box or not
int greater_axis = fmax(char_crop.w, char_crop.h);
if (greater_axis < char_coords.w) {
SDL_SetTextureScaleMode(char_texture, SDL_ScaleModeNearest);
} else {
SDL_SetTextureScaleMode(char_texture, SDL_ScaleModeLinear);
}
I wasn't really fond of the resulting look though (the game doesn't use integer scaling for this, so you get inconsistent pixel sizes and it just looks weird regardless):
Perhaps this is something that could be added as an option instead, so the user can decide based on whatever looks better to them.
Another option is that rather than an option per game, it could be an option per level?
Yeah, this would probably make more sense as something per-level. I'm of perhaps adding a header to character.json
to allow for this to be set there:
{"scale_mode": "nearest"}
{"scale_mode": "bilinear"}
Since level.json
and now tile.json
have one, it'd only make sense character.json has one too.
The above header and scale_mode
parameter have now been implemented!
The parameters are named linear
and nearest
. Defaults to linear
.
Still isn't scaled with integer scaling in nearest
at the moment, but it should be good enough for now hopefully! <3