From 7644b740e87053838f3c7a80e88ad192fcf1a5e2 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 21 Oct 2017 13:50:04 -0400 Subject: lightsgit status! fireflies --- include/components/all.hpp | 1 + include/components/light.hpp | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 include/components/light.hpp (limited to 'include/components') diff --git a/include/components/all.hpp b/include/components/all.hpp index 7c4e0d1..3c243a7 100644 --- a/include/components/all.hpp +++ b/include/components/all.hpp @@ -13,6 +13,7 @@ #include "hit.hpp" #include "hop.hpp" #include "itemdrop.hpp" +#include "light.hpp" #include "name.hpp" #include "physics.hpp" #include "player.hpp" diff --git a/include/components/light.hpp b/include/components/light.hpp new file mode 100644 index 0000000..95fe6ec --- /dev/null +++ b/include/components/light.hpp @@ -0,0 +1,26 @@ +#ifndef COMPONENTS_LIGHT_HPP_ +#define COMPONENTS_LIGHT_HPP_ + +#include +#include +#include +#include + +struct Illuminate : public Component { + int index; + + Illuminate(vec2 pos, float radius, Color color) { + index = LightSystem::addLight(pos, radius, color); + } + Illuminate(XMLElement* imp, XMLElement* def) { + fromXML(imp, def); + } + + void fromXML(XMLElement* imp, XMLElement* def) final { + (void)imp; + float radius = def->FloatAttribute("radius"); + index = LightSystem::addLight(vec2(), radius, Color(1, 1, 0)); + } +}; + +#endif // COMPONENTS_LIGHT_HPP_ -- cgit v1.2.3