From 0dc897fe78c41d0420105f3a1ce02b31fcf5d376 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Wed, 16 Sep 2015 18:00:38 -0400 Subject: Fixed Conflicts Had to remove -Wextra because it didn't allow for int argc, char** argv and SDL requires those in the main function. Also removed glActiveTexture() because it wasn't declared, currently everything works fine without it, but I'll find a way to fix it soon, but for now it works. --- src/UIClass.cpp | 23 +++++++++-------------- src/main.cpp | 32 ++++++++++++-------------------- 2 files changed, 21 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/UIClass.cpp b/src/UIClass.cpp index 94aa09c..eec7bec 100644 --- a/src/UIClass.cpp +++ b/src/UIClass.cpp @@ -1,5 +1,4 @@ #include - #include #include FT_FREETYPE_H @@ -42,7 +41,7 @@ namespace ui { std::cout<<"Error! Invalid character."<infront){ - player.loc.x+=(currentWorld->infront->getWidth()-currentWorld->getWidth())/2; - memset(&player.vel,0,sizeof(vec2)); - currentWorld=currentWorld->infront; - } - } - break; if(e.key.keysym.sym == SDLK_i){ if(currentWorld->behind){ thing=(currentWorld->getWidth()-currentWorld->behind->getWidth())/2; @@ -153,7 +144,13 @@ namespace ui { } } } - } + if(e.key.keysym.sym == SDLK_k){ + if(currentWorld->infront){ + player.loc.x+=(currentWorld->infront->getWidth()-currentWorld->getWidth())/2; + memset(&player.vel,0,sizeof(vec2)); + currentWorld=currentWorld->infront; + } + } if(e.key.keysym.sym == SDLK_F3){ debug = !debug; } @@ -164,11 +161,9 @@ namespace ui { if(e.key.keysym.sym == SDLK_LSHIFT) player.speed = 1.0; if(e.key.keysym.sym == SDLK_SPACE) if(player.vel.y<=.001)space=false; - if(e.key.keysym.sym == SDLK_ESCAPE) gameRunning = false; break; } } - } -} +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 3b525d5..73b1918 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -35,7 +35,7 @@ unsigned int millis(void){ return std::chrono::duration_cast(now.time_since_epoch()).count(); } -int main(/*int argc,char **argv*/){ +int main(int argc, char *argv[]){ //runs start-up procedures if(!SDL_Init(SDL_INIT_VIDEO)){ atexit(SDL_Quit); @@ -47,7 +47,7 @@ int main(/*int argc,char **argv*/){ //Turn on double Buffering SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //ANTIALIASING!!! - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 16); //create the window window = SDL_CreateWindow("Independent Study v.0.2 alpha", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL @@ -193,19 +193,19 @@ void render(){ **************************/ //DRAW MOUSE HERE!!!!! - mx=(ui.mousex/(float)SCREEN_WIDTH)*2.0f-1.0f; - my=((SCREEN_HEIGHT-ui.mousey)/(float)SCREEN_HEIGHT)*2.0f-1.0f; + mx=(ui::mousex/(float)SCREEN_WIDTH)*2.0f-1.0f; + my=((SCREEN_HEIGHT-ui::mousey)/(float)SCREEN_HEIGHT)*2.0f-1.0f; if(player.loc.x-1>-1 && player.loc.x-1<-3+currentWorld->getWidth()){ - if(ui.debug) - ui.putText(-.98 + player.loc.x, .94, "FPS: %1.0f\nDT: %1.0f",fps, d); + if(ui::debug) + ui::putText(-.98 + player.loc.x, .94, "FPS: %1.0f\nDT: %1.0f",fps, d); mx+=player.loc.x; }else if(player.loc.x-1>=-3+currentWorld->getWidth()){ - if(ui.debug) - ui.putText(-.98 + -2+currentWorld->getWidth(), .94, "FPS: %1.0f\nDT: %1.0f",fps, d); + if(ui::debug) + ui::putText(-.98 + -2+currentWorld->getWidth(), .94, "FPS: %1.0f\nDT: %1.0f",fps, d); mx =mx-1 + -1+currentWorld->getWidth(); }else{ - if(ui.debug) - ui.putText(-.98, .94, "FPS: %1.0f\nDT: %1.0f",fps, d); + if(ui::debug) + ui::putText(-.98, .94, "FPS: %1.0f\nDT: %1.0f",fps, d); } glBegin(GL_TRIANGLES); @@ -257,19 +257,11 @@ void logic(){ if((mx > entnpc[i]->loc.x && mx < entnpc[i]->loc.x + entnpc[i]->width) && (my > entnpc[i]->loc.y && my < entnpc[i]->loc.y + entnpc[i]->height)&&(SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))){ if(pow((entnpc[i]->loc.x - player.loc.x),2) + pow((entnpc[i]->loc.y - player.loc.y),2) < pow(.2,2)){ entnpc[i]->interact(); - ui.putText(entnpc[i]->loc.x, entnpc[i]->loc.y - HLINE * 3, "HEY", NULL); + ui::putText(entnpc[i]->loc.x, entnpc[i]->loc.y - HLINE * 3, "HEY", NULL); } } - - /*for(int i = 0; i < 32; i++){ - if(entnpc[i]->alive){ - currentWorld->detect(&entnpc[i]->loc,&entnpc[i]->vel,entnpc[i]->width); - std::cout<<(void *)entnpc[i]<<" "<wander(30, &entnpc[i]->vel); - } - } - */ + } tickCount++; } -- cgit v1.2.3