]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Added proof of concept tree layer
authordrumsetmonkey <abelleisle@roadrunner.com>
Tue, 27 Oct 2015 12:41:26 +0000 (08:41 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Tue, 27 Oct 2015 12:41:26 +0000 (08:41 -0400)
assets/antree.png [new file with mode: 0644]
main.cpp

diff --git a/assets/antree.png b/assets/antree.png
new file mode 100644 (file)
index 0000000..c3d9146
Binary files /dev/null and b/assets/antree.png differ
index f0073848d4ee46d7703665c95f688ea0bddb282e..e24e89d9ed470a6de3b25e804fe850a563a947c0 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -49,8 +49,7 @@ SDL_GLContext  mainGLContext = NULL;
  * 
 */
 
-static GLuint  bgImage;
-static GLuint  bgFar;
+static GLuint  bgImage, bgTreesFirst;
 
 /*
  *     gameRunning
@@ -368,7 +367,7 @@ int main(int argc, char *argv[]){
        */
        
        bgImage=Texture::loadTexture("assets/bg.png");
-       bgFar = Texture::loadTexture("assets/bgfarMountains.png");
+       bgTreesFirst =  Texture::loadTexture("assets/antree.png");
        
        /*
         *      Load sprites used in the inventory menu. See src/inventory.cpp
@@ -556,13 +555,13 @@ void render(){
                glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH*2,SCREEN_HEIGHT);
        glEnd();
 
-       glBindTexture(GL_TEXTURE_2D, bgFar);
-       glColor4ub(255,255,255,155);
+       glBindTexture(GL_TEXTURE_2D, bgTreesFirst);
+       glColor4ub(255,255,255,200);
        glBegin(GL_QUADS);
-               glTexCoord2i(0,1);glVertex2i(-SCREEN_WIDTH,0);
-               glTexCoord2i(1,1);glVertex2i( SCREEN_WIDTH,0);
-               glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH,391);
-               glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH,391);
+               glTexCoord2i(0,1);glVertex2i(0          +player->loc.x*.25,     100);
+               glTexCoord2i(1,1);glVertex2i(7680       +player->loc.x*.25,     100);
+               glTexCoord2i(1,0);glVertex2i(7680       +player->loc.x*.25,     2260);
+               glTexCoord2i(0,0);glVertex2i(0          +player->loc.x*.25,     2260);
        glEnd();
        glDisable(GL_TEXTURE_2D);