]> git.tdb.fi Git - libs/game.git/commitdiff
Decorate things which constitute the public API of the library
authorMikko Rasa <tdb@tdb.fi>
Sat, 7 Jan 2023 13:19:47 +0000 (15:19 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 7 Jan 2023 13:19:47 +0000 (15:19 +0200)
24 files changed:
source/game/accessguard.h
source/game/camera.h
source/game/component.h
source/game/director.h
source/game/entity.h
source/game/eventbus.h
source/game/eventobserver.h
source/game/meshsource.h
source/game/mspgame_api.h [new file with mode: 0644]
source/game/pool.h
source/game/reflection.h
source/game/resources.h
source/game/root.h
source/game/stage.h
source/game/system.h
source/game/systemscheduler.h
source/game/transform.h
source/game/transformpropagator.h
source/gameview/meshrenderer.h
source/gameview/mspgameview_api.h [new file with mode: 0644]
source/gameview/playerinput.h
source/gameview/presenter.h
source/gameview/renderer.h
source/gameview/resources.h

index 0f7bac76ab09f964e3623a14a0a22ec97b35af8d..2d9a3053b8324a8e06abdb8713f8469bd5907d84 100644 (file)
@@ -7,17 +7,18 @@
 #include <vector>
 #include <msp/core/noncopyable.h>
 #include <msp/debug/demangle.h>
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
-class invalid_access: public std::logic_error
+class MSPGAME_API invalid_access: public std::logic_error
 {
 public:
        invalid_access(const std::string &w): logic_error(w) { }
 };
 
 
-class AccessGuard
+class MSPGAME_API AccessGuard
 {
 public:
        struct Create { static std::string describe() { return "create"; } };
index f6df873c1120586c04e6ce6fb3cfb80d55e15159..57f7395f33c85cdf6125e638f48b20561d8166a2 100644 (file)
@@ -4,6 +4,7 @@
 #include <msp/geometry/angle.h>
 #include <msp/linal/vector.h>
 #include "component.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
@@ -38,7 +39,7 @@ struct CameraData
        float get_aspect() const { return size.x/size.y; }
 };
 
-class Camera: public BufferedComponent<CameraData>
+class MSPGAME_API Camera: public BufferedComponent<CameraData>
 {
 public:
        using Setup = CameraSetup;
index 6406cb5743e3f417f0cb7f27a08c92e439aecef8..e97b511a6ed658edbc9c221b2ca14a7ffa2927f7 100644 (file)
@@ -4,12 +4,13 @@
 #include <msp/time/timedelta.h>
 #include "accessguard.h"
 #include "handle.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
 class Entity;
 
-class Component
+class MSPGAME_API Component
 {
 protected:
        Handle<Entity> entity;
index 775d7d2915941a2edb8247a47cddaaceca6277b1..5aeddea932badd73b41d9f5aa56b2e4669c24a44 100644 (file)
 #include "eventbus.h"
 #include "events.h"
 #include "eventsource.h"
+#include "mspgame_api.h"
 #include "reflection.h"
 
 namespace Msp::Game {
 
 class Stage;
 
-class Director
+class MSPGAME_API Director
 {
 public:
        using EventSource = Game::EventSource<Events::StageCreated, Events::StageActivated, Events::StageDeactivated>;
index 8dc5139558abeba8a676e6fdac67747c53e26df3..e6d1cf940cd8da44783976a29fd1ce407cf01770 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_GAME_ENTITY_H_
 
 #include "handle.h"
+#include "mspgame_api.h"
 #include "owned.h"
 
 namespace Msp::Game {
@@ -11,13 +12,13 @@ class Stage;
 class Transform;
 struct TransformValues;
 
-class hierarchy_error: public std::logic_error
+class MSPGAME_API hierarchy_error: public std::logic_error
 {
 public:
        hierarchy_error(): std::logic_error("hierarchy error") { }
 };
 
-class Entity
+class MSPGAME_API Entity
 {
 public:
        enum TransformTag { NO_TRANSFORM };
index b9e6c7890c77f5a56cb83f83cfd20c95c08a57c3..95fc068254ebd297dc2103a4e15a6eed08fea9ba 100644 (file)
@@ -4,6 +4,7 @@
 #include <functional>
 #include <vector>
 #include <msp/core/noncopyable.h>
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
@@ -31,7 +32,7 @@ struct EventDispatcher
 };
 
 
-class EventBus: public NonCopyable
+class MSPGAME_API EventBus: public NonCopyable
 {
 private:
        using DeleteFunc = void(void *);
index 31735a696aeda3697977512fbb3e1b4729c944f0..1c6551477ec02393f294dd9c260c9fc71f8e8084 100644 (file)
@@ -4,12 +4,13 @@
 #include <msp/core/algorithm.h>
 #include <msp/core/noncopyable.h>
 #include "eventbus.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
 class EventSourceBase;
 
-class EventObserver: public NonCopyable
+class MSPGAME_API EventObserver: public NonCopyable
 {
 private:
        EventBus &bus;
index 74ec78120d43a0a17d2251174d5a13ed7c980ac2..dfc6509844c4f749dcfa4600487bf08d5b5cbd32 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <msp/datafile/objectloader.h>
 #include "component.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
@@ -23,7 +24,7 @@ struct MeshSourceSetup
        std::string object_name;
 };
 
-class MeshSource: public Component
+class MSPGAME_API MeshSource: public Component
 {
 public:
        using Setup = MeshSourceSetup;
diff --git a/source/game/mspgame_api.h b/source/game/mspgame_api.h
new file mode 100644 (file)
index 0000000..1f9cdf0
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef MSP_GAME_API_H_
+#define MSP_GAME_API_H_
+
+#if defined(_WIN32)
+#if defined(MSPGAME_BUILD)
+#define MSPGAME_API __declspec(dllexport)
+#elif defined(MSPGAME_IMPORT)
+#define MSPGAME_API __declspec(dllimport)
+#else
+#define MSPGAME_API
+#endif
+#elif defined(__GNUC__)
+#define MSPGAME_API __attribute__((visibility("default")))
+#else
+#define MSPGAME_API
+#endif
+
+#endif
index 2b8e799d158b17e12bcb9f3c277f81bb553fa918..e4fe70453310c3ea337d47ab684d10f8663ae7c1 100644 (file)
@@ -5,6 +5,7 @@
 #include <memory>
 #include <vector>
 #include <msp/core/noncopyable.h>
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
@@ -13,7 +14,7 @@ class PoolBase;
 template<typename T>
 class Pool;
 
-class PoolPool: public NonCopyable
+class MSPGAME_API PoolPool: public NonCopyable
 {
 private:
        std::vector<std::unique_ptr<PoolBase>> pools;
@@ -35,7 +36,7 @@ public:
 };
 
 
-class PoolBase: public NonCopyable
+class MSPGAME_API PoolBase: public NonCopyable
 {
 private:
        using DeleteFunc = void(void *);
index 6d8535dec003e5d8d7ef3449ecc3ca01dea4dbaf..7b75541f5c65bdbb8ce65dd95b67f259cc25af22 100644 (file)
@@ -6,6 +6,7 @@
 #include <string>
 #include <typeindex>
 #include <vector>
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 namespace Reflection {
@@ -40,7 +41,7 @@ public:
 };
 
 
-class ClassBase
+class MSPGAME_API ClassBase
 {
 protected:
        Reflector &reflector;
@@ -85,7 +86,7 @@ private:
 };
 
 
-class Reflector
+class MSPGAME_API Reflector
 {
 private:
        std::vector<std::unique_ptr<ClassBase>> classes;
index c5b83726168406047a713056da7d1a1d1f3d2a21..62084337ac136d77ba163dde7a656c1b78da83e2 100644 (file)
@@ -5,15 +5,16 @@
 #include <msp/datafile/directorysource.h>
 #include <msp/datafile/packsource.h>
 #include <msp/fs/path.h>
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
-class Resources: virtual public DataFile::Collection
+class MSPGAME_API Resources: virtual public DataFile::Collection
 {
 public:
 };
 
-class ApplicationResources: public Resources
+class MSPGAME_API ApplicationResources: public Resources
 {
 private:
        DataFile::DirectorySource dir_src;
index 726ca32693bb385c4b9a46c9f5974594fe9ed0c4..57e9c0f054c5a71f0e73729e1bd532b3b10246b6 100644 (file)
@@ -2,12 +2,13 @@
 #define MSP_GAME_ROOT_H_
 
 #include "entity.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
 class Stage;
 
-class Root: public Entity
+class MSPGAME_API Root: public Entity
 {
 private:
        Stage &stage;
index 0c2219bdc18b1d893851ed91467677c5a35fc4b1..03a8adebc2531e605e5e7e3a58f8ca1dfb573c36 100644 (file)
@@ -8,6 +8,7 @@
 #include "events.h"
 #include "eventsource.h"
 #include "handle.h"
+#include "mspgame_api.h"
 #include "reflection.h"
 #include "systemscheduler.h"
 
@@ -17,7 +18,7 @@ class Camera;
 class Root;
 class System;
 
-class Stage
+class MSPGAME_API Stage
 {
 public:
        using EventSource = Game::EventSource<Events::EntityCreated, Events::EntityDestroyed,
index 09ee157a6953916522702cf0543ac75872f8ac78..4d39e301762d2981ce629c8ce51676a1370fe810 100644 (file)
@@ -5,12 +5,13 @@
 #include <msp/time/timedelta.h>
 #include "accessguard.h"
 #include "component.h"
+#include "mspgame_api.h"
 #include "reflection.h"
 #include "stage.h"
 
 namespace Msp::Game {
 
-class System
+class MSPGAME_API System
 {
 public:
        enum DependencyFlags
index 2ab4804f6293d080a7962c1fc3ffb891ea3ad2df..66764c80f263c426a80d2cfd9d3b5d0664743d07 100644 (file)
@@ -2,19 +2,20 @@
 #define MSP_GAME_SYSTEMSCHEDULER_H_
 
 #include <vector>
+#include "mspgame_api.h"
 #include "reflection.h"
 
 namespace Msp::Game {
 
 class System;
 
-class scheduling_error: public std::logic_error
+class MSPGAME_API scheduling_error: public std::logic_error
 {
 public:
        scheduling_error(const std::string &w): logic_error(w) { }
 };
 
-class SystemScheduler
+class MSPGAME_API SystemScheduler
 {
 public:
        struct Group
index 1239546be803dec1c89f23a63e4f19bb6a252cf1..fc63f29d4dbfa0d082bfa014269c78e20797a0bb 100644 (file)
@@ -5,6 +5,7 @@
 #include <msp/linal/matrix.h>
 #include <msp/linal/vector.h>
 #include "component.h"
+#include "mspgame_api.h"
 
 namespace Msp::Game {
 
@@ -29,7 +30,7 @@ struct TransformData
        LinAl::Matrix<float, 4, 4> world_matrix = LinAl::Matrix<float, 4, 4>::identity();
 };
 
-class Transform: public BufferedComponent<TransformData>
+class MSPGAME_API Transform: public BufferedComponent<TransformData>
 {
 public:
        Transform(Handle<Entity>);
index 3ac291b3e9ff1e51f964d7b273c9851ad913a9f0..defaed1a5e760306139160a279ef569a6b5a3c55 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "eventobserver.h"
 #include "handle.h"
+#include "mspgame_api.h"
 #include "system.h"
 
 namespace Msp::Game {
@@ -10,7 +11,7 @@ namespace Msp::Game {
 class Entity;
 class Transform;
 
-class TransformPropagator: public System
+class MSPGAME_API TransformPropagator: public System
 {
 private:
        struct ParentedTransform
index 96fe6125b3d209ce70c6291d3a7bb9587af535b6..f5e954894b883331505bef6506a9fd48de80e9df 100644 (file)
@@ -4,10 +4,11 @@
 #include <msp/game/component.h>
 #include <msp/game/meshsource.h>
 #include <msp/gl/objectinstance.h>
+#include "mspgameview_api.h"
 
 namespace Msp::GameView {
 
-class MeshRenderer: public Game::Component
+class MSPGAMEVIEW_API MeshRenderer: public Game::Component
 {
 private:
        Game::Handle<Game::MeshSource> source;
diff --git a/source/gameview/mspgameview_api.h b/source/gameview/mspgameview_api.h
new file mode 100644 (file)
index 0000000..b23f2ee
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef MSP_GAMEVIEW_API_H_
+#define MSP_GAMEVIEW_API_H_
+
+#if defined(_WIN32)
+#if defined(MSPGAMEVIEW_BUILD)
+#define MSPGAMEVIEW_API __declspec(dllexport)
+#elif defined(MSPGAMEVIEW_IMPORT)
+#define MSPGAMEVIEW_API __declspec(dllimport)
+#else
+#define MSPGAMEVIEW_API
+#endif
+#elif defined(__GNUC__)
+#define MSPGAMEVIEW_API __attribute__((visibility("default")))
+#else
+#define MSPGAMEVIEW_API
+#endif
+
+#endif
index 16f3c4ee9b8067b20cbda16485e6e4dfa5a0a444..2797aff40d572956eb112dacce6fdb5f5228e563 100644 (file)
@@ -9,10 +9,11 @@
 #include <msp/input/mouse.h>
 #include <msp/game/director.h>
 #include "events.h"
+#include "mspgameview_api.h"
 
 namespace Msp::GameView {
 
-class PlayerInput: public NonCopyable
+class MSPGAMEVIEW_API PlayerInput: public NonCopyable
 {
 public:
        using EventSource = Game::EventSource<Events::PlayerArrived, Events::PlayerDeparted>;
index fc8920098d0cd01ad27bd786f7442c7605c5943d..62f422ce1e9728a81f4a8051274617c1af5ad1b6 100644 (file)
@@ -5,12 +5,13 @@
 #include <msp/game/director.h>
 #include <msp/game/eventobserver.h>
 #include <msp/gl/view.h>
+#include "mspgameview_api.h"
 
 namespace Msp::GameView {
 
 class Renderer;
 
-class Presenter
+class MSPGAMEVIEW_API Presenter
 {
 private:
        Game::Director &director;
index ee0b05c15ab1b70052a4b407820f690a12df9dad..ca45b21b7657c113b30ff1ffb3cf86ef4d5f7067 100644 (file)
 #include <msp/gl/sequence.h>
 #include <msp/gl/simplescene.h>
 #include <msp/gl/view.h>
+#include "mspgameview_api.h"
 
 namespace Msp::GameView {
 
 class MeshRenderer;
 
-class Renderer: public Game::System
+class MSPGAMEVIEW_API Renderer: public Game::System
 {
 private:
        struct RenderedEntity
index aa20b02bf77a7d1c5571cca8fdb05eb7a6af4456..316a550637d29e5cd24aca183d5d9e96227f3915 100644 (file)
@@ -2,10 +2,11 @@
 #define MSP_GAMEVIEW_RESOURCES_H_
 
 #include <msp/gl/resources.h>
+#include "mspgameview_api.h"
 
 namespace Msp::GameView {
 
-class Resources: public GL::Resources
+class MSPGAMEVIEW_API Resources: public GL::Resources
 {
 public:
        Resources();