aboutsummaryrefslogtreecommitdiff
path: root/src/SfmlFixes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SfmlFixes.cpp')
-rw-r--r--src/SfmlFixes.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/SfmlFixes.cpp b/src/SfmlFixes.cpp
new file mode 100644
index 0000000..d6d4b17
--- /dev/null
+++ b/src/SfmlFixes.cpp
@@ -0,0 +1,15 @@
+#include "../include/SfmlFixes.hpp"
+#include <mutex>
+
+static std::mutex mutex;
+namespace QuickMedia {
+ bool load_image_from_file(sf::Image &image, const std::string &filepath) {
+ std::lock_guard<std::mutex> lock(mutex);
+ return image.loadFromFile(filepath);
+ }
+
+ bool load_image_from_memory(sf::Image &image, const void *data, size_t size) {
+ std::lock_guard<std::mutex> lock(mutex);
+ return image.loadFromMemory(data, size);
+ }
+} \ No newline at end of file