* 消除编译警告
This commit is contained in:
@@ -5,6 +5,10 @@ add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
|
||||
|
||||
# 禁用windows min max宏
|
||||
add_definitions(-DNOMINMAX)
|
||||
# 关闭windows相关警告
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
# windows
|
||||
add_definitions(-D_WIN32_WINNT=0x0601)
|
||||
|
||||
# dl源文件
|
||||
aux_source_directory(${CMAKE_SOURCE_DIR}/dl SRC_LIST)
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ bool Get(const json& j, const std::string& name, T& t)
|
||||
t = *iter;
|
||||
return true;
|
||||
}
|
||||
catch (nlohmann::detail::exception& e)
|
||||
catch (nlohmann::detail::exception&)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace dl::QR
|
||||
{
|
||||
for (size_t x = 0; x < qr.getSize(); ++x)
|
||||
{
|
||||
if (qr.getModule(x, y))
|
||||
if (qr.getModule((int)x, (int)y))
|
||||
ret->Set(y, x, 0xff000000);
|
||||
else
|
||||
ret->Set(y, x, 0xffffffff);
|
||||
|
||||
@@ -22,7 +22,7 @@ dl::Position Locator::_get_direct(std::size_t i)
|
||||
return { i * _sl._dt[0], 0 };
|
||||
else
|
||||
{
|
||||
std::ldiv_t d = std::ldiv(i, _sl._num);
|
||||
std::ldiv_t d = std::ldiv((long)i, (long)_sl._num);
|
||||
return { d.rem * _sl._dt[0], d.quot * _sl._dt[1] };
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ dl::Position Locator::_get_direct(std::size_t i)
|
||||
return { 0, i * _sl._dt[1] };
|
||||
else
|
||||
{
|
||||
std::ldiv_t d = std::ldiv(i, _sl._num);
|
||||
std::ldiv_t d = std::ldiv((long)i, (long)_sl._num);
|
||||
return { d.quot * _sl._dt[0], d.rem * _sl._dt[1] };
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ dl::Position Locator::_get_direct(std::size_t i)
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
return {};
|
||||
}
|
||||
|
||||
dl::Position Locator::_get_adapt(const Size& size)
|
||||
@@ -53,7 +54,7 @@ dl::Position Locator::_get_adapt(const Size& size)
|
||||
assert(_sl._mode == Mode::ADAPT);
|
||||
if (_sl._layout == Layout::X)
|
||||
{
|
||||
unsigned dx = (Float)size[0] / std::abs(_sl._dt[0]);
|
||||
unsigned dx = (unsigned)(size[0] / std::abs(_sl._dt[0]));
|
||||
++dx;
|
||||
if (_sl._num && dx + _x > _sl._num)
|
||||
{//需要换行
|
||||
@@ -70,7 +71,7 @@ dl::Position Locator::_get_adapt(const Size& size)
|
||||
}
|
||||
else if (_sl._layout == Layout::Y)
|
||||
{
|
||||
unsigned dy = (Float)size[1] / std::abs(_sl._dt[1]);
|
||||
unsigned dy = (unsigned)(size[1] / std::abs(_sl._dt[1]));
|
||||
++dy;
|
||||
if (_sl._num && dy + _y > _sl._num)
|
||||
{//需要换行
|
||||
@@ -87,8 +88,8 @@ dl::Position Locator::_get_adapt(const Size& size)
|
||||
}
|
||||
else if (_sl._layout == Layout::XY)
|
||||
{
|
||||
unsigned dx = (Float)size[0] / std::abs(_sl._dt[0]);
|
||||
unsigned dy = (Float)size[1] / std::abs(_sl._dt[1]);
|
||||
unsigned dx = (unsigned)(size[0] / std::abs(_sl._dt[0]));
|
||||
unsigned dy = (unsigned)(size[1] / std::abs(_sl._dt[1]));
|
||||
Position ret = _sl._start + (_sl._dt * toPosition(_x, _y));
|
||||
_x += dx;
|
||||
_y += dy;
|
||||
@@ -100,6 +101,7 @@ dl::Position Locator::_get_adapt(const Size& size)
|
||||
}
|
||||
else
|
||||
assert(0);
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -62,10 +62,10 @@ public:
|
||||
_cur += dt;
|
||||
if (_cur < _t)
|
||||
return false;
|
||||
if (_cur < _t * 2.0)
|
||||
if (_cur < _t * 2.0_f)
|
||||
return true;
|
||||
|
||||
_cur -= _t * 2.0;
|
||||
_cur -= _t * 2.0_f;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -250,8 +250,8 @@ public:
|
||||
{
|
||||
for (int w = 0; w < s._w; ++w)
|
||||
{
|
||||
size_t y = img_h - 1 - (s._y - rect._yMin);
|
||||
size_t index = y * img_w + s._x - rect._xMin + w;
|
||||
size_t y = (size_t)(img_h - 1 - (s._y - rect._yMin));
|
||||
size_t index = (size_t)(y * img_w + s._x - rect._xMin + w);
|
||||
p_lock[index] = uint32_t(s._coverage) << 24 | 0x00ffffff;
|
||||
}
|
||||
}
|
||||
@@ -261,8 +261,8 @@ public:
|
||||
{
|
||||
for (int w = 0; w < s._w; ++w)
|
||||
{
|
||||
size_t y = img_h - 1 - (s._y - rect._yMin);
|
||||
size_t index = y * img_w + s._x - rect._xMin + w;
|
||||
size_t y = (size_t)(img_h - 1 - (s._y - rect._yMin));
|
||||
size_t index = (size_t)(y * img_w + s._x - rect._xMin + w);
|
||||
p_lock[index] = uint32_t(s._coverage) << 24 | 0x00ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
{
|
||||
//f(x)=(0.64*sqrt(abs(x))-0.8+1.2^abs(x)*cos(200*x))*sqrt(cos(x))
|
||||
std::vector<Position3> vec;
|
||||
constexpr float pi_2 = Math::PI(1, 2);
|
||||
constexpr float pi_2 = (float)Math::PI(1, 2);
|
||||
for (float x = -pi_2; x < pi_2; x += 0.001f)
|
||||
{
|
||||
float y = (0.64f * sqrtf(std::abs(x)) - 0.8f + std::pow(1.2f, std::abs(x)) * cosf(64 * x)) * sqrtf(cosf(x));
|
||||
|
||||
+24
-21
@@ -44,7 +44,7 @@ void Text::SetFontSize(unsigned size)
|
||||
if (_fontSize[TextParam::NORMAL] == size)
|
||||
return;
|
||||
_fontSize[TextParam::NORMAL] = size;
|
||||
_fontSizeReal[TextParam::NORMAL] = size / _coor->GetScale()[0];
|
||||
_fontSizeReal[TextParam::NORMAL] = (unsigned)(size / _coor->GetScale()[0]);
|
||||
|
||||
_refresh_string();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ void Text::SetFontSize(unsigned size)
|
||||
void Text::SetOutline(unsigned outline, const Color& color)
|
||||
{
|
||||
_fontSize[TextParam::OUTLINE] = outline;
|
||||
_fontSizeReal[TextParam::OUTLINE] = outline / _coor->GetScale()[0];
|
||||
_fontSizeReal[TextParam::OUTLINE] = (unsigned)(outline / _coor->GetScale()[0]);
|
||||
_col[TextParam::OUTLINE] = color;
|
||||
|
||||
_refresh_string();
|
||||
@@ -63,7 +63,7 @@ void Text::SetOutline(unsigned outline, const Color& color)
|
||||
void Text::SetShadow(unsigned shadow, const Color& color /*= ColorDef::BLACK*/)
|
||||
{
|
||||
_fontSize[TextParam::SHADOW] = shadow;
|
||||
_fontSizeReal[TextParam::SHADOW] = shadow / _coor->GetScale()[0];
|
||||
_fontSizeReal[TextParam::SHADOW] = (unsigned)(shadow / _coor->GetScale()[0]);
|
||||
_col[TextParam::SHADOW] = color;
|
||||
|
||||
_refresh_string();
|
||||
@@ -186,8 +186,8 @@ void Text::_refresh_string()
|
||||
{
|
||||
TextNode node;
|
||||
node._ch = ch;
|
||||
node._lineH = size;
|
||||
node._ascent = size;
|
||||
node._lineH = (Float)size;
|
||||
node._ascent = (Float)size;
|
||||
node._advance = (Float)(size / 2);
|
||||
_allNode.push_back(node);
|
||||
return;
|
||||
@@ -196,8 +196,8 @@ void Text::_refresh_string()
|
||||
{//此处advance为几个字体宽度
|
||||
TextNode node;
|
||||
node._ch = ch;
|
||||
node._lineH = size;
|
||||
node._ascent = size;
|
||||
node._lineH = (Float)size;
|
||||
node._ascent = (Float)size;
|
||||
node._advance = 2;
|
||||
_allNode.push_back(node);
|
||||
return;
|
||||
@@ -206,8 +206,8 @@ void Text::_refresh_string()
|
||||
{
|
||||
TextNode node;
|
||||
node._ch = ch;
|
||||
node._lineH = size;
|
||||
node._ascent = size;
|
||||
node._lineH = (Float)size;
|
||||
node._ascent = (Float)size;
|
||||
node._advance = 0;
|
||||
_allNode.push_back(node);
|
||||
return;
|
||||
@@ -326,9 +326,9 @@ void Text::_refresh_string()
|
||||
if (str_flag[0] == L'f')
|
||||
{
|
||||
cur_font_id = _fontId;
|
||||
cur_font_size = _fontId;
|
||||
cur_font_ouline = _fontId;
|
||||
cur_font_shadow = _fontId;
|
||||
cur_font_size = _fontSizeReal[TextParam::NORMAL];
|
||||
cur_font_ouline = _fontSizeReal[TextParam::OUTLINE];
|
||||
cur_font_shadow = _fontSizeReal[TextParam::SHADOW];
|
||||
}
|
||||
else if (str_flag[0] == L'c')
|
||||
{
|
||||
@@ -377,11 +377,11 @@ void Text::_refresh_string()
|
||||
split_no_empty(str_flag, L'_', vec);
|
||||
|
||||
if (vec.size() > 1)
|
||||
cur_font_size = stoi(vec[1]) * s;
|
||||
cur_font_size = (unsigned)(stoi(vec[1]) * s);
|
||||
if (vec.size() > 2)
|
||||
cur_font_ouline = stoi(vec[2]) * s;
|
||||
cur_font_ouline = (unsigned)(stoi(vec[2]) * s);
|
||||
if (vec.size() > 3)
|
||||
cur_font_shadow = stoi(vec[3]) * s;
|
||||
cur_font_shadow = (unsigned)(stoi(vec[3]) * s);
|
||||
}
|
||||
else if (str_flag[0] == L'c')
|
||||
{
|
||||
@@ -418,7 +418,7 @@ void Text::_refresh_string()
|
||||
//指定宽度 写入\t
|
||||
TextNode node;
|
||||
node._ch = U'\t';
|
||||
node._advance = stoi(vec[1]);
|
||||
node._advance = (Float)(stoi(vec[1]));
|
||||
node._lineH = g_freetype->GetProperty(cur_font_id, cur_font_size).GetLinespace();
|
||||
_allNode.push_back(node);
|
||||
}
|
||||
@@ -429,7 +429,10 @@ void Text::_refresh_string()
|
||||
str_flag.clear();
|
||||
}
|
||||
else
|
||||
str_flag.push_back(ch);//TODO utf_char转wchar_t
|
||||
{
|
||||
assert(ch < 65536);//TODO utf_char转wchar_t
|
||||
str_flag.push_back((wchar_t)ch);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
log_err0("错误的标签!");
|
||||
@@ -498,7 +501,7 @@ void Text::_update_layout()
|
||||
//对齐后任在原地,则步进advance
|
||||
if (x == sx)
|
||||
{
|
||||
node._advance1 = advance;
|
||||
node._advance1 = (Float)advance;
|
||||
sx += advance;
|
||||
}
|
||||
else
|
||||
@@ -660,9 +663,9 @@ bool Text::_update_scale()
|
||||
|
||||
if (std::abs(s_inv - s_cur) > 0.01f)
|
||||
{
|
||||
_fontSizeReal[TextParam::NORMAL] = _fontSize[TextParam::NORMAL] * s;
|
||||
_fontSizeReal[TextParam::OUTLINE] = _fontSize[TextParam::OUTLINE] * s;
|
||||
_fontSizeReal[TextParam::SHADOW] = _fontSize[TextParam::SHADOW] * s;
|
||||
_fontSizeReal[TextParam::NORMAL] = (unsigned)(_fontSize[TextParam::NORMAL] * s);
|
||||
_fontSizeReal[TextParam::OUTLINE] = (unsigned)(_fontSize[TextParam::OUTLINE] * s);
|
||||
_fontSizeReal[TextParam::SHADOW] = (unsigned)(_fontSize[TextParam::SHADOW] * s);
|
||||
_coor->SetScale(s_inv);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ public:
|
||||
{
|
||||
_copy(b);
|
||||
}
|
||||
Variable(const std::string& str) :
|
||||
_type{ Type::STRING },
|
||||
_val{ str }
|
||||
{}
|
||||
Variable(std::string_view str) :
|
||||
_type{ Type::STRING },
|
||||
_val{ std::string{str} }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dl_audio.h"
|
||||
|
||||
#define AL_LIBTYPE_STATIC
|
||||
//#define AL_LIBTYPE_STATIC
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <render/dl_factory.h>
|
||||
#include <render/dl_camera.h>]
|
||||
#include <render/dl_camera.h>
|
||||
|
||||
namespace dl::Tool
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "dl_ui_button_base.h"
|
||||
|
||||
#include "system/dl_audio.h"
|
||||
|
||||
namespace dl::UI
|
||||
{
|
||||
|
||||
@@ -147,8 +149,6 @@ void Button::_update_radio()
|
||||
}
|
||||
}
|
||||
|
||||
#define snd_play
|
||||
|
||||
void Button::Update()
|
||||
{
|
||||
if (_bDisable)
|
||||
@@ -174,10 +174,10 @@ void Button::Update()
|
||||
}
|
||||
|
||||
if (!_strSndClick.empty() && IsClick())
|
||||
snd_play(_strSndClick.c_str());
|
||||
snd_play(_strSndClick);
|
||||
|
||||
if (!_strSndOver.empty() && IsThrough())
|
||||
snd_play(_strSndOver.c_str());
|
||||
snd_play(_strSndOver);
|
||||
|
||||
UpdateChild(_statePre, _state);
|
||||
}
|
||||
|
||||
@@ -179,11 +179,11 @@ public:
|
||||
private:
|
||||
ListBox() :
|
||||
_cpt{ this },
|
||||
_curSelect{ -1_zu },
|
||||
_curSelect{ std::string::npos },
|
||||
_selectLimit{ 1 },
|
||||
_scroll{ 0 },
|
||||
_scrollK{ 1.0f },
|
||||
_num{ -1_zu }
|
||||
_num{ std::string::npos }
|
||||
{
|
||||
_init_cpt();
|
||||
_coorItem = Coor::Create();
|
||||
@@ -235,9 +235,9 @@ private:
|
||||
void _limit_select(std::size_t i_select);
|
||||
|
||||
// 计算滚轮位置
|
||||
std::size_t _calc_scroll()
|
||||
size_t _calc_scroll()
|
||||
{
|
||||
return (_scroll + 1.0_f) / _locItem.GetDy();
|
||||
return (size_t)((_scroll + 1.0_f) / _locItem.GetDy());
|
||||
}
|
||||
void _limit_scroll()
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
//整体宽度为 按钮宽度 + 间隔(多一个)
|
||||
Float w = w_btn * _numBtn + _dxBtn * (1 + _numBtn);
|
||||
|
||||
_txt->SetMaxW(w);//设置文本宽度
|
||||
_txt->SetMaxW((unsigned)w);//设置文本宽度
|
||||
|
||||
Float h_txt = _txt->GetSize()[1]; //文本高度
|
||||
Float h_title = _txtTitle->GetSize()[1];//标题高度
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
if (_numBtn > 0)
|
||||
{
|
||||
//偏移为 负的 按钮总宽度的一半(间隔少一个) + 半个按钮
|
||||
Float sx_btn = (w_btn * _numBtn + _dxBtn * (_numBtn - 1)) * -0.5 + w_btn * 0.5;
|
||||
Float sx_btn = (w_btn * _numBtn + _dxBtn * (_numBtn - 1)) * -0.5_f + w_btn * 0.5_f;
|
||||
for (std::size_t i = 0; i < _numBtn; ++i)
|
||||
{
|
||||
_allBtn[i]->GetCoor()->SetPosition({ sx_btn + i * (w_btn + _dxBtn), size_half[1] });
|
||||
|
||||
+2
-2
@@ -1134,7 +1134,7 @@ void VK::_record_command_buffer(VkCommandBuffer command_buffer, uint32_t index_i
|
||||
|
||||
//绘制
|
||||
// 绘制
|
||||
vkCmdDraw(command_buffer, vb._index, 1, 0, 0);
|
||||
vkCmdDraw(command_buffer, (uint32_t)vb._index, 1, 0, 0);
|
||||
}
|
||||
//--------------------2d 透明----------------------
|
||||
if (!list_dc_translucent.empty())
|
||||
@@ -1168,7 +1168,7 @@ void VK::_record_command_buffer(VkCommandBuffer command_buffer, uint32_t index_i
|
||||
vkCmdBindVertexBuffers(command_buffer, 0, 1, vertexBuffers, offsets);
|
||||
|
||||
//绘制
|
||||
vkCmdDraw(command_buffer, vb._index, 1, 0, 0);
|
||||
vkCmdDraw(command_buffer, (uint32_t)vb._index, 1, 0, 0);
|
||||
}
|
||||
|
||||
//结束
|
||||
|
||||
+1
-1
@@ -92,5 +92,5 @@ private:
|
||||
UI::Panel* _panelMenu;
|
||||
Coor* _coorRender;
|
||||
gcSound _snd;
|
||||
int _selectidx = -1;
|
||||
size_t _selectidx = -1;
|
||||
};
|
||||
Reference in New Issue
Block a user