Changeset - r23649:d9aa63954823
[Not reviewed]
master
0 4 0
Niels Martin Hansen - 5 years ago 2019-04-23 20:55:27
nielsm@indvikleren.dk
Change: Zoom title game by UI zoom level
4 files changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/main_gui.cpp
Show inline comments
 
@@ -196,12 +196,22 @@ void ZoomInOrOutToCursorWindow(bool in, 
 

	
 
			DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, 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[] = {
 
	NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_M_VIEWPORT), SetResize(1, 1),
 
};
 

	
 
enum {
 
	GHK_QUIT,
src/openttd.cpp
Show inline comments
 
@@ -59,12 +59,13 @@
 
#include "misc/getoptdata.h"
 
#include "game/game.hpp"
 
#include "game/game_config.hpp"
 
#include "town.h"
 
#include "subsidy_func.h"
 
#include "gfx_layout.h"
 
#include "viewport_func.h"
 
#include "viewport_sprite_sorter.h"
 
#include "framerate_type.h"
 

	
 
#include "linkgraph/linkgraphschedule.h"
 

	
 
#include <stdarg.h>
 
@@ -333,12 +334,13 @@ static void LoadIntroGame(bool load_newg
 
		WaitTillGeneratedWorld();
 
		SetLocalCompany(COMPANY_SPECTATOR);
 
	} else {
 
		SetLocalCompany(COMPANY_FIRST);
 
	}
 

	
 
	FixTitleGameZoom();
 
	_pause_mode = PM_UNPAUSED;
 
	_cursor.fix_at = false;
 

	
 
	CheckForMissingGlyphs();
 

	
 
	MusicLoop(); // ensure music is correct
src/settings_gui.cpp
Show inline comments
 
@@ -34,12 +34,13 @@
 
#include "blitter/factory.hpp"
 
#include "language.h"
 
#include "textfile_gui.h"
 
#include "stringfilter_type.h"
 
#include "querystring_gui.h"
 
#include "fontcache.h"
 
#include "zoom_func.h"
 

	
 
#include <vector>
 

	
 
#include "safeguards.h"
 

	
 

	
 
@@ -539,12 +540,13 @@ struct GameOptionsWindow : Window {
 

	
 
			case WID_GO_GUI_ZOOM_DROPDOWN:
 
				GfxClearSpriteCache();
 
				_gui_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
 
				UpdateCursorSize();
 
				UpdateAllVirtCoords();
 
				FixTitleGameZoom();
 
				ReInitAllWindows();
 
				break;
 

	
 
			case WID_GO_FONT_ZOOM_DROPDOWN:
 
				GfxClearSpriteCache();
 
				_font_zoom = (ZoomLevel)(ZOOM_LVL_OUT_4X - index);
src/viewport_func.h
Show inline comments
 
@@ -31,12 +31,13 @@ void UpdateViewportPosition(Window *w);
 

	
 
void MarkAllViewportsDirty(int left, int top, int right, int bottom);
 

	
 
bool DoZoomInOutWindow(ZoomStateChange how, Window *w);
 
void ZoomInOrOutToCursorWindow(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);
 

	
 
/**
 
 * Zoom a viewport as far as possible in the given direction.
 
 * @param how Zooming direction.
 
 * @param w   Window owning the viewport.
0 comments (0 inline, 0 general)