trying to fix some warnings (had side effects)

This commit is contained in:
Green Sky 2021-06-14 17:44:59 +02:00
parent 05a8dfe1ff
commit 573b276116
10 changed files with 17 additions and 17 deletions

View File

@ -159,7 +159,7 @@ target_compile_definitions(soloud PRIVATE WITH_NULL)
#target_compile_definitions(soloud PRIVATE WITH_SDL2) #target_compile_definitions(soloud PRIVATE WITH_SDL2)
target_compile_definitions(soloud PRIVATE WITH_SDL2_STATIC) target_compile_definitions(soloud PRIVATE WITH_SDL2_STATIC)
target_include_directories(soloud PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/soloud/include") target_include_directories(soloud SYSTEM PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/soloud/include")
#target_include_directories(soloud PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui") #target_include_directories(soloud PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
#if not android or emscripten #if not android or emscripten

View File

@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(stb CXX) project(stb CXX)
add_library(stb INTERFACE) add_library(stb INTERFACE)
target_include_directories(stb INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(stb SYSTEM INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
add_library(stb_image "stb/stb_image.h" "stb_image.cpp") add_library(stb_image "stb/stb_image.h" "stb_image.cpp")
target_link_libraries(stb_image stb) target_link_libraries(stb_image stb)

View File

@ -8,7 +8,7 @@
namespace MM::ImGuiWidgets { namespace MM::ImGuiWidgets {
// TODO: fix formating // TODO: fix formating
void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget) { void Texture(MM::OpenGL::Texture::handle_t& texture, bool dropTarget) {
const float s_sz = ImGui::GetFrameHeight(); const float s_sz = ImGui::GetFrameHeight();
//const float w_all = ImGui::CalcItemWidth(); //const float w_all = ImGui::CalcItemWidth();
//const char* lable_display_end = ImGui::FindRenderedTextEnd(label); //const char* lable_display_end = ImGui::FindRenderedTextEnd(label);
@ -58,7 +58,7 @@ void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget) {
ImGui::EndGroup(); ImGui::EndGroup();
} }
void LabelTexture(const char* label, MM::OpenGL::Texture::handle& texture, bool dropTarget) { void LabelTexture(const char* label, MM::OpenGL::Texture::handle_t& texture, bool dropTarget) {
const float s_sz = ImGui::GetFrameHeight(); const float s_sz = ImGui::GetFrameHeight();
const float w_all = ImGui::CalcItemWidth(); const float w_all = ImGui::CalcItemWidth();
const char* lable_display_end = ImGui::FindRenderedTextEnd(label); const char* lable_display_end = ImGui::FindRenderedTextEnd(label);

View File

@ -6,8 +6,8 @@ namespace MM::ImGuiWidgets {
#define IMGUI_PAYLOAD_TYPE_MM_REND_TEXTURE "MM_REND_TEXTURE" #define IMGUI_PAYLOAD_TYPE_MM_REND_TEXTURE "MM_REND_TEXTURE"
void Texture(MM::OpenGL::Texture::handle& texture, bool dropTarget = true); void Texture(MM::OpenGL::Texture::handle_t& texture, bool dropTarget = true);
void LabelTexture(const char* label, MM::OpenGL::Texture::handle& texture, bool dropTarget = true); void LabelTexture(const char* label, MM::OpenGL::Texture::handle_t& texture, bool dropTarget = true);
} }

View File

@ -32,7 +32,7 @@ void TextureResourceManagerList(void) {
void TextureResourceManagerLoader(MM::Engine& engine) { void TextureResourceManagerLoader(MM::Engine& engine) {
using namespace entt::literals; using namespace entt::literals;
auto& rm = MM::ResourceManager<MM::OpenGL::Texture>::ref(); auto& rm = MM::ResourceManager<MM::OpenGL::Texture>::ref();
static MM::OpenGL::Texture::handle texture = rm.get("default"_hs); static MM::OpenGL::Texture::handle_t texture = rm.get("default"_hs);
static std::string path = ""; static std::string path = "";

View File

@ -5,7 +5,7 @@
namespace MM::Components::OpenGL { namespace MM::Components::OpenGL {
struct Texture { struct Texture {
MM::OpenGL::Texture::handle tex; MM::OpenGL::Texture::handle_t tex;
}; };
} // MM::Components::OpenGL } // MM::Components::OpenGL

View File

@ -6,7 +6,7 @@ namespace MM::OpenGL {
// a SpriteSheet is a texture divided evenly into a Grid // a SpriteSheet is a texture divided evenly into a Grid
struct SpriteSheet { struct SpriteSheet {
MM::OpenGL::Texture::handle tex = nullptr; MM::OpenGL::Texture::handle_t tex = nullptr;
struct { struct {
uint32_t x = 1; uint32_t x = 1;
uint32_t y = 1; uint32_t y = 1;

View File

@ -15,9 +15,9 @@ uint32_t Texture::getHandle(void) const {
Texture::Texture( Texture::Texture(
uint32_t handle, uint32_t handle,
int32_t width, int32_t height, int32_t width_, int32_t height_,
int32_t internalFormat, int32_t format, int32_t type int32_t internalFormat, int32_t format, int32_t type
) : _handle(handle), width(width), height(height), ) : _handle(handle), width(width_), height(height_),
_internalFormat(internalFormat), _format(format), _type(type) {} _internalFormat(internalFormat), _format(format), _type(type) {}
Texture::~Texture(void) { Texture::~Texture(void) {
@ -44,7 +44,7 @@ void Texture::resize(int32_t new_width, int32_t new_height) {
*(const_cast<int32_t*>(&height)) = new_height; *(const_cast<int32_t*>(&height)) = new_height;
} }
Texture::handle Texture::createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type) { Texture::handle_t Texture::createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type) {
uint32_t id; uint32_t id;
glGenTextures(1, &id); glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id); glBindTexture(GL_TEXTURE_2D, id);
@ -54,7 +54,7 @@ Texture::handle Texture::createEmpty(int32_t internalFormat, int32_t width, int3
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
return handle(new Texture(id, width, height, internalFormat, format, type)); return handle_t(new Texture(id, width, height, internalFormat, format, type));
} }
} // MM::OpenGL } // MM::OpenGL

View File

@ -19,12 +19,12 @@ namespace MM::OpenGL {
Texture( Texture(
uint32_t handle, uint32_t handle,
int32_t width, int32_t height, int32_t width_, int32_t height_,
int32_t internalFormat, int32_t format, int32_t type int32_t internalFormat, int32_t format, int32_t type
); );
public: public:
using handle = std::shared_ptr<Texture>; using handle_t = std::shared_ptr<Texture>;
int32_t const width; int32_t const width;
int32_t const height; int32_t const height;
@ -44,7 +44,7 @@ namespace MM::OpenGL {
void resize(int32_t new_width, int32_t new_height); void resize(int32_t new_width, int32_t new_height);
static handle createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type); static handle_t createEmpty(int32_t internalFormat, int32_t width, int32_t height, int32_t format, int32_t type);
}; };
} // MM::OpenGL } // MM::OpenGL

View File

@ -85,7 +85,7 @@ void BatchedSpriteSheet::render(Services::OpenGLRenderer& rs, Engine& engine) {
std::vector<instance_data> instances; std::vector<instance_data> instances;
}; };
// HACK: assume same sp for same texture // HACK: assume same sp for same texture
std::unordered_map<MM::OpenGL::Texture::handle, sp_data> batch_map; std::unordered_map<MM::OpenGL::Texture::handle_t, sp_data> batch_map;
auto view = scene.view<Components::Transform2D, SpriteSheetRenderable>(); auto view = scene.view<Components::Transform2D, SpriteSheetRenderable>();