Skip to content

Instantly share code, notes, and snippets.

View voidproc's full-sized avatar
👾
shoot 'em up

voidProc voidproc

👾
shoot 'em up
View GitHub Profile
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
void Main()
{
Scene::SetBackground(ColorF{ 0 });
while (System::Update())
{
}
}
@voidproc
voidproc / mikiri.cpp
Last active September 9, 2023 08:10
"瞬字の見切り" - OpenSiv3D Discord #game-idea のお題「読む」より
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
struct CharacterFragment
{
Vec2 pos;
double r;
Color color;
double angle;
double speed;
int motionType;
@voidproc
voidproc / MissionIn3Sec.cpp
Last active August 29, 2023 03:34
時間を止める能力を使い "3秒以内" にターゲットを破壊するゲーム(試作)- OpenSiv3D Discord #game-idea のお題「1 ゲーム 3 秒」より
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
// 【ルールと設定】
// 主人公は、仮想空間に侵入してから 3 秒以内にターゲット(PC)をすべて破壊しなければならない。
// 3 秒経過後、侵入者は防衛システムにより消去され、システムは初期状態にリセットされ、
// 主人公の別個体が初めからミッションをやり直すことになる。
// 主人公は「強い衝撃」を受けることにより *時間を少しだけ止められる* 能力があり、
// 時間に制約がある本ミッションでは大いに役立つと思われるが、体力に限りがあるため無限にこの能力を使うことはできない。
constexpr int StageCount = 3;
@voidproc
voidproc / bee.cpp
Last active August 27, 2023 09:52
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
void DrawText(StringView text, const Vec2& pos, const Vec2& scale, const Color& color, const Color& outlineColor, double outlineWidth, double letterSpacingScale)
{
Vec2 penPos{ pos };
{
const auto& font = FontAsset(U"LI");
const ScopedCustomShader2D shader{ Font::GetPixelShader(font.method(), TextStyle::Type::Outline) };
mergeInto(LibraryManager.library, {
$siv3dInputElement: null,
$siv3dDialogFileReader: null,
$siv3dDownloadLink: null,
siv3dInitDialog: function() {
siv3dInputElement = document.createElement("input");
siv3dInputElement.type = "file";
siv3dDialogFileReader = new FileReader();
@voidproc
voidproc / input-event.html
Created August 25, 2023 13:36
input[type=file]のcancelイベントが発火するか調べる用
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>input cancel event</title>
</head>
<body>
<div>
<input type="file" id="f" name="f">
// `OpenSiv3D_0.6.6_Web/lib/Siv3D.js` の `siv3dOpenDialogAsync` の抜粋
siv3dOpenDialogAsync: function(filterStr, callback, futurePtr) {
siv3dInputElement.accept = UTF8ToString(filterStr);
// これは Firefox で動作しない
// siv3dInputElement.oncancel = function(e) {
// {{{ makeDynCall('vii', 'callback') }}}(0, futurePtr);
// _siv3dMaybeAwake();
// };
@voidproc
voidproc / siv_web_dialog.cpp
Last active August 27, 2023 02:21
Platform::Web::Dialog::OpenFile の挙動の確認
# include <Siv3D.hpp> // OpenSiv3D v0.6
# if defined(SIV3D_WEBGPU_BACKEND)
SIV3D_SET(EngineOption::Renderer::WebGPU)
# endif
void Main()
{
Scene::SetBackground(ColorF{ 0 });
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
struct PolygonHighlightEffect : IEffect
{
Array<TrailMotion> trails;
Polygon polygon;
PolygonHighlightEffect(const Polygon& targetPolygon)
: polygon{ targetPolygon }
@voidproc
voidproc / siv_trail_homing_laser.cpp
Created August 12, 2023 06:21
OpenSiv3D v0.6.11 の Trail (TrailMotion) を利用してホーミングレーザー
# include <Siv3D.hpp> // OpenSiv3D v0.6.11
namespace
{
// 角度差
double AbsAngularDifference(double theta1, double theta2)
{
const double d1 = Abs(theta2 - theta1);
const double t1 = theta1 < 0 ? theta1 + Math::TwoPi : theta1;