aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-03-23 08:24:55 -0400
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-03-23 08:24:55 -0400
commit4e60d3e2d3f66471dff75732626451690a5bc8b5 (patch)
tree11d8be239c4c09ce6e3c91ccd6032cadfc97d964 /src/ui.cpp
parentafdbe5de31c9ae1009d36710eb2b1c31ec44a9f5 (diff)
Flickering lights and light that follows player
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 458e797..f0736a5 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -1445,10 +1445,18 @@ EXIT:
heyOhLetsGo = 0;
break;
case SDLK_l:
- player->light^=true;
+ currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
+ currentWorld->light.back().belongsTo = true;
+ currentWorld->light.back().following = player;
+ currentWorld->light.back().flame = true;
break;
case SDLK_f:
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
+ std::cout << currentWorld->light.back().belongsTo << std::endl;
+ currentWorld->light.back().belongsTo = false;
+ std::cout << currentWorld->light.back().belongsTo << std::endl;
+ currentWorld->light.back().following = nullptr;
+ currentWorld->light.back().flame = true;
break;
case SDLK_g:
//currentWorld->addStructure(LAMP_POST, player->loc.x, player->loc.y, NULL);
@@ -1465,13 +1473,15 @@ EXIT:
case SDLK_b:
currentWorld->addStructure(FIRE_PIT, player->loc.x, player->loc.y, "", "");
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
+ currentWorld->light.back().belongsTo = false;
+ currentWorld->light.back().following = nullptr;
+ currentWorld->light.back().flame = true;
break;
case SDLK_F12:
// Make the BYTE array, factor of 3 because it's RBG.
static GLubyte* pixels;
pixels = new GLubyte[ 3 * SCREEN_WIDTH * SCREEN_HEIGHT];
glReadPixels(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE, pixels);
-
//static std::thread scr;
//scr = std::thread(takeScreenshot,pixels);
//scr.detach();