diff --git a/src/Makefile.am b/src/Makefile.am index aa42f2e7..dad8ea6a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -88,10 +88,10 @@ liblol_core_sources = \ easymesh/shinydebuglighting.lolfx easymesh/shinydebugnormal.lolfx \ easymesh/shinydebugUV.lolfx easymesh/shiny_SK.lolfx \ \ - base/assert.cpp base/log.cpp base/string.cpp base/enum.cpp \ + base/assert.cpp base/log.cpp base/string.cpp \ \ math/vector.cpp math/matrix.cpp math/transform.cpp math/half.cpp \ - math/constants.cpp math/geometry.cpp math/real.cpp \ + math/geometry.cpp math/real.cpp \ \ gpu/shader.cpp gpu/indexbuffer.cpp gpu/vertexbuffer.cpp \ gpu/framebuffer.cpp gpu/texture.cpp gpu/renderer.cpp \ diff --git a/src/base/enum.cpp b/src/base/enum.cpp deleted file mode 100644 index 48e848f3..00000000 --- a/src/base/enum.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2014 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. -// - -#include - -namespace lol -{ - -/* - * Safe enum helpers - */ - - -} /* namespace lol */ - diff --git a/src/base/log.cpp b/src/base/log.cpp index 62c3407b..b0f26307 100644 --- a/src/base/log.cpp +++ b/src/base/log.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2017 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -111,7 +111,7 @@ void msg::helper(MessageType type, char const *fmt, va_list ap) array widechar; widechar.resize(buf.length() + 1); - MultiByteToWideChar(CP_UTF8, 0, buf.c_str(), buf.length() + 1, widechar.data(), widechar.count()); + MultiByteToWideChar(CP_UTF8, 0, buf.c_str(), (int)buf.length() + 1, widechar.data(), widechar.count()); OutputDebugStringW(widechar.data()); # else fprintf(stderr, "%s: ", prefix[(int)type]); diff --git a/src/gpu/renderer.cpp b/src/gpu/renderer.cpp index 4e8a615e..d7e42c2c 100644 --- a/src/gpu/renderer.cpp +++ b/src/gpu/renderer.cpp @@ -545,7 +545,7 @@ void Renderer::SetScissorRect(vec4 rect) m_data->m_scissor_rect = rect; if (m_data->m_scissor_mode == ScissorMode::Enabled) { - glScissor((int)rect.x, (int)Video::GetSize().y - rect.w, (int)(rect.z - rect.x), (int)(rect.w - rect.y)); + glScissor((int)rect.x, (int)(Video::GetSize().y - rect.w), (int)(rect.z - rect.x), (int)(rect.w - rect.y)); //glScissor((int)rect.x, (int)rect.y, (int)(rect.z - rect.x), (int)(rect.w - rect.y)); } } diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index e099f529..a72f8a45 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -369,7 +369,7 @@ Shader::Shader(std::string const &name, int Shader::GetAttribCount() const { - return data->attrib_locations.size(); + return (int)data->attrib_locations.size(); } ShaderAttrib Shader::GetAttribLocation(VertexUsage usage, int index) const diff --git a/src/image/codec/oric-image.cpp b/src/image/codec/oric-image.cpp index 9edb0dac..d092786c 100644 --- a/src/image/codec/oric-image.cpp +++ b/src/image/codec/oric-image.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -66,7 +66,7 @@ ResourceCodecData* OricImageCodec::Load(std::string const &path) if (screen.length() == 0) return nullptr; - auto data = new ResourceImageData(new image(ivec2(WIDTH, screen.length() * 6 / WIDTH))); + auto data = new ResourceImageData(new image(ivec2(WIDTH, (int)screen.length() * 6 / WIDTH))); auto img = data->m_image; u8vec4 *pixels = img->lock(); diff --git a/src/image/dither/dbs.cpp b/src/image/dither/dbs.cpp index b0fd5ea2..34885fb6 100644 --- a/src/image/dither/dbs.cpp +++ b/src/image/dither/dbs.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2004—2017 Sam Hocevar +// Copyright © 2004—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -37,7 +37,7 @@ image image::dither_dbs() const for (int j = 0; j < NN; j++) for (int i = 0; i < NN; i++) { - vec2 v = vec2(i - N, j - N); + vec2 v = vec2((float)(i - N), (float)(j - N)); ker[i][j] = exp(-sqlength(v / 1.6f) / 2.f) + exp(-sqlength(v / 0.6f) / 2.f); t += ker[i][j]; diff --git a/src/image/dither/ordered.cpp b/src/image/dither/ordered.cpp index 3aeec6b1..8dc4f808 100644 --- a/src/image/dither/ordered.cpp +++ b/src/image/dither/ordered.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2004—2017 Sam Hocevar +// Copyright © 2004—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -33,7 +33,7 @@ image image::dither_halftone(float radius, float angle) const * like crap. So we create a kernel PRECISION times larger, and ask * the ditherer to scale it by 1/PRECISION. */ float const PRECISION = 4.f; - int k = (radius * PRECISION * lol::sqrt(2.f) + 0.5f); + int k = (int)std::round(radius * PRECISION * lol::sqrt(2.f)); array2d ker = image::kernel::halftone(ivec2(k, k)); return dither_helper(*this, ker, 1.f / PRECISION, angle + F_PI / 4.f); diff --git a/src/image/kernel.cpp b/src/image/kernel.cpp index f432fea2..374db585 100644 --- a/src/image/kernel.cpp +++ b/src/image/kernel.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2004—2017 Sam Hocevar +// Copyright © 2004—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -110,7 +110,7 @@ array2d image::kernel::blue_noise(ivec2 size, ivec2 gsize) auto best = [&] (float val, float mul) -> ivec2 { - float maxval = -size.x * size.y; + float maxval = -(float)(size.x * size.y); ivec2 coord(0, 0); for (int y = 0; y < size.y; ++y) for (int x = 0; x < size.x; ++x) diff --git a/src/image/pixel.cpp b/src/image/pixel.cpp index db1feae7..0e000cb5 100644 --- a/src/image/pixel.cpp +++ b/src/image/pixel.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2004—2017 Sam Hocevar +// Copyright © 2004—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -223,7 +223,7 @@ void image::set_format(PixelFormat fmt) /* Lossless conversions: u8 to float */ else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::Y_F32) { - float *src = (float *)m_data->m_pixels[(int)old_fmt]->data(); + uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data(); float *dest = (float *)m_data->m_pixels[(int)fmt]->data(); for (int n = 0; n < count; ++n) @@ -231,7 +231,7 @@ void image::set_format(PixelFormat fmt) } else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::RGB_F32) { - float *src = (float *)m_data->m_pixels[(int)old_fmt]->data(); + uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data(); vec3 *dest = (vec3 *)m_data->m_pixels[(int)fmt]->data(); for (int n = 0; n < count; ++n) @@ -255,7 +255,7 @@ void image::set_format(PixelFormat fmt) } else if (old_fmt == PixelFormat::Y_8 && fmt == PixelFormat::RGBA_F32) { - float *src = (float *)m_data->m_pixels[(int)old_fmt]->data(); + uint8_t *src = (uint8_t *)m_data->m_pixels[(int)old_fmt]->data(); vec4 *dest = (vec4 *)m_data->m_pixels[(int)fmt]->data(); for (int n = 0; n < count; ++n) diff --git a/src/input/controller.cpp b/src/input/controller.cpp index fe8d7745..f51814ed 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -2,7 +2,7 @@ // Lol Engine // // Copyright © 2010—2015 Benjamin Litzelmann -// © 2017—2018 Sam Hocevar +// © 2017—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -32,7 +32,7 @@ void KeyBinding::Bind(const std::string& device_name, const std::string& key_nam return; } - int keyindex = device->GetKeyIndex(key_name); + int keyindex = (int)device->GetKeyIndex(key_name); if (keyindex < 0) { msg::warn("trying to bind nonexistent key %s.%s\n", @@ -77,7 +77,7 @@ void AxisBinding::Bind(const std::string& device_name, const std::string& axis_n return; } - int axisindex = device->GetAxisIndex(axis_name); + int axisindex = (int)device->GetAxisIndex(axis_name); if (axisindex < 0) { msg::warn("trying to bind nonexistent axis %s.%s\n", @@ -98,7 +98,7 @@ void AxisBinding::BindKey(const std::string& device_name, const std::string& key return; } - int keyindex = device->GetKeyIndex(key_name); + int keyindex = (int)device->GetKeyIndex(key_name); if (keyindex < 0) { msg::warn("trying to bind nonexistent axis key %s.%s\n", @@ -119,7 +119,7 @@ void AxisBinding::BindKeys(const std::string& device_name, const std::string& mi return; } - int minkeyindex = device->GetKeyIndex(min_key_name); + int minkeyindex = (int)device->GetKeyIndex(min_key_name); if (minkeyindex < 0) { msg::warn("trying to bind nonexistent axis key %s.%s\n", @@ -127,7 +127,7 @@ void AxisBinding::BindKeys(const std::string& device_name, const std::string& mi return; } - int maxkeyindex = device->GetKeyIndex(max_key_name); + int maxkeyindex = (int)device->GetKeyIndex(max_key_name); if (maxkeyindex < 0) { msg::warn("trying to bind nonexistent axis key %s.%s\n", diff --git a/src/lol-core.vcxproj b/src/lol-core.vcxproj index f9f97348..9266791d 100644 --- a/src/lol-core.vcxproj +++ b/src/lol-core.vcxproj @@ -85,7 +85,6 @@ - @@ -152,7 +151,6 @@ - diff --git a/src/lol-core.vcxproj.filter b/src/lol-core.vcxproj.filter index 84d8bc49..08fe0858 100644 --- a/src/lol-core.vcxproj.filter +++ b/src/lol-core.vcxproj.filter @@ -243,9 +243,6 @@ base - - base - base @@ -288,9 +285,6 @@ ... - - math - easymesh diff --git a/src/lol/math/real.h b/src/lol/math/real.h index 55202a9e..230e3923 100644 --- a/src/lol/math/real.h +++ b/src/lol/math/real.h @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -231,8 +231,8 @@ private: public: static int DEFAULT_BIGIT_COUNT; - static inline int bigit_bits() { return 8 * sizeof(bigit_t); } - inline int bigit_count() const { return m_mantissa.size(); } + static inline int bigit_bits() { return 8 * (int)sizeof(bigit_t); } + inline int bigit_count() const { return (int)m_mantissa.size(); } inline int total_bits() const { return bigit_count() * bigit_bits(); } }; diff --git a/src/math/constants.cpp b/src/math/constants.cpp deleted file mode 100644 index 5dc606fa..00000000 --- a/src/math/constants.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Lol Engine -// -// Copyright © 2010—2015 Sam Hocevar -// -// Lol Engine is free software. It comes without any warranty, to -// the extent permitted by applicable law. You can redistribute it -// and/or modify it under the terms of the Do What the Fuck You Want -// to Public License, Version 2, as published by the WTFPL Task Force. -// See http://www.wtfpl.net/ for more details. -// - -#include - -namespace lol { - -// There is nothing here for now. -extern int unused_file_constants_cpp; - -}; /* namespace lol */ - diff --git a/src/mesh/mesh.cpp b/src/mesh/mesh.cpp index fb7746e9..f4ea28e2 100644 --- a/src/mesh/mesh.cpp +++ b/src/mesh/mesh.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -111,7 +111,7 @@ void SubMesh::AddTexture(std::string const &name, Texture* texture) void SubMesh::Render() { - int vertex_count = 0; + size_t vertex_count = 0; for (int i = 0; i < m_vbos.count(); ++i) { @@ -148,7 +148,7 @@ void SubMesh::Render() m_ibo->Bind(); m_vdecl->Bind(); - m_vdecl->DrawIndexedElements(MeshPrimitive::Triangles, m_ibo->GetSize() / sizeof(uint16_t)); + m_vdecl->DrawIndexedElements(MeshPrimitive::Triangles, (int)(m_ibo->GetSize() / sizeof(uint16_t))); m_vdecl->Unbind(); m_ibo->Unbind(); } diff --git a/src/sys/file.cpp b/src/sys/file.cpp index 91221004..a92ad915 100644 --- a/src/sys/file.cpp +++ b/src/sys/file.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright © 2010—2018 Sam Hocevar +// Copyright © 2010—2019 Sam Hocevar // // Lol Engine is free software. It comes without any warranty, to // the extent permitted by applicable law. You can redistribute it @@ -140,7 +140,7 @@ class FileData if (done <= 0) break; - int oldsize = ret.length(); + size_t oldsize = ret.length(); ret.resize(oldsize + done); memcpy(&ret[oldsize], &buf[0], done); @@ -159,7 +159,7 @@ class FileData if (done <= 0) return -1; - return done; + return (int)done; #else return 0; #endif @@ -310,7 +310,7 @@ int File::Write(void const *buf, int count) //-- int File::Write(std::string const &buf) { - return m_data->Write(buf.c_str(), buf.length()); + return m_data->Write(buf.c_str(), (int)buf.length()); } //--