From f28fda996331de5dac8fc2f20ea0898527239fe5 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 7 Oct 2015 08:39:53 -0400 Subject: world improvement --- main.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index e1b8d3d..9a457d1 100644 --- a/main.cpp +++ b/main.cpp @@ -11,6 +11,7 @@ SDL_Window *window = NULL; SDL_Surface *renderSurface = NULL; SDL_GLContext mainGLContext = NULL; +static GLuint bgImage; bool gameRunning = true; @@ -107,6 +108,8 @@ int main(int argc, char *argv[]){ } Mix_PlayMusic( music, -1 ); + bgImage=loadTexture("assets/bg.png"); + while(gameRunning){ mainLoop(); } @@ -184,10 +187,19 @@ void render(){ **** RENDER STUFF HERE **** **************************/ - currentWorld->draw(&player->loc); // Draw the world around the player - glColor3ub(255,255,255); + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D,bgImage); + glBegin(GL_QUADS); + glTexCoord2i(0,1);glVertex2i(-SCREEN_WIDTH*2,0); + glTexCoord2i(1,1);glVertex2i( SCREEN_WIDTH*2,0); + glTexCoord2i(1,0);glVertex2i( SCREEN_WIDTH*2,SCREEN_HEIGHT); + glTexCoord2i(0,0);glVertex2i(-SCREEN_WIDTH*2,SCREEN_HEIGHT); + glEnd(); + glDisable(GL_TEXTURE_2D); + player->near=true; - player->draw(); // Draw the player + currentWorld->draw(player); // Draw the world & the player + glColor3ub(255,255,255); player->inv->draw(); ui::draw(); // Draw any UI elements if they need to be -- cgit v1.2.3