aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform')
-rw-r--r--include/cru/platform/graphics/Base.hpp11
-rw-r--r--include/cru/platform/graphics/Brush.hpp4
-rw-r--r--include/cru/platform/graphics/Factory.hpp2
-rw-r--r--include/cru/platform/graphics/Font.hpp2
-rw-r--r--include/cru/platform/graphics/Geometry.hpp4
-rw-r--r--include/cru/platform/graphics/NullPainter.hpp53
-rw-r--r--include/cru/platform/graphics/Painter.hpp5
-rw-r--r--include/cru/platform/graphics/Resource.hpp2
-rw-r--r--include/cru/platform/graphics/TextLayout.hpp2
-rw-r--r--include/cru/platform/gui/Window.hpp1
10 files changed, 60 insertions, 26 deletions
diff --git a/include/cru/platform/graphics/Base.hpp b/include/cru/platform/graphics/Base.hpp
index 26ae725a..3a18e39d 100644
--- a/include/cru/platform/graphics/Base.hpp
+++ b/include/cru/platform/graphics/Base.hpp
@@ -6,6 +6,17 @@
#include <memory>
+#ifdef CRU_PLATFORM_WINDOWS
+#ifdef CRU_PLATFORM_GRAPHICS_EXPORT_API
+#define CRU_PLATFORM_GRAPHICS_API __declspec(dllexport)
+#else
+#define CRU_PLATFORM_GRAPHICS_API __declspec(dllimport)
+#endif
+#else
+#define CRU_PLATFORM_GRAPHICS_API
+#endif
+
+
namespace cru::platform::graphics {
// forward declarations
struct IGraphicsFactory;
diff --git a/include/cru/platform/graphics/Brush.hpp b/include/cru/platform/graphics/Brush.hpp
index aa21f79d..772edd5c 100644
--- a/include/cru/platform/graphics/Brush.hpp
+++ b/include/cru/platform/graphics/Brush.hpp
@@ -2,9 +2,9 @@
#include "Resource.hpp"
namespace cru::platform::graphics {
-struct IBrush : virtual IGraphicsResource {};
+struct CRU_PLATFORM_GRAPHICS_API IBrush : virtual IGraphicsResource {};
-struct ISolidColorBrush : virtual IBrush {
+struct CRU_PLATFORM_GRAPHICS_API ISolidColorBrush : virtual IBrush {
virtual Color GetColor() = 0;
virtual void SetColor(const Color& color) = 0;
};
diff --git a/include/cru/platform/graphics/Factory.hpp b/include/cru/platform/graphics/Factory.hpp
index b79e1c4f..f3802651 100644
--- a/include/cru/platform/graphics/Factory.hpp
+++ b/include/cru/platform/graphics/Factory.hpp
@@ -8,7 +8,7 @@
namespace cru::platform::graphics {
// Entry point of the graphics module.
-struct IGraphicsFactory : virtual IPlatformResource {
+struct CRU_PLATFORM_GRAPHICS_API IGraphicsFactory : virtual IPlatformResource {
virtual std::unique_ptr<ISolidColorBrush> CreateSolidColorBrush() = 0;
virtual std::unique_ptr<IGeometryBuilder> CreateGeometryBuilder() = 0;
diff --git a/include/cru/platform/graphics/Font.hpp b/include/cru/platform/graphics/Font.hpp
index e1a419eb..2d1bc9a6 100644
--- a/include/cru/platform/graphics/Font.hpp
+++ b/include/cru/platform/graphics/Font.hpp
@@ -2,7 +2,7 @@
#include "Resource.hpp"
namespace cru::platform::graphics {
-struct IFont : virtual IGraphicsResource {
+struct CRU_PLATFORM_GRAPHICS_API IFont : virtual IGraphicsResource {
virtual float GetFontSize() = 0;
};
} // namespace cru::platform::graphics
diff --git a/include/cru/platform/graphics/Geometry.hpp b/include/cru/platform/graphics/Geometry.hpp
index f01132fb..e83d1c51 100644
--- a/include/cru/platform/graphics/Geometry.hpp
+++ b/include/cru/platform/graphics/Geometry.hpp
@@ -2,13 +2,13 @@
#include "Resource.hpp"
namespace cru::platform::graphics {
-struct IGeometry : virtual IGraphicsResource {
+struct CRU_PLATFORM_GRAPHICS_API IGeometry : virtual IGraphicsResource {
virtual bool FillContains(const Point& point) = 0;
};
// After called Build, calling every method will throw a
-struct IGeometryBuilder : virtual IGraphicsResource {
+struct CRU_PLATFORM_GRAPHICS_API IGeometryBuilder : virtual IGraphicsResource {
virtual void BeginFigure(const Point& point) = 0;
virtual void LineTo(const Point& point) = 0;
virtual void QuadraticBezierTo(const Point& control_point,
diff --git a/include/cru/platform/graphics/NullPainter.hpp b/include/cru/platform/graphics/NullPainter.hpp
index cf790ccf..b5c796d3 100644
--- a/include/cru/platform/graphics/NullPainter.hpp
+++ b/include/cru/platform/graphics/NullPainter.hpp
@@ -1,8 +1,9 @@
#pragma once
#include "Painter.hpp"
+#include "cru/common/Base.hpp"
namespace cru::platform::graphics {
-class NullPainter : public Object, public virtual IPainter {
+class CRU_PLATFORM_GRAPHICS_API NullPainter : public Object, public virtual IPainter {
public:
NullPainter() = default;
@@ -17,30 +18,54 @@ class NullPainter : public Object, public virtual IPainter {
String GetDebugString() override { return u"NullPainter"; }
Matrix GetTransform() override { return Matrix(); }
- void SetTransform(const Matrix& matrix) override {}
+ void SetTransform(const Matrix& matrix) override { CRU_UNUSED(matrix) }
- void ConcatTransform(const Matrix& matrix) override {}
+ void ConcatTransform(const Matrix& matrix) override { CRU_UNUSED(matrix) }
- void Clear(const Color& color) override {}
+ void Clear(const Color& color) override { CRU_UNUSED(color) }
void DrawLine(const Point& start, const Point& end, IBrush* brush,
- float width) override{};
+ float width) override {
+ CRU_UNUSED(start) CRU_UNUSED(end) CRU_UNUSED(brush) CRU_UNUSED(width)
+ }
void StrokeRectangle(const Rect& rectangle, IBrush* brush,
- float width) override {}
- void FillRectangle(const Rect& rectangle, IBrush* brush) override {}
+ float width) override {
+ CRU_UNUSED(rectangle) CRU_UNUSED(brush) CRU_UNUSED(width)
+ }
+ void FillRectangle(const Rect& rectangle, IBrush* brush) override {
+ CRU_UNUSED(rectangle)
+ CRU_UNUSED(brush)
+ }
void StrokeEllipse(const Rect& outline_rect, IBrush* brush,
- float width) override {}
- void FillEllipse(const Rect& outline_rect, IBrush* brush,
- float width) override {}
+ float width) override {
+ CRU_UNUSED(outline_rect)
+ CRU_UNUSED(brush)
+ CRU_UNUSED(width)
+ }
+ void FillEllipse(const Rect& outline_rect, IBrush* brush) override {
+ CRU_UNUSED(outline_rect)
+ CRU_UNUSED(brush)
+ }
void StrokeGeometry(IGeometry* geometry, IBrush* brush,
- float width) override {}
- void FillGeometry(IGeometry* geometry, IBrush* brush) override {}
+ float width) override {
+ CRU_UNUSED(geometry)
+ CRU_UNUSED(brush)
+ CRU_UNUSED(width)
+ }
+ void FillGeometry(IGeometry* geometry, IBrush* brush) override {
+ CRU_UNUSED(geometry)
+ CRU_UNUSED(brush)
+ }
void DrawText(const Point& offset, ITextLayout* text_layout,
- IBrush* brush) override {}
+ IBrush* brush) override {
+ CRU_UNUSED(offset)
+ CRU_UNUSED(text_layout)
+ CRU_UNUSED(brush)
+ }
- void PushLayer(const Rect& bounds) override{};
+ void PushLayer(const Rect& bounds) override { CRU_UNUSED(bounds) }
void PopLayer() override {}
diff --git a/include/cru/platform/graphics/Painter.hpp b/include/cru/platform/graphics/Painter.hpp
index 4f1724ec..4104a752 100644
--- a/include/cru/platform/graphics/Painter.hpp
+++ b/include/cru/platform/graphics/Painter.hpp
@@ -3,7 +3,7 @@
namespace cru::platform::graphics {
-struct IPainter : virtual IPlatformResource {
+struct CRU_PLATFORM_GRAPHICS_API IPainter : virtual IPlatformResource {
virtual Matrix GetTransform() = 0;
virtual void SetTransform(const Matrix& matrix) = 0;
@@ -18,8 +18,7 @@ struct IPainter : virtual IPlatformResource {
virtual void FillRectangle(const Rect& rectangle, IBrush* brush) = 0;
virtual void StrokeEllipse(const Rect& outline_rect, IBrush* brush,
float width) = 0;
- virtual void FillEllipse(const Rect& outline_rect, IBrush* brush,
- float width) = 0;
+ virtual void FillEllipse(const Rect& outline_rect, IBrush* brush) = 0;
virtual void StrokeGeometry(IGeometry* geometry, IBrush* brush,
float width) = 0;
diff --git a/include/cru/platform/graphics/Resource.hpp b/include/cru/platform/graphics/Resource.hpp
index cd1e5283..e559b0e9 100644
--- a/include/cru/platform/graphics/Resource.hpp
+++ b/include/cru/platform/graphics/Resource.hpp
@@ -4,7 +4,7 @@
namespace cru::platform::graphics {
struct IGraphicsFactory;
-struct IGraphicsResource : virtual IPlatformResource {
+struct CRU_PLATFORM_GRAPHICS_API IGraphicsResource : virtual IPlatformResource {
virtual IGraphicsFactory* GetGraphicsFactory() = 0;
};
} // namespace cru::platform::graphics
diff --git a/include/cru/platform/graphics/TextLayout.hpp b/include/cru/platform/graphics/TextLayout.hpp
index a040ec3b..f9ccc824 100644
--- a/include/cru/platform/graphics/TextLayout.hpp
+++ b/include/cru/platform/graphics/TextLayout.hpp
@@ -7,7 +7,7 @@
namespace cru::platform::graphics {
// Requirement:
// All text must be left-top aligned.
-struct ITextLayout : virtual IGraphicsResource {
+struct CRU_PLATFORM_GRAPHICS_API ITextLayout : virtual IGraphicsResource {
virtual String GetText() = 0;
virtual void SetText(String new_text) = 0;
diff --git a/include/cru/platform/gui/Window.hpp b/include/cru/platform/gui/Window.hpp
index bab5e8fe..9f17b976 100644
--- a/include/cru/platform/gui/Window.hpp
+++ b/include/cru/platform/gui/Window.hpp
@@ -85,7 +85,6 @@ struct INativeWindow : virtual IPlatformResource {
// Remember to call EndDraw on return value and destroy it.
virtual std::unique_ptr<graphics::IPainter> BeginPaint() = 0;
- // Don't use this instance after receive this event.
virtual IEvent<std::nullptr_t>* CreateEvent() = 0;
virtual IEvent<std::nullptr_t>* DestroyEvent() = 0;
virtual IEvent<std::nullptr_t>* PaintEvent() = 0;