void reset() { m_start = RandomVec2(Rect(0, 0, ConfigParam::SIZE_OF_NORMALWORLD)); m_end = RandomVec2(Rect(0, 0, ConfigParam::SIZE_OF_NORMALWORLD)); m_progress = 0; }
void Controller::update(gc::Memory<CircleObject> &memory) { if (gui_m.button(L"alloc").pushed) { int p = memory.alloc(); if (p != 0) { memory.access(p).center(RandomVec2({ 200, 600 }, { 50, Window::Height() - 50 })); } } int from = FromString<int>(gui_m.textField(L"from").text); int to = FromString<int>(gui_m.textField(L"to").text); if (gui_m.button(L"link").pushed) { memory.link(from, to); } else if (gui_m.button(L"unlink").pushed) { memory.unlink(from, to); } if (gui_m.button(L"gc").pushed) { memory.gc(); } if (gui_m.button(L"quit").pushed) { System::Exit(); } gui_m.text(L"sf").text = ToString(memory.error().segmentationFault_m) + L" : segmentation faults"; gui_m.text(L"na").text = ToString(memory.error().nullptrAccess_m) + L" : nullptr accesses"; gui_m.text(L"om").text = ToString(memory.error().outOfMemory_m) + L" : out of memory"; gui_m.text(L"ob").text = ToString(memory.error().addressOutOfBounds_m) + L" : address out of bounds"; }
BossVanish(const Vec2& pos, const double size) : m_pos(pos), m_size(size), m_s(20), m_easing(0.0, size, Easing::Quint, 200) { for (int i = 0; i < 10; ++i) { m_particles.push_back(TimedParticle(pos, 60, RandomVec2(3.0), Vec2(0, -0.3))); } m_easing.start(); }
bool ScreenShake::update(double timeSec) { const double timeMillisec = timeSec * 1000.0; const Vec2 offset = RandomVec2(Circle(offset * Max(1.0 - timeMillisec / lengthMillSec, 0.0))); Graphics2D::SetTransform(Mat3x2::Translate(offset)); return timeMillisec < lengthMillSec; }
CrashEffect::CrashEffect(Vec2 pos) { for (int i : step(10)) { particles.emplace_back(pos, RandomVec2(5.0), 0.0); } }