mirror of https://github.com/OpenTTD/OpenTTD
Change: Zoom title game by UI zoom level
parent
58609e8fa6
commit
37daf43037
|
@ -199,6 +199,16 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FixTitleGameZoom()
|
||||||
|
{
|
||||||
|
if (_game_mode != GM_MENU) return;
|
||||||
|
|
||||||
|
ViewPort *vp = FindWindowByClass(WC_MAIN_WINDOW)->viewport;
|
||||||
|
vp->zoom = _gui_zoom;
|
||||||
|
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
|
||||||
|
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct NWidgetPart _nested_main_window_widgets[] = {
|
static const struct NWidgetPart _nested_main_window_widgets[] = {
|
||||||
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),
|
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#include "town.h"
|
#include "town.h"
|
||||||
#include "subsidy_func.h"
|
#include "subsidy_func.h"
|
||||||
#include "gfx_layout.h"
|
#include "gfx_layout.h"
|
||||||
|
#include "viewport_func.h"
|
||||||
#include "viewport_sprite_sorter.h"
|
#include "viewport_sprite_sorter.h"
|
||||||
#include "framerate_type.h"
|
#include "framerate_type.h"
|
||||||
|
|
||||||
|
@ -336,6 +337,7 @@ static void LoadIntroGame(bool load_newgrfs = true)
|
||||||
SetLocalCompany(COMPANY_FIRST);
|
SetLocalCompany(COMPANY_FIRST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FixTitleGameZoom();
|
||||||
_pause_mode = PM_UNPAUSED;
|
_pause_mode = PM_UNPAUSED;
|
||||||
_cursor.fix_at = false;
|
_cursor.fix_at = false;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "stringfilter_type.h"
|
#include "stringfilter_type.h"
|
||||||
#include "querystring_gui.h"
|
#include "querystring_gui.h"
|
||||||
#include "fontcache.h"
|
#include "fontcache.h"
|
||||||
|
#include "zoom_func.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -542,6 +543,7 @@ struct GameOptionsWindow : Window {
|
||||||
_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
|
||||||
UpdateCursorSize();
|
UpdateCursorSize();
|
||||||
UpdateAllVirtCoords();
|
UpdateAllVirtCoords();
|
||||||
|
FixTitleGameZoom();
|
||||||
ReInitAllWindows();
|
ReInitAllWindows();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ void MarkAllViewportsDirty(int left, int top, int right, int bottom);
|
||||||
bool DoZoomInOutWindow(ZoomStateChange how, Window *w);
|
bool DoZoomInOutWindow(ZoomStateChange how, Window *w);
|
||||||
void ZoomInOrOutToCursorWindow(bool in, Window * w);
|
void ZoomInOrOutToCursorWindow(bool in, Window * w);
|
||||||
Point GetTileZoomCenterWindow(bool in, Window * w);
|
Point GetTileZoomCenterWindow(bool in, Window * w);
|
||||||
|
void FixTitleGameZoom();
|
||||||
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
|
void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte widget_zoom_out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue