aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-04-05 08:48:29 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-04-05 08:48:29 -0400
commit16920d744a2e638f564753f15f1269f51c131b6b (patch)
treeae3ee1ba2b2f7a92c196347853e0c82e2dd14973 /src/ui.cpp
parent4ea7b19bf2d4c64719471a53e6223aac7c250585 (diff)
sword improvements, page threading
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 69ff7e3..c9f91ab 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -632,6 +632,11 @@ namespace ui {
void drawPage( std::string path ) {
pageTex = Texture::loadTexture( path );
+ std::cout<<"page set\n";
+ }
+
+ bool pageExists( void ) {
+ return pageTex;
}
void draw(void){
@@ -641,6 +646,8 @@ namespace ui {
if ( pageTex ) {
+ std::cout<<"page draw\n";
+
glEnable( GL_TEXTURE_2D);
glBindTexture( GL_TEXTURE_2D, pageTex );
glBegin( GL_QUADS );
@@ -1204,6 +1211,7 @@ namespace ui {
unsigned char i;
if ( pageTex ) {
+ std::cout<<"rip page\n";
glDeleteTextures( 1, &pageTex );
pageTex = 0;
return;
@@ -1280,7 +1288,12 @@ EXIT:
break;
case SDL_MOUSEBUTTONUP:
- if(ig) {
+
+ // right click advances dialog
+ if ( ( e.button.button & SDL_BUTTON_RIGHT ) && (dialogBoxExists | pageTex) )
+ dialogAdvance();
+
+ if ( ig ) {
ig->vel.x = (fr.x - mouse.x) / 50.0f;
ig->vel.y = (fr.y - mouse.y) / 50.0f;
ig = NULL;
@@ -1289,9 +1302,7 @@ EXIT:
// mouse clicks
case SDL_MOUSEBUTTONDOWN:
- // right click advances dialog
- if ( ( e.button.button & SDL_BUTTON_RIGHT ) && (dialogBoxExists | pageTex) )
- dialogAdvance();
+
// left click uses item
if ( ( e.button.button & SDL_BUTTON_LEFT ) && !dialogBoxExists )
player->inv->usingi = true;
@@ -1397,9 +1408,6 @@ EXIT:
} else if( (tmp = currentWorld->goInsideStructure( player )) != currentWorld )
currentWorld = tmp;
break;
- case SDLK_i:
- player->health -= 5;
- break;
case SDLK_LSHIFT:
if(debug){
Mix_PlayChannel(1,sanic,-1);
@@ -1410,12 +1418,6 @@ EXIT:
case SDLK_LCTRL:
player->speed = .5;
break;
- case SDLK_F3:
- debug ^= true;
- break;
- case SDLK_b:
- if(debug)posFlag ^= true;
- break;
case SDLK_e:
edown=true;
if(!heyOhLetsGo){
@@ -1447,7 +1449,10 @@ EXIT:
player->save();
return;
}
- switch(SDL_KEY){
+ switch ( SDL_KEY ) {
+ case SDLK_F3:
+ debug ^= true;
+ break;
case SDLK_z:
weather = WorldWeather::Snowy;
break;
@@ -1497,23 +1502,15 @@ EXIT:
case SDLK_f:
currentWorld->addLight({player->loc.x + SCREEN_WIDTH/2, player->loc.y},{1.0f,1.0f,1.0f});
break;
- case SDLK_g:
- //currentWorld->addStructure(LAMP_POST, player->loc.x, player->loc.y, NULL);
- break;
- case SDLK_h:
- //currentWorld->addStructure(TOWN_HALL, player->loc.x, player->loc.y, NULL);
- break;
- case SDLK_j:
- //currentWorld->addStructure(FOUNTAIN, player->loc.x, player->loc.y, NULL);
- break;
- case SDLK_v:
- //currentWorld->addVillage(player->loc.x, player->loc.y, 5, 10, 100, NULL);
- break;
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().follow(currentWorld->build.back());
- currentWorld->light.back().makeFlame();
+ if ( debug )
+ posFlag ^= true;
+ else {
+ 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().follow(currentWorld->build.back());
+ currentWorld->light.back().makeFlame();
+ }
break;
case SDLK_F12:
// Make the BYTE array, factor of 3 because it's RBG.