bug fixed

This commit is contained in:
Nomango 2018-04-09 18:41:56 +08:00
parent ead3e52cef
commit 48ae177f1d
2 changed files with 13 additions and 3 deletions

View File

@ -100,11 +100,18 @@ UINT32 e2d::Text::getColor() const
} }
int e2d::Text::getLineCount() const int e2d::Text::getLineCount() const
{
if (m_pDWriteTextLayout)
{ {
DWRITE_TEXT_METRICS metrics; DWRITE_TEXT_METRICS metrics;
m_pDWriteTextLayout->GetMetrics(&metrics); m_pDWriteTextLayout->GetMetrics(&metrics);
return static_cast<int>(metrics.lineCount); return static_cast<int>(metrics.lineCount);
} }
else
{
return 0;
}
}
bool e2d::Text::isItalic() const bool e2d::Text::isItalic() const
{ {

View File

@ -18,6 +18,9 @@ public:
template<typename T> template<typename T>
static inline T range(T min, T max) { return e2d::Random::randomInt(min, max); } static inline T range(T min, T max) { return e2d::Random::randomInt(min, max); }
// 取得浮点数范围内的一个随机数
static inline double range(float min, float max) { return e2d::Random::randomReal(min, max); }
// 取得浮点数范围内的一个随机数 // 取得浮点数范围内的一个随机数
static inline double range(double min, double max) { return e2d::Random::randomReal(min, max); } static inline double range(double min, double max) { return e2d::Random::randomReal(min, max); }