Skip to content

Instantly share code, notes, and snippets.

@sknjpn
Created December 3, 2017 11:49
Show Gist options
  • Save sknjpn/5b60603c55603ef4ccb0bdf19757eea3 to your computer and use it in GitHub Desktop.
Save sknjpn/5b60603c55603ef4ccb0bdf19757eea3 to your computer and use it in GitHub Desktop.
#include<Siv3D.hpp>
struct Unit
{
bool enabled;
Point pos;
Unit()
: enabled(true)
, pos(Random(640), Random(480))
{}
};
void Main()
{
Array<Unit> units;
const int unitMax = 1024;
units.reserve(unitMax);
Font font(12);
for (int i = 0; i < 10; i++) units.emplace_back();
while (System::Update())
{
if(Input::MouseL.clicked) units.emplace_back();
for (auto& u : units)
{
if (!u.enabled) continue;
if (Circle(u.pos, 10).contains(Mouse::Pos())) u.enabled = false;
Circle(u.pos, 10).draw(Palette::Red);
font(L"アドレス:", &u).draw(u.pos);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment