This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.16 | |
| constexpr RectF layoutRect(const RectF& rect, double width, double height) | |
| { | |
| return RectF(Arg::center = rect.center(), width, height); | |
| } | |
| constexpr RectF layoutRect(const RectF& rect, Arg::left_<double> left, double width, double height) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.16 | |
| struct Refraction { | |
| Float2 uvPos; | |
| Float2 uvSize; | |
| }; | |
| // 近傍のcircleの縁からpointへの内向き法線ベクトルと距離を計算する | |
| std::pair<Vec2, double> calcInnerNormalDistance(const Vec2& point, const Circle& circle) { | |
| Vec2 dir = point - circle.center; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> | |
| // Tがstd::hashを持つかをチェックするコンセプト | |
| template <typename T> | |
| concept is_std_hashable = requires(const T & val) { | |
| { std::hash<T>{}(val) } -> std::same_as<std::size_t>; | |
| }; | |
| // ハッシュ値をキャッシュするラッパークラス | |
| template <typename T> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.16 | |
| Shape2D makeSmoothShape(const RoundRect& roundRect) { | |
| //頂点と三角形インデックスのサンプルをキャッシュ | |
| static Array<Float2> sampleVertices; | |
| static Array<TriangleIndex> sampleIndices; | |
| constexpr Vec2 sampleSize{ 4,4 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.16 | |
| void Main() | |
| { | |
| Window::Resize(800, 800); | |
| Scene::SetBackground(Palette::Black); | |
| Font font(FontMethod::MSDF, 30, Typeface::Heavy); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.15 | |
| struct ScrollBar | |
| { | |
| RectF moveArea; | |
| Optional<double> dragOffset; | |
| double viewHeight = 600; | |
| double pageHeight = 1000; | |
| double viewTop = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> // Siv3D v0.6.15 | |
| struct AnimeGlyph : Glyph | |
| { | |
| Array<std::pair<LineString,double>> lines; | |
| static constexpr double lineSpeed = 3; | |
| AnimeGlyph(const Glyph& glyph, const Array<LineString> lineStrings) | |
| : Glyph( glyph ), lines(lineStrings.map([](const LineString& lineString) { return std::make_pair(lineString, lineString.calculateLength()); })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> | |
| struct Particle | |
| { | |
| Vec2 pos{}; | |
| Vec2 vel{}; | |
| }; | |
| void Main() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> | |
| //与えるTextureは全て異なるものである必要がある。 | |
| void GaussianBlur(const TextureRegion& from, const RenderTexture& internalBuffer, const RenderTexture& internalBuffer2, const RenderTexture& to, | |
| double t = 1.0, BoxFilterSize boxFilterSize = BoxFilterSize::BoxFilter9x9) | |
| { | |
| //t=0,1,2,4,8,16,32...ごとに区切り、ミックスする。tは何倍縮小してぼかしをかけるかを表す。0の場合はそのまま描画する。 | |
| double floor_t = 0; | |
| double ceil_t = 1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # include <Siv3D.hpp> | |
| class Mirror { | |
| public: | |
| Mesh mesh; | |
| Vec3 offset{}; | |
| Quaternion quaternion; | |
| Mirror() = default; |
NewerOlder