mirror of https://github.com/OpenRCT2/OpenRCT2.git
Compare commits
3 Commits
60295631a4
...
e6ea5d1240
Author | SHA1 | Date |
---|---|---|
Karsten Van Fossan | e6ea5d1240 | |
Harry Hopkinson | 9266a6f0d3 | |
karstenv | 565ed5e786 |
|
@ -30,6 +30,7 @@
|
|||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/Version.h>
|
||||
#include <openrct2/audio/AudioContext.h>
|
||||
#include <openrct2/audio/AudioMixer.h>
|
||||
|
@ -119,6 +120,20 @@ public:
|
|||
{
|
||||
SDLException::Throw("SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)");
|
||||
}
|
||||
if (gConfigGeneral.RefreshDPIScaling)
|
||||
{
|
||||
float ddpi, hdpi, vdpi;
|
||||
if (!SDL_GetDisplayDPI(0, &ddpi, &hdpi, &vdpi))
|
||||
{
|
||||
// If DPI can be read, divide DPI by regular DPI (96.0f) and round to nearest 0.25
|
||||
gConfigGeneral.WindowScale = std::round(ddpi / 96.0f * 4.0) / 4.0;
|
||||
|
||||
LOG_VERBOSE("Changing DPI scaling to %f\n", gConfigGeneral.WindowScale);
|
||||
}
|
||||
gConfigGeneral.RefreshDPIScaling = false;
|
||||
auto configPath = env->GetFilePath(PATHID::CONFIG);
|
||||
ConfigSave(configPath.c_str());
|
||||
}
|
||||
_cursorRepository.LoadCursors();
|
||||
_shortcutManager.LoadUserBindings();
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ namespace Config
|
|||
model->DisableLightningEffect = reader->GetBoolean("disable_lightning_effect", false);
|
||||
model->SteamOverlayPause = reader->GetBoolean("steam_overlay_pause", true);
|
||||
model->WindowScale = reader->GetFloat("window_scale", Platform::GetDefaultScale());
|
||||
model->RefreshDPIScaling = reader->GetBoolean("refresh_dpi_scaling", true);
|
||||
model->ShowFPS = reader->GetBoolean("show_fps", false);
|
||||
#ifdef _DEBUG
|
||||
// Always have multi-threading disabled in debug builds, this makes things slower.
|
||||
|
@ -290,6 +291,7 @@ namespace Config
|
|||
writer->WriteBoolean("disable_lightning_effect", model->DisableLightningEffect);
|
||||
writer->WriteBoolean("steam_overlay_pause", model->SteamOverlayPause);
|
||||
writer->WriteFloat("window_scale", model->WindowScale);
|
||||
writer->WriteBoolean("refresh_dpi_scaling", model->RefreshDPIScaling);
|
||||
writer->WriteBoolean("show_fps", model->ShowFPS);
|
||||
writer->WriteBoolean("multithreading", model->MultiThreading);
|
||||
writer->WriteBoolean("trap_cursor", model->TrapCursor);
|
||||
|
|
|
@ -38,6 +38,7 @@ struct GeneralConfiguration
|
|||
int32_t FullscreenWidth;
|
||||
int32_t FullscreenHeight;
|
||||
float WindowScale;
|
||||
bool RefreshDPIScaling;
|
||||
::DrawingEngine DrawingEngine;
|
||||
bool UncapFPS;
|
||||
bool UseVSync;
|
||||
|
|
|
@ -1625,19 +1625,12 @@ constexpr CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3] = {
|
|||
},
|
||||
};
|
||||
|
||||
static constexpr int8_t right_quarter_turn_3_tiles_sprite_map[] = {
|
||||
0,
|
||||
-1,
|
||||
1,
|
||||
2,
|
||||
};
|
||||
|
||||
void TrackPaintUtilRightQuarterTurn3TilesPaint(
|
||||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], const CoordsXY offsets[4][3], const CoordsXY boundsLengths[4][3],
|
||||
const CoordsXYZ boundsOffsets[4][3])
|
||||
{
|
||||
int32_t index = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1665,7 +1658,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint2WithHeightOffset(
|
|||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], int32_t heightOffset)
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1753,7 +1746,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint3(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1770,7 +1763,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint4(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -258,6 +258,8 @@ extern const CoordsXY defaultRightQuarterTurn3TilesOffsets[4][3];
|
|||
extern const CoordsXYZ defaultRightQuarterTurn3TilesBoundOffsets[4][3];
|
||||
extern const CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3];
|
||||
|
||||
constexpr int8_t kRightQuarterTurn3TilesSpriteMap[] = { 0, -1, 1, 2 };
|
||||
|
||||
extern const CoordsXY defaultRightHelixUpSmallQuarterBoundLengths[4][3][2];
|
||||
extern const CoordsXYZ defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2];
|
||||
|
||||
|
|
|
@ -1392,9 +1392,7 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn3Tiles(
|
|||
miniature_railway_right_quarter_turn_3_tile_track_floor, nullptr, defaultRightQuarterTurn3TilesBoundLengths,
|
||||
miniature_railway_right_quarter_turn_3_tile_bound_offsets);
|
||||
|
||||
static constexpr int8_t _right_quarter_turn_3_tiles_sprite_map[] = { 0, -1, 1, 2 };
|
||||
|
||||
int32_t index = _right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
|
||||
auto imageId = session.TrackColours.WithIndex(
|
||||
miniature_railway_track_pieces_flat_quarter_turn_3_tiles[direction][index]);
|
||||
|
|
Loading…
Reference in New Issue