add proper dllimport/export declarations

This commit is contained in:
SweetId 2023-09-19 20:02:34 -04:00
parent 4ff3609492
commit eddcd4b906
3 changed files with 27 additions and 15 deletions

View File

@ -23,13 +23,12 @@
return Nz::Color(x, y , z, w); \
}
#if defined(NAZARA_STATIC)
#if defined(NAZARA_IMGUI_STATIC)
#define NAZARA_IMGUI_API
#else
#define NAZARA_IMGUI_API
#ifdef NAZARA_IMGUI_BUILD
//#define NAZARA_IMGUI_API NAZARA_EXPORT
#define NAZARA_IMGUI_API NAZARA_EXPORT
#else
//#define NAZARA_IMGUI_API NAZARA_IMPORT
#define NAZARA_IMGUI_API NAZARA_IMPORT
#endif
#endif

View File

@ -24,7 +24,7 @@ namespace Nz
virtual void OnRenderImgui() = 0;
};
class Imgui : public Nz::ModuleBase<Imgui>
class NAZARA_IMGUI_API Imgui : public Nz::ModuleBase<Imgui>
{
friend ModuleBase;
@ -96,20 +96,20 @@ namespace Nz
namespace ImGui
{
// custom ImGui widgets for SFML stuff
// custom ImGui widgets for Nazara
// Image overloads
void Image(const Nz::Texture* texture, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
void Image(const Nz::Texture* texture, const Nz::Vector2f& size, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
void Image(const Nz::Texture* texture, const Nz::Rectf& textureRect, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
void Image(const Nz::Texture* texture, const Nz::Vector2f& size, const Nz::Rectf& textureRect, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
NAZARA_IMGUI_API void Image(const Nz::Texture* texture, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
NAZARA_IMGUI_API void Image(const Nz::Texture* texture, const Nz::Vector2f& size, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
NAZARA_IMGUI_API void Image(const Nz::Texture* texture, const Nz::Rectf& textureRect, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
NAZARA_IMGUI_API void Image(const Nz::Texture* texture, const Nz::Vector2f& size, const Nz::Rectf& textureRect, const Nz::Color& tintColor = Nz::Color::White(), const Nz::Color& borderColor = Nz::Color(0, 0, 0, 0));
// ImageButton overloads
bool ImageButton(const Nz::Texture* texture, const int framePadding = -1, const Nz::Color& bgColor = Nz::Color(0,0,0,0), const Nz::Color& tintColor = Nz::Color::White());
bool ImageButton(const Nz::Texture* texture, const Nz::Vector2f& size, const int framePadding = -1, const Nz::Color& bgColor = Nz::Color(0,0,0,0), const Nz::Color& tintColor = Nz::Color::White());
NAZARA_IMGUI_API bool ImageButton(const Nz::Texture* texture, const int framePadding = -1, const Nz::Color& bgColor = Nz::Color(0,0,0,0), const Nz::Color& tintColor = Nz::Color::White());
NAZARA_IMGUI_API bool ImageButton(const Nz::Texture* texture, const Nz::Vector2f& size, const int framePadding = -1, const Nz::Color& bgColor = Nz::Color(0,0,0,0), const Nz::Color& tintColor = Nz::Color::White());
// Draw_list overloads. All positions are in relative coordinates (relative to top-left of the current window)
void DrawLine(const Nz::Vector2f& a, const Nz::Vector2f& b, const Nz::Color& col, float thickness = 1.0f);
void DrawRect(const Nz::Rectf& rect, const Nz::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f);
void DrawRectFilled(const Nz::Rectf& rect, const Nz::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F);
NAZARA_IMGUI_API void DrawLine(const Nz::Vector2f& a, const Nz::Vector2f& b, const Nz::Color& col, float thickness = 1.0f);
NAZARA_IMGUI_API void DrawRect(const Nz::Rectf& rect, const Nz::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F, float thickness = 1.0f);
NAZARA_IMGUI_API void DrawRectFilled(const Nz::Rectf& rect, const Nz::Color& color, float rounding = 0.0f, int rounding_corners = 0x0F);
}

View File

@ -61,4 +61,17 @@ target("NazaraImgui")
add_headerfiles("src/NazaraImgui/**.inl", { prefixdir = "private", install = false })
add_files("src/NazaraImgui/**.cpp")
-- for now only shared compilation is supported (except on platforms like wasm)
if not is_plat("wasm") then
set_kind("shared")
else
set_kind("static")
add_defines("NAZARA_IMGUI_STATIC", { public = true })
end
add_defines("NAZARA_IMGUI_BUILD")
if is_mode("debug") then
add_defines("NAZARA_IMGUI_DEBUG")
end
includes("examples/xmake.lua")