mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 12:06:41 +00:00
Codechange: Replace Alignment enum with struct
Alignment struct contains separate horizontal and vertical alignment members.
This commit is contained in:
committed by
Peter Nelson
parent
8e637cefed
commit
b4d16d319f
@@ -10,9 +10,24 @@
|
||||
#include "../stdafx.h"
|
||||
#include "geometry_func.hpp"
|
||||
#include "math_func.hpp"
|
||||
#include "../strings_func.h"
|
||||
#include "../strings_type.h"
|
||||
|
||||
#include "../safeguards.h"
|
||||
|
||||
/**
|
||||
* Resolve horizontal alignment for the current text direction.
|
||||
* @return The resolved horizontal alignment.
|
||||
*/
|
||||
AlignmentH Alignment::ResolveRTL() const
|
||||
{
|
||||
switch (this->h) {
|
||||
case AlignmentH::Start: return _current_text_dir == TD_RTL ? AlignmentH::ForceRight : AlignmentH::ForceLeft;
|
||||
case AlignmentH::End: return _current_text_dir == TD_RTL ? AlignmentH::ForceLeft : AlignmentH::ForceRight;
|
||||
default: return this->h;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute bounding box of both dimensions.
|
||||
* @param d1 First dimension.
|
||||
|
||||
Reference in New Issue
Block a user