Skip to content

Instantly share code, notes, and snippets.

# include <Siv3D.hpp>
struct Planet
{
Vec2 pos;
Vec2 v;
int id;
};
void Main()
# include <Siv3D.hpp> //OpenSiv3D v0.1.5
# include <HamFramework.hpp>
struct Node
{
Vec2 pos;
double mass;
bool isFixed;
Vec2 v;
Array<Node*> spring;
Vec2 f;
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
# include <HamFramework.hpp>
struct Unit
{
Unit(const Vec2& _pos)
: pos(_pos)
, isPlant(RandomBool(0.95))
, angle(RandomVec2(1.0))
, v(RandomVec2(0.0))
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
struct Bug
{
Bug() {}
Bug(const int& _type) : type(_type) {}
int type = Random(4);
Vec2 p = { -16, Random(Window::Center().y - 120, Window::Center().y + 120) };
double v = Random(1.0, 2.0);
Vec2 dv = { 0, 0 };
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
struct Ball
{
Ball(const Vec2& _p, const Vec2& _v) : p(_p), v(_v) {}
Vec2 p;
Vec2 v;
};
void Main()
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
struct Glass
{
Glass(const Vec2& _pos, const double& _n, const double& _r)
: pos(_pos), n(_n), r(_r) {}
Vec2 pos;
double n;
double r;
# include <Siv3D.hpp>
# include <HamFramework.hpp>
struct Compass
{
Compass(const Vec2& _pos) : pos(_pos), ang(Vec2::Up), v(0.0) {}
Vec2 pos;
Vec2 ang;
double v;
# include <Siv3D.hpp>
struct Junction
{
Junction(const Vec2& _pos)
: pos(_pos), temp(false), family(-1) {}
Vec2 pos;
bool temp;
int family;
Array<Junction*> connects;
@sknjpn
sknjpn / Angry_face
Last active July 10, 2017 13:11
OpenSiv3D v0.1.5にて作成したサンプル、ご自由にお持ちください。
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
struct Face
{
Texture tex;
Point pos;
Vec2 dPos;
};
void Main()
@sknjpn
sknjpn / Compass_simulator_with_OpenSiv3D
Created July 10, 2017 13:51
OpenSiv3Dで書き直しました。磁石のシミュレータです。ご自由にお持ちください。
# include <Siv3D.hpp> // OpenSiv3D v0.1.5
//方位磁針
struct Compass
{
Compass(const Vec2& _pos) : pos(_pos), ang(Vec2::Up()), v(0) {}
Vec2 pos; //位置座標
Vec2 ang; //現在角度
double v; //回転速度
};