]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Fixed Conflicts
authorAndy Belle-Isle <abelleisle@roadrunner.com>
Wed, 16 Sep 2015 22:00:38 +0000 (18:00 -0400)
committerAndy Belle-Isle <abelleisle@roadrunner.com>
Wed, 16 Sep 2015 22:00:38 +0000 (18:00 -0400)
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.

Makefile
include/UIClass.h
src/UIClass.cpp
src/main.cpp

index 66b1c7f7a95cdfe2ce70a62c73c65f6c7c51979e..7b8b834353f327173311f1114f68ae7e0539c932 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 FLAGS_LINUX = -lGL                 -lSDL2_image -lfreetype\r
 FLAGS_WIN32 = -lopengl32 -lmingw32 -lSDL2_Image -lfreetype\r
-FLAGS = -m32 -std=c++11 -Iinclude -Iinclude/freetype2 -Wall -Werror -Wextra -lSDL2main -lSDL2\r
+FLAGS = -m32 -std=c++11 -Iinclude -Iinclude/freetype2 -Wall -Werror -lSDL2main -lSDL2\r
 \r
 all:\r
        @g++ src/*.cpp -o main $(FLAGS_LINUX) $(FLAGS)\r
index 867044edc75df243fecfe653ad2f79a3e6a9dcdc..ed075514b39a375a91ee377773b282fed4441afa 100644 (file)
@@ -7,6 +7,7 @@
 \r
 namespace ui {\r
        extern int mousex,mousey;\r
+       extern bool debug;\r
        void init(const char *ttf);\r
        void setFontSize(unsigned int fs);\r
        void putText(const float x,const float y,const char *s,...);\r
index 94aa09c084f9e199e033a5beab5057d012fa314b..eec7becd7883e537e48ed7660428aa723f1bd65f 100644 (file)
@@ -1,5 +1,4 @@
 #include <UIClass.h>
-
 #include <ft2build.h>
 #include FT_FREETYPE_H
 
@@ -42,7 +41,7 @@ namespace ui {
                                        std::cout<<"Error! Invalid character."<<std::endl;
                                        return;
                                }
-                               glActiveTexture(GL_TEXTURE0);
+                               //glActiveTexture(GL_TEXTURE0);
                                glGenTextures(1,&ftex);
                                glBindTexture(GL_TEXTURE_2D,ftex);
                                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
@@ -134,14 +133,6 @@ namespace ui {
                                                player.vel.y += .003;
                                        }
                                }
-                               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;
-                                       }
-                               }
-                               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
index 3b525d5caad42d6fb0016fe5c180ba25cee5e660..73b1918aa484500e9c812499543d2bf235218c66 100644 (file)
@@ -35,7 +35,7 @@ unsigned int millis(void){
        return std::chrono::duration_cast<std::chrono::milliseconds>(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]<<" "<<i<<" "<<entnpc<<" "<<eAmt(entnpc)<<std::endl;
-                       entnpc[i]->wander(30, &entnpc[i]->vel);
-
                }
-       }
-       */
        
+       }
        tickCount++;
 }