mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Change texture filtering without restarting. (#67)
This commit is contained in:
parent
5789492021
commit
34cb964ea5
@ -3,6 +3,7 @@
|
||||
|
||||
#include "fullscrn.h"
|
||||
#include "midi.h"
|
||||
#include "render.h"
|
||||
#include "Sound.h"
|
||||
#include "winmain.h"
|
||||
|
||||
@ -246,7 +247,7 @@ void options::toggle(Menu1 uIDCheckItem)
|
||||
break;
|
||||
case Menu1::WindowLinearFilter:
|
||||
Options.LinearFiltering ^= true;
|
||||
winmain::Restart();
|
||||
render::recreate_screen_texture();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -42,17 +42,7 @@ void render::init(gdrv_bitmap8* bmp, float zMin, float zScaler, int width, int h
|
||||
else
|
||||
gdrv::fill_bitmap(vscreen, vscreen->Width, vscreen->Height, 0, 0, 0);
|
||||
|
||||
{
|
||||
UsingSdlHint hint{SDL_HINT_RENDER_SCALE_QUALITY, options::Options.LinearFiltering ? "linear" : "nearest"};
|
||||
vScreenTex = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING,
|
||||
width, height
|
||||
);
|
||||
SDL_SetTextureBlendMode(vScreenTex, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
recreate_screen_texture();
|
||||
}
|
||||
|
||||
void render::uninit()
|
||||
@ -69,6 +59,25 @@ void render::uninit()
|
||||
dirty_list.clear();
|
||||
sprite_list.clear();
|
||||
SDL_DestroyTexture(vScreenTex);
|
||||
vScreenTex = nullptr;
|
||||
}
|
||||
|
||||
void render::recreate_screen_texture()
|
||||
{
|
||||
if (vScreenTex != nullptr)
|
||||
{
|
||||
SDL_DestroyTexture(vScreenTex);
|
||||
}
|
||||
|
||||
UsingSdlHint hint{ SDL_HINT_RENDER_SCALE_QUALITY, options::Options.LinearFiltering ? "linear" : "nearest" };
|
||||
vScreenTex = SDL_CreateTexture
|
||||
(
|
||||
winmain::Renderer,
|
||||
SDL_PIXELFORMAT_ARGB8888,
|
||||
SDL_TEXTUREACCESS_STREAMING,
|
||||
vscreen_rect.Width, vscreen_rect.Height
|
||||
);
|
||||
SDL_SetTextureBlendMode(vScreenTex, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
|
||||
void render::update()
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
|
||||
static void init(gdrv_bitmap8* bmp, float zMin, float zScaler, int width, int height);
|
||||
static void uninit();
|
||||
static void recreate_screen_texture();
|
||||
static void update();
|
||||
static void sprite_modified(render_sprite_type_struct* sprite);
|
||||
static render_sprite_type_struct* create_sprite(VisualTypes visualType, gdrv_bitmap8* bmp,
|
||||
|
Loading…
Reference in New Issue
Block a user