mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-25 20:48:29 +00:00
Added SDL_SCALEMODE_PIXELART
This is based on the algorithm presented by t3ssel8r: https://www.youtube.com/watch?v=d6tp43wZqps
This commit is contained in:
@@ -1964,8 +1964,12 @@ bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||
{
|
||||
CHECK_TEXTURE_MAGIC(texture, false);
|
||||
|
||||
if (scaleMode != SDL_SCALEMODE_NEAREST &&
|
||||
scaleMode != SDL_SCALEMODE_LINEAR) {
|
||||
switch (scaleMode) {
|
||||
case SDL_SCALEMODE_NEAREST:
|
||||
case SDL_SCALEMODE_LINEAR:
|
||||
case SDL_SCALEMODE_PIXELART:
|
||||
break;
|
||||
default:
|
||||
return SDL_InvalidParamError("scaleMode");
|
||||
}
|
||||
|
||||
@@ -5707,7 +5711,7 @@ static bool CreateDebugTextAtlas(SDL_Renderer *renderer)
|
||||
// Convert temp surface into texture
|
||||
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, atlas);
|
||||
if (texture) {
|
||||
SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_NEAREST);
|
||||
SDL_SetTextureScaleMode(texture, SDL_SCALEMODE_PIXELART);
|
||||
renderer->debug_char_texture_atlas = texture;
|
||||
}
|
||||
SDL_DestroySurface(atlas);
|
||||
|
Reference in New Issue
Block a user