mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-03 05:32:54 +00:00
Add scr_scale, scr_x, scr_y cvars to scale and adjust viewport position
This commit is contained in:
parent
37dc1189bb
commit
2ec5d3e6b0
2 changed files with 22 additions and 1 deletions
|
|
@ -421,6 +421,10 @@ consvar_t cv_scr_depth = Player("scr_depth", "16 bits").values({{8, "8 bits"}, {
|
|||
consvar_t cv_scr_width = Player("scr_width", "640").values(CV_Unsigned);
|
||||
consvar_t cv_scr_height = Player("scr_height", "400").values(CV_Unsigned);
|
||||
|
||||
consvar_t cv_scr_scale = Player("scr_scale", "1.0").floating_point();
|
||||
consvar_t cv_scr_x = Player("scr_x", "0.0").floating_point();
|
||||
consvar_t cv_scr_y = Player("scr_y", "0.0").floating_point();
|
||||
|
||||
consvar_t cv_seenames = Player("seenames", "On").on_off();
|
||||
consvar_t cv_shadow = Player("shadow", "On").on_off();
|
||||
consvar_t cv_shittyscreen = Player("televisionsignal", "Okay").flags(CV_NOSHOWHELP).values({{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}}).dont_save();
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@
|
|||
#include <imgui.h>
|
||||
#include <tracy/tracy/Tracy.hpp>
|
||||
|
||||
#include "command.h"
|
||||
#include "cxxutil.hpp"
|
||||
#include "f_finale.h"
|
||||
#include "m_fixed.h"
|
||||
#include "m_misc.h"
|
||||
#include "hwr2/hardware_state.hpp"
|
||||
#include "hwr2/patch_atlas.hpp"
|
||||
|
|
@ -46,6 +48,8 @@
|
|||
#include "st_stuff.h"
|
||||
#include "v_video.h"
|
||||
|
||||
extern "C" consvar_t cv_scr_scale, cv_scr_x, cv_scr_y;
|
||||
|
||||
using namespace srb2;
|
||||
using namespace srb2::hwr2;
|
||||
using namespace srb2::rhi;
|
||||
|
|
@ -329,7 +333,20 @@ void I_FinishUpdate(void)
|
|||
rhi->begin_default_render_pass(ctx, true);
|
||||
|
||||
// Upscale draw the backbuffer (with postprocessing maybe?)
|
||||
g_hw_state.blit_rect->set_output(0, 0, vid.realwidth, vid.realheight, true, true);
|
||||
if (cv_scr_scale.value != FRACUNIT)
|
||||
{
|
||||
float f = std::max(FixedToFloat(cv_scr_scale.value), 0.f);
|
||||
float w = vid.realwidth * f;
|
||||
float h = vid.realheight * f;
|
||||
float x = (vid.realwidth - w) * (0.5f + (FixedToFloat(cv_scr_x.value) * 0.5f));
|
||||
float y = (vid.realheight - h) * (0.5f + (FixedToFloat(cv_scr_y.value) * 0.5f));
|
||||
|
||||
g_hw_state.blit_rect->set_output(x, y, w, h, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_hw_state.blit_rect->set_output(0, 0, vid.realwidth, vid.realheight, true, true);
|
||||
}
|
||||
g_hw_state.blit_rect->set_texture(g_hw_state.backbuffer->color(), static_cast<uint32_t>(vid.width), static_cast<uint32_t>(vid.height));
|
||||
g_hw_state.blit_rect->draw(*rhi, ctx);
|
||||
rhi->end_render_pass(ctx);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue