aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-12-08 15:56:24 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-12-08 15:56:24 -0500
commit07432bdce4ec75eb0f41e81eed1a2cdf1b606eb2 (patch)
treea37e1d8e3e6ab24efa8d258642f2cd9e26692237 /src
parent443b77e47a7ef3a137e39c64abb277229a665d03 (diff)
parent887a2da911805fe93b2bd33b39226f433641dee7 (diff)
Merge branch 'master' of http://github.com/tcsullivan/gamedev
Diffstat (limited to 'src')
-rw-r--r--src/Texture.cpp4
-rw-r--r--src/ui.cpp24
-rw-r--r--src/world.cpp5
3 files changed, 22 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
-}
diff --git a/src/ui.cpp b/src/ui.cpp
index e6dadc2..6fa2770 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -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..2bceba5 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -277,11 +277,12 @@ void World::update(Player *p,unsigned int delta){
*/
for(auto &e : entity){
- if(e->type != STRUCTURET)
+ e->loc.y += e->vel.y * delta;
+ if(e->type != STRUCTURET && 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;
+ }
}
}