Skip to content

Commit 1e21e09

Browse files
authored
Merge pull request #38 from AsPJT/feature/guinpen98/add-wrap-libraries
add: GUIラップライブラリの基本機能の追加
2 parents 4322fc0 + 4749e49 commit 1e21e09

File tree

69 files changed

+744
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+744
-13
lines changed

.github/workflows/cmake-all-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Configure CMake
4040
run: |
4141
mkdir ${{github.workspace}}/build
42-
cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SFML_TEST=ON -S ${{env.WORK_SPACE}} -G "Unix Makefiles"
42+
cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.WORK_SPACE}} -G "Unix Makefiles"
4343
4444
- name: Build
4545
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all -j 12

.github/workflows/cmake-unit-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Configure CMake
4949
run: |
5050
mkdir ${{github.workspace}}/build
51-
cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_SFML_TEST=ON -S ${{env.WORK_SPACE}}/${{env.TEST_DIR}} -G "Unix Makefiles"
51+
cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -S ${{env.WORK_SPACE}}/${{env.TEST_DIR}} -G "Unix Makefiles"
5252
5353
- name: Build
5454
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all -j 12

Library/PAX_GRAPHICA/Circle.hpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_CIRCLE_HPP
13+
#define PAX_GRAPHICA_CIRCLE_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#if defined(PAXS_USING_SIV3D)
20+
#include <Siv3D.hpp>
21+
#elif defined(PAXS_USING_SFML)
22+
#include <SFML/Graphics.hpp>
23+
#endif
24+
25+
#include <PAX_GRAPHICA/IDrawable.hpp>
26+
#include <PAX_GRAPHICA/Window.hpp>
27+
28+
namespace paxg {
29+
30+
struct Circle : public IDrawable
31+
{
32+
#if defined(PAXS_USING_SIV3D)
33+
s3d::Circle circle;
34+
constexpr Circle(const float x, const float y, const float r) : circle(x, y, r) {}
35+
constexpr Circle(const Vec2& pos, const float r) : circle(pos.x, pos.y, r) {}
36+
constexpr operator s3d::Circle() const { return circle; }
37+
#elif defined(PAXS_USING_SFML)
38+
sf::CircleShape circle;
39+
Circle(float x, float y, float r) : circle(r) { circle.setPosition(x, y); }
40+
Circle(const sf::Vector2i& pos, float r) : circle(r) { circle.setPosition(pos.x, pos.y); }
41+
operator sf::CircleShape() const { return circle; }
42+
#else
43+
float x, y, r;
44+
constexpr Circle(const float x, const float y, const float r) : x(x), y(y), r(r) {}
45+
constexpr Circle(const Vec2& pos, const float r) : x(pos.x), y(pos.y), r(r) {}
46+
#endif
47+
void draw() const override {
48+
#if defined(PAXS_USING_SIV3D)
49+
circle.draw();
50+
#elif defined(PAXS_USING_SFML)
51+
Window::window.draw(circle);
52+
#endif
53+
}
54+
55+
void drawAt(const Vec2f& pos) const override {}
56+
};
57+
}
58+
59+
#endif // !PAX_GRAPHICA_CIRCLE_HPP

Library/PAX_GRAPHICA/Color.hpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_COLOR_HPP
13+
#define PAX_GRAPHICA_COLOR_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#if defined(PAXS_USING_SIV3D)
20+
#include <Siv3D/Color.hpp>
21+
#elif defined(PAXS_USING_SFML)
22+
#include <SFML/Graphics/Color.hpp>
23+
#endif
24+
25+
namespace paxg {
26+
27+
struct Color {
28+
#if defined(PAXS_USING_SIV3D)
29+
s3d::Color color;
30+
constexpr Color(const int r, const int g, const int b, const int a) : color(r, g, b, a) {}
31+
constexpr s3d::Color() const { return color; }
32+
#elif defined(PAXS_USING_SFML)
33+
sf::Color color;
34+
Color(const int r, const int g, const int b, const int a) : color(r, g, b, a) {}
35+
operator sf::Color() const { return color; }
36+
#else
37+
int r, g, b, a;
38+
constexpr Color(int r, int g, int b, int a) : r(r), g(g), b(b), a(a) {}
39+
#endif
40+
};
41+
42+
}
43+
44+
#endif // !PAX_GRAPHICA_COLOR_HPP

Library/PAX_GRAPHICA/Graphics.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_GRAPHICS_HPP
13+
#define PAX_GRAPHICA_GRAPHICS_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#include <PAX_GRAPHICA/Circle.hpp>
20+
#include <PAX_GRAPHICA/Rect.hpp>
21+
#include <PAX_GRAPHICA/Texture.hpp>
22+
#include <PAX_GRAPHICA/Window.hpp>
23+
24+
#endif // !PAX_GRAPHICA_GRAPHICS_HPP

Library/PAX_GRAPHICA/IDrawable.hpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_IDRAWABLE_HPP
13+
#define PAX_GRAPHICA_IDRAWABLE_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#include <PAX_GRAPHICA/Vec2.hpp>
20+
21+
namespace paxg {
22+
23+
struct IDrawable {
24+
25+
virtual ~IDrawable() {}
26+
27+
virtual void draw() const = 0;
28+
29+
virtual void drawAt(const Vec2f& pos) const = 0;
30+
};
31+
32+
}
33+
34+
#endif // !PAX_GRAPHICA_IDRAWABLE_HPP

Library/PAX_GRAPHICA/Image.hpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_IMAGE_HPP
13+
#define PAX_GRAPHICA_IMAGE_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#if defined(PAXS_USING_SIV3D)
20+
#include <Siv3D.hpp>
21+
#elif defined(PAXS_USING_SFML)
22+
#include <SFML/Graphics.hpp>
23+
#endif
24+
25+
#include <PAX_GRAPHICA/String.hpp>
26+
27+
namespace paxg {
28+
29+
struct Image
30+
{
31+
#if defined(PAXS_USING_SIV3D)
32+
s3d::Image image;
33+
constexpr Image(const paxg::String& path) : image(path) {}
34+
constexpr operator s3d::Image() const { return image; }
35+
#elif defined(PAXS_USING_SFML)
36+
sf::Image image;
37+
Image(const paxg::String& path) { image.loadFromFile(path); }
38+
operator sf::Image() const { return image; }
39+
#else
40+
constexpr Image(const paxg::String& path) {}
41+
#endif
42+
};
43+
}
44+
45+
#endif // !PAX_GRAPHICA_IMAGE_HPP

Library/PAX_GRAPHICA/Rect.hpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_RECT_HPP
13+
#define PAX_GRAPHICA_RECT_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#if defined(PAXS_USING_SIV3D)
20+
#include <Siv3D.hpp>
21+
#elif defined(PAXS_USING_SFML)
22+
#include <SFML/Graphics.hpp>
23+
#endif
24+
25+
#include <PAX_GRAPHICA/IDrawable.hpp>
26+
#include <PAX_GRAPHICA/Vec2.hpp>
27+
#include <PAX_GRAPHICA/Window.hpp>
28+
29+
namespace paxg {
30+
31+
struct Rect : public paxg::IDrawable {
32+
#if defined(PAXS_USING_SIV3D)
33+
s3d::RectF rect;
34+
constexpr (const float x, const float y, const float w, const float h) : rect(x, y, w, h) {}
35+
constexpr Rect(const Vec2& pos, const Vec2& size) : rect(pos.x, pos.y, size.x, size.y) {}
36+
constexpr Rect(const Vec2& pos, const float w, const float h) : rect(pos.x, pos.y, w, h) {}
37+
constexpr Rect(const float x, const float y, const Vec2& size) : rect(x, y, size.x, size.y) {}
38+
constexpr operator s3d::RectF() const { return rect; }
39+
#elif defined(PAXS_USING_SFML)
40+
sf::RectangleShape rect;
41+
Rect(const float x, const float y, const float w, const float h) : rect(sf::Vector2f(w, h)) { rect.setPosition(x, y); }
42+
Rect(const sf::Vector2i& pos, const sf::Vector2i& size) : rect(sf::Vector2f(size.x, size.y)) { rect.setPosition(pos.x, pos.y); }
43+
Rect(const sf::Vector2i& pos, const float w, const float h) : rect(sf::Vector2f(w, h)) { rect.setPosition(pos.x, pos.y); }
44+
Rect(const float x, const float y, const sf::Vector2i& size) : rect(sf::Vector2f(size.x, size.y)) { rect.setPosition(x, y); }
45+
operator sf::RectangleShape() const { return rect; }
46+
#else
47+
float x, y, w, h;
48+
constexpr Rect(const float x, const float y, const float w, const float h) : x(x), y(y), w(w), h(h) {}
49+
constexpr Rect(const Vec2& pos, const Vec2& size) : x(pos.x), y(pos.y), w(size.x), h(size.y) {}
50+
constexpr Rect(const Vec2& pos, const float w, const float h) : x(pos.x), y(pos.y), w(w), h(h) {}
51+
constexpr Rect(const float x, const float y, const Vec2& size) : x(x), y(y), w(size.x), h(size.y) {}
52+
#endif
53+
void draw() const override {
54+
#if defined(PAXS_USING_SIV3D)
55+
rect.draw();
56+
#elif defined(PAXS_USING_SFML)
57+
Window::window.draw(rect);
58+
#endif
59+
}
60+
61+
void drawAt(const Vec2f& pos) const override {}
62+
};
63+
}
64+
65+
#endif // !PAX_GRAPHICA_RECT_HPP

Library/PAX_GRAPHICA/String.hpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*##########################################################################################
2+
3+
PAX SAPIENTICA Library 💀🌿🌏
4+
5+
[Planning] 2023 As Project
6+
[Production] 2023 As Project
7+
[Contact Us] wanotaitei@gmail.com https://github.com/AsPJT/PAX_SAPIENTICA
8+
[License] Distributed under the CC0 1.0. https://creativecommons.org/publicdomain/zero/1.0/
9+
10+
##########################################################################################*/
11+
12+
#ifndef PAX_GRAPHICA_STRING_HPP
13+
#define PAX_GRAPHICA_STRING_HPP
14+
15+
/*##########################################################################################
16+
17+
##########################################################################################*/
18+
19+
#include <string>
20+
21+
#if defined(PAXS_USING_SIV3D)
22+
#include <Siv3D.hpp>
23+
#elif defined(PAXS_USING_SFML)
24+
#include <SFML/Graphics.hpp>
25+
#endif
26+
27+
namespace paxg {
28+
29+
struct String
30+
{
31+
#if defined(PAXS_USING_SIV3D)
32+
s3d::String string;
33+
constexpr String(const s3d::String& string) : string(string) {}
34+
constexpr String(const std::string& string) : string(string.c_str()) {}
35+
constexpr operator s3d::String() const { return string; }
36+
// #elif defined(PAXS_USING_SFML)
37+
// sf::String string;
38+
// String(const sf::String& string) : string(string) {}
39+
// String(const std::string& string) : string(string.c_str()) {}
40+
// operator sf::String() const { return string; }
41+
#else
42+
std::string string;
43+
String(const std::string& string) : string(string) {}
44+
operator std::string() const { return string; }
45+
#endif
46+
};
47+
}
48+
49+
#endif // !PAX_GRAPHICA_STRING_HPP

0 commit comments

Comments
 (0)