diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-08 08:35:21 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-12-08 08:35:21 -0500 |
commit | 49411238b04f3510d18617d1498622cf199c617d (patch) | |
tree | 2cd27693a1a4924d5332f592f666ea49a159544e /src | |
parent | fdd51ab588a2ec9fca54215039803d187a10178e (diff) |
documentation, dialog box borders
Diffstat (limited to 'src')
-rw-r--r-- | src/Texture.cpp | 4 | ||||
-rw-r--r-- | src/ui.cpp | 24 | ||||
-rw-r--r-- | src/world.cpp | 6 |
3 files changed, 23 insertions, 11 deletions
diff --git a/src/Texture.cpp b/src/Texture.cpp index 5e5651d..5e367a9 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -100,7 +100,3 @@ void Texturec::bindNext(){ void Texturec::bindPrev(){ bind(--texState); } - -void Texturec::walk(){ - // hey -} @@ -480,11 +480,20 @@ namespace ui { } }else{ - glColor3ub(0,0,0); - x=offset.x-SCREEN_WIDTH/2+HLINE*8; y=(offset.y+SCREEN_HEIGHT/2)-HLINE*8; + + glColor3ub(255,255,255); + glBegin(GL_LINE_STRIP); + glVertex2f(x-1 ,y+1); + glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y+1); + glVertex2f(x+1+SCREEN_WIDTH-HLINE*16,y-1-SCREEN_HEIGHT/4); + glVertex2f(x-1 ,y-1-SCREEN_HEIGHT/4); + glVertex2f(x-1 ,y+2); + glEnd(); + + glColor3ub(0,0,0); glRectf(x,y,x+SCREEN_WIDTH-HLINE*16,y-SCREEN_HEIGHT/4); rtext=typeOut(dialogBoxText); @@ -543,6 +552,7 @@ namespace ui { } } void handleEvents(void){ + static bool left=true,right=false; static vec2 premouse={0,0}; static int heyOhLetsGo = 0; unsigned char i; @@ -603,12 +613,16 @@ DONE: player->vel.x=-.15; player->left = true; player->right = false; + left = true; + right = false; currentWorld=currentWorld->goWorldLeft(player); break; case SDLK_d: player->vel.x=.15; player->right = true; player->left = false; + left = false; + right = true; currentWorld=currentWorld->goWorldRight(player); break; case SDLK_s: @@ -682,10 +696,10 @@ DONE: case SDL_KEYUP: switch(SDL_KEY){ case SDLK_a: - player->left = false; + left = false; break; case SDLK_d: - player->right = false; + right = false; break; case SDLK_LSHIFT: player->speed = 1; @@ -714,7 +728,7 @@ DONE: break; } - if(!player->left&&!player->right) + if(!left&&!right) player->vel.x=0; break; diff --git a/src/world.cpp b/src/world.cpp index 1e37a78..13605da 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -277,11 +277,13 @@ void World::update(Player *p,unsigned int delta){ */ for(auto &e : entity){ - if(e->type != STRUCTURET) - e->loc.x += e->vel.x * delta; + if(e->type != STRUCTURET){ + if(e->canMove) + e->loc.x += e->vel.x * delta; e->loc.y += e->vel.y * delta; if(e->vel.x < 0)e->left = true; else if(e->vel.x > 0)e->left = false; + } } } |