(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
This commit is contained in:
@@ -64,4 +64,24 @@ static inline int UnScaleByZoomLower(int value, ZoomLevel zoom)
|
||||
return value >> zoom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Short-hand to apply GUI zoom level.
|
||||
* @param value Pixel amount at #ZOOM_LVL_BEGIN (full zoom in).
|
||||
* @return value Pixel amount at #ZOOM_LVL_GUI.
|
||||
*/
|
||||
static inline int UnScaleGUI(int value)
|
||||
{
|
||||
return UnScaleByZoom(value, ZOOM_LVL_GUI);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scale traditional pixel dimensions to GUI zoom level.
|
||||
* @param value Pixel amount at 1x zoom level.
|
||||
* @return value Pixel amount at #ZOOM_LVL_GUI.
|
||||
*/
|
||||
static inline int ScaleGUITrad(int value)
|
||||
{
|
||||
return UnScaleGUI(value * ZOOM_LVL_BASE);
|
||||
}
|
||||
|
||||
#endif /* ZOOM_FUNC_H */
|
||||
|
Reference in New Issue
Block a user