diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/CMakeLists.txt | 2 | ||||
-rw-r--r-- | demos/Graphics/DrawCircle/CMakeLists.txt | 5 | ||||
-rw-r--r-- | demos/Graphics/DrawCircle/CairoMain.cpp | 12 | ||||
-rw-r--r-- | demos/Graphics/DrawCircle/DrawCircle.cpp (renamed from demos/graphics/DrawCircle.cpp) | 10 | ||||
-rw-r--r-- | demos/Graphics/DrawCircle/DrawCircle.h | 7 | ||||
-rw-r--r-- | demos/Graphics/DrawCircle/PlatformMain.cpp | 12 | ||||
-rw-r--r-- | demos/graphics/CMakeLists.txt | 3 |
7 files changed, 41 insertions, 10 deletions
diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index e8b84472..6e4aa297 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -11,7 +11,7 @@ if(WIN32) add_subdirectory(InputMethod) add_subdirectory(SvgPath) elseif(APPLE) - add_subdirectory(graphics) + add_subdirectory(Graphics/DrawCircle) add_subdirectory(main) add_subdirectory(ScrollView) diff --git a/demos/Graphics/DrawCircle/CMakeLists.txt b/demos/Graphics/DrawCircle/CMakeLists.txt new file mode 100644 index 00000000..da6611ef --- /dev/null +++ b/demos/Graphics/DrawCircle/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(CruDemoGraphicsDrawCircle DrawCircle.cpp PlatformMain.cpp) +add_executable(CruDemoGraphicsDrawCircleCairo DrawCircle.cpp CairoMain.cpp) + +target_link_libraries(CruDemoGraphicsDrawCircle PRIVATE CruDemoBase) +target_link_libraries(CruDemoGraphicsDrawCircleCairo PRIVATE CruDemoBase CruPlatformGraphicsCairo) diff --git a/demos/Graphics/DrawCircle/CairoMain.cpp b/demos/Graphics/DrawCircle/CairoMain.cpp new file mode 100644 index 00000000..35d6840b --- /dev/null +++ b/demos/Graphics/DrawCircle/CairoMain.cpp @@ -0,0 +1,12 @@ +#include "cru/platform/graphics/cairo/CairoGraphicsFactory.h" + +#include "DrawCircle.h" + +int main() { + std::unique_ptr<cru::platform::graphics::IGraphicsFactory> graphics_factory( + new cru::platform::graphics::cairo::CairoGraphicsFactory()); + + cru::demos::graphics::DrawCircle(graphics_factory.get()); + + return 0; +} diff --git a/demos/graphics/DrawCircle.cpp b/demos/Graphics/DrawCircle/DrawCircle.cpp index 1ec06744..aa73d44c 100644 --- a/demos/graphics/DrawCircle.cpp +++ b/demos/Graphics/DrawCircle/DrawCircle.cpp @@ -1,15 +1,13 @@ #include "cru/common/io/CFileStream.h" #include "cru/platform/Color.h" -#include "cru/platform/bootstrap/Bootstrap.h" #include "cru/platform/graphics/Factory.h" #include "cru/platform/graphics/ImageFactory.h" #include "cru/platform/graphics/Painter.h" #include <memory> -int main() { - std::unique_ptr<cru::platform::graphics::IGraphicsFactory> graphics_factory( - cru::platform::bootstrap::CreateGraphicsFactory()); +namespace cru::demos::graphics { + void DrawCircle(platform::graphics::IGraphicsFactory* graphics_factory) { auto image = graphics_factory->GetImageFactory()->CreateBitmap(500, 500); @@ -26,6 +24,6 @@ int main() { graphics_factory->GetImageFactory()->EncodeToStream( image.get(), &file_stream, cru::platform::graphics::ImageFormat::Png, 1.0f); - - return 0; + } } + diff --git a/demos/Graphics/DrawCircle/DrawCircle.h b/demos/Graphics/DrawCircle/DrawCircle.h new file mode 100644 index 00000000..8e14dc84 --- /dev/null +++ b/demos/Graphics/DrawCircle/DrawCircle.h @@ -0,0 +1,7 @@ +#pragma once +#include "cru/platform/graphics/Factory.h" + +namespace cru::demos::graphics { + void DrawCircle(platform::graphics::IGraphicsFactory* graphics_factory); +} + diff --git a/demos/Graphics/DrawCircle/PlatformMain.cpp b/demos/Graphics/DrawCircle/PlatformMain.cpp new file mode 100644 index 00000000..3da1ec89 --- /dev/null +++ b/demos/Graphics/DrawCircle/PlatformMain.cpp @@ -0,0 +1,12 @@ +#include "cru/platform/bootstrap/Bootstrap.h" + +#include "DrawCircle.h" + +int main() { + std::unique_ptr<cru::platform::graphics::IGraphicsFactory> graphics_factory( + cru::platform::bootstrap::CreateGraphicsFactory()); + + cru::demos::graphics::DrawCircle(graphics_factory.get()); + + return 0; +} diff --git a/demos/graphics/CMakeLists.txt b/demos/graphics/CMakeLists.txt deleted file mode 100644 index b290ba13..00000000 --- a/demos/graphics/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_executable(CruDemoGraphicsDrawCircle DrawCircle.cpp) - -target_link_libraries(CruDemoGraphicsDrawCircle PRIVATE CruDemoBase) |