fix some msvc warnings

This commit is contained in:
2019-05-15 12:43:30 +07:00
parent 50de1cd6e0
commit dfccfb87fa
4 changed files with 18 additions and 20 deletions

View File

@@ -6,6 +6,4 @@
#pragma once
#include "types.hpp"
e2d::i32 e2d_main(int argc, char *argv[]);
int e2d_main(int argc, char *argv[]);

View File

@@ -802,12 +802,12 @@ namespace e2d
}
bool need_color =
utils::enum_to_underlying(external_texture)
& utils::enum_to_underlying(render_target::external_texture::color);
!!(utils::enum_to_underlying(external_texture)
& utils::enum_to_underlying(render_target::external_texture::color));
bool need_depth =
utils::enum_to_underlying(external_texture)
& utils::enum_to_underlying(render_target::external_texture::depth);
!!(utils::enum_to_underlying(external_texture)
& utils::enum_to_underlying(render_target::external_texture::depth));
texture_ptr color;
texture_ptr depth;
@@ -925,14 +925,14 @@ namespace e2d
E2D_ASSERT(is_in_main_thread());
bool clear_color =
utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::color);
!!(utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::color));
bool clear_depth =
utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::depth);
!!(utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::depth));
bool clear_stencil =
utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::stencil);
!!(utils::enum_to_underlying(command.clear_buffer())
& utils::enum_to_underlying(clear_command::buffer::stencil));
const render_target_ptr& rt = state_->render_target();
bool has_color = !rt || rt->state().color() || !rt->state().color_rb().empty();
@@ -1012,9 +1012,9 @@ namespace e2d
case pixel_declaration::pixel_type::depth16:
return true;
case pixel_declaration::pixel_type::depth24:
return GLEW_OES_depth24;
return !!GLEW_OES_depth24;
case pixel_declaration::pixel_type::depth32:
return GLEW_OES_depth32;
return !!GLEW_OES_depth32;
case pixel_declaration::pixel_type::depth24_stencil8:
return GLEW_OES_packed_depth_stencil
|| GLEW_EXT_packed_depth_stencil;
@@ -1039,10 +1039,10 @@ namespace e2d
case pixel_declaration::pixel_type::rgb_pvrtc4:
case pixel_declaration::pixel_type::rgba_pvrtc2:
case pixel_declaration::pixel_type::rgba_pvrtc4:
return GLEW_IMG_texture_compression_pvrtc;
return !!GLEW_IMG_texture_compression_pvrtc;
case pixel_declaration::pixel_type::rgba_pvrtc2_v2:
case pixel_declaration::pixel_type::rgba_pvrtc4_v2:
return GLEW_IMG_texture_compression_pvrtc2;
return !!GLEW_IMG_texture_compression_pvrtc2;
default:
E2D_ASSERT_MSG(false, "unexpected pixel type");
return false;

View File

@@ -327,7 +327,7 @@ namespace e2d
if ( mz_zip_reader_file_stat(state_->archive.get(), i, &file_stat) ) {
const str_view filename{file_stat.m_filename};
if ( filename.length() > parent.length() && filename.starts_with(parent) ) {
func(file_stat.m_filename, file_stat.m_is_directory);
func(file_stat.m_filename, !!file_stat.m_is_directory);
}
}
}

View File

@@ -445,7 +445,7 @@ namespace e2d
if ( self ) {
self->for_all_listeners(
&event_listener::on_window_focus,
focused);
!!focused);
}
}
@@ -454,7 +454,7 @@ namespace e2d
if ( self ) {
self->for_all_listeners(
&event_listener::on_window_minimize,
minimized);
!!minimized);
}
}
};