Lights are now working correctly. Need to update the kernel to account for multiple lights, and add sfEventSubscriber to the LightHandler

This commit is contained in:
MitchellHansen
2017-02-11 23:16:09 -08:00
parent 6e0d5814e1
commit e364c5380d
5 changed files with 16 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
#include "LightController.h"
#include "LightHandle.h"
#include <numeric>
#include <SFML/System/Time.hpp>
@@ -9,20 +10,22 @@ LightController::LightController(std::shared_ptr<Hardware_Caster> raycaster) : p
std::iota(open_list.begin(), open_list.end(), 0);
raycaster->assign_lights(&packed_data_array);
}
LightController::~LightController() {
}
std::unique_ptr<LightHandle> LightController::create_light(LightPrototype light_prototype) {
std::shared_ptr<LightHandle> LightController::create_light(LightPrototype light_prototype) {
unsigned int index = open_list.front();
open_list.pop_front();
std::unique_ptr<PackedData> data(&packed_data_array.data()[index]);
PackedData* data = &packed_data_array.data()[index];
std::unique_ptr<LightHandle> handle(new LightHandle(this, index, light_prototype, std::move(data)));
std::shared_ptr<LightHandle> handle(new LightHandle(this, index, light_prototype, data));
return handle;