Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Library/PAX_GRAPHICA/Circle.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*##########################################################################################
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

Expand All @@ -20,9 +20,12 @@
#include <Siv3D.hpp>
#elif defined(PAXS_USING_SFML)
#include <SFML/Graphics.hpp>
#elif defined(PAXS_USING_DXLIB)
#include <DxLib.h>
#endif

#include <PAX_GRAPHICA/IDrawable.hpp>
#include <PAX_GRAPHICA/Vec2.hpp>
#include <PAX_GRAPHICA/Window.hpp>

namespace paxg {
Expand All @@ -32,7 +35,7 @@ namespace paxg {
#if defined(PAXS_USING_SIV3D)
s3d::Circle circle;
constexpr Circle(const float x, const float y, const float r) : circle(x, y, r) {}
constexpr Circle(const Vec2& pos, const float r) : circle(pos.x, pos.y, r) {}
constexpr Circle(const paxg::Vec2i& pos, const float r) : circle(pos.x(), pos.y(), r) {}
constexpr operator s3d::Circle() const { return circle; }
#elif defined(PAXS_USING_SFML)
sf::CircleShape circle;
Expand All @@ -42,7 +45,7 @@ namespace paxg {
#else
float x, y, r;
constexpr Circle(const float x, const float y, const float r) : x(x), y(y), r(r) {}
constexpr Circle(const Vec2& pos, const float r) : x(pos.x), y(pos.y), r(r) {}
constexpr Circle(const paxg::Vec2i& pos, const float r) : x(pos.x()), y(pos.y()), r(r) {}
#endif
void draw() const override {
#if defined(PAXS_USING_SIV3D)
Expand All @@ -56,4 +59,4 @@ namespace paxg {
};
}

#endif // !PAX_GRAPHICA_CIRCLE_HPP
#endif // !PAX_GRAPHICA_CIRCLE_HPP
24 changes: 17 additions & 7 deletions Library/PAX_GRAPHICA/Color.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*##########################################################################################
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

Expand All @@ -20,25 +20,35 @@
#include <Siv3D/Color.hpp>
#elif defined(PAXS_USING_SFML)
#include <SFML/Graphics/Color.hpp>
#elif defined(PAXS_USING_DXLIB)
#include <DxLib.h>
#endif

namespace paxg {

// R 赤
// G 緑
// B 青
// A 不透明度
struct Color {
#if defined(PAXS_USING_SIV3D)
s3d::Color color;
constexpr Color(const int r, const int g, const int b, const int a) : color(r, g, b, a) {}
constexpr s3d::Color() const { return color; }
constexpr Color(const int r, const int g, const int b, const int a = 255) :
color(static_cast<s3d::Color::value_type>(r),
static_cast<s3d::Color::value_type>(g),
static_cast<s3d::Color::value_type>(b),
static_cast<s3d::Color::value_type>(a)) {}
operator s3d::Color() const { return color; }
#elif defined(PAXS_USING_SFML)
sf::Color color;
Color(const int r, const int g, const int b, const int a) : color(r, g, b, a) {}
Color(const int r, const int g, const int b, const int a = 255) : color(r, g, b, a) {}
operator sf::Color() const { return color; }
#else
int r, g, b, a;
constexpr Color(int r, int g, int b, int a) : r(r), g(g), b(b), a(a) {}
int r, g, b, a = 255;
constexpr Color(int r, int g, int b, int a = 255) : r(r), g(g), b(b), a(a) {}
#endif
};

}

#endif // !PAX_GRAPHICA_COLOR_HPP
#endif // !PAX_GRAPHICA_COLOR_HPP
4 changes: 2 additions & 2 deletions Library/PAX_GRAPHICA/Graphics.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*##########################################################################################
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

Expand All @@ -21,4 +21,4 @@
#include <PAX_GRAPHICA/Texture.hpp>
#include <PAX_GRAPHICA/Window.hpp>

#endif // !PAX_GRAPHICA_GRAPHICS_HPP
#endif // !PAX_GRAPHICA_GRAPHICS_HPP
5 changes: 3 additions & 2 deletions Library/PAX_GRAPHICA/IDrawable.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*##########################################################################################
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

Expand Down Expand Up @@ -27,8 +27,9 @@ namespace paxg {
virtual void draw() const = 0;

virtual void drawAt(const Vec2f& pos) const = 0;
virtual void drawAt(const Vec2i& pos) const = 0;
};

}

#endif // !PAX_GRAPHICA_IDRAWABLE_HPP
#endif // !PAX_GRAPHICA_IDRAWABLE_HPP
8 changes: 5 additions & 3 deletions Library/PAX_GRAPHICA/Image.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*##########################################################################################
/*##########################################################################################

PAX SAPIENTICA Library 💀🌿🌏

Expand All @@ -20,6 +20,8 @@
#include <Siv3D.hpp>
#elif defined(PAXS_USING_SFML)
#include <SFML/Graphics.hpp>
#elif defined(PAXS_USING_DXLIB)
#include <DxLib.h>
#endif

#include <PAX_GRAPHICA/String.hpp>
Expand All @@ -30,7 +32,7 @@ namespace paxg {
{
#if defined(PAXS_USING_SIV3D)
s3d::Image image;
constexpr Image(const paxg::String& path) : image(path) {}
Image(const paxg::String& path) : image(path.string) {}
constexpr operator s3d::Image() const { return image; }
#elif defined(PAXS_USING_SFML)
sf::Image image;
Expand All @@ -42,4 +44,4 @@ namespace paxg {
};
}

#endif // !PAX_GRAPHICA_IMAGE_HPP
#endif // !PAX_GRAPHICA_IMAGE_HPP
Loading