diff options
-rw-r--r-- | assets/door.png | bin | 0 -> 252 bytes | |||
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | main.cpp | 21 | ||||
-rw-r--r-- | src/ui.cpp | 2 | ||||
-rw-r--r-- | test.frag | 2 |
5 files changed, 8 insertions, 19 deletions
diff --git a/assets/door.png b/assets/door.png Binary files differnew file mode 100644 index 0000000..7db551d --- /dev/null +++ b/assets/door.png diff --git a/include/common.h b/include/common.h index 08ec73f..5c90222 100644 --- a/include/common.h +++ b/include/common.h @@ -70,7 +70,7 @@ typedef struct{ * The desired width of the game window. */ -#define SCREEN_WIDTH 1024 +#define SCREEN_WIDTH 1280 /** * The desired height of the game window. @@ -344,7 +344,7 @@ int main(/*int argc, char *argv[]*/){ fragShader = glCreateShader(GL_FRAGMENT_SHADER); - std::string shaderFileContents = readFile("shader.frag"); + std::string shaderFileContents = readFile("test.frag"); const GLchar *shaderSource = shaderFileContents.c_str(); GLint bufferln = GL_FALSE; @@ -571,10 +571,7 @@ void render(){ glOrtho((offset.x-SCREEN_WIDTH/2),(offset.x+SCREEN_WIDTH/2),offset.y-SCREEN_HEIGHT/2,offset.y+SCREEN_HEIGHT/2,-1,1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glLoadIdentity(); - glEnable(GL_STENCIL_TEST); - glPushMatrix(); - + glLoadIdentity(); /* * glPushAttrib This passes attributes to the renderer so it knows what it can * render. In our case, GL_DEPTH_BUFFER_BIT allows the renderer to @@ -597,6 +594,7 @@ void render(){ * Call the world's draw function, drawing the player, the world, the background, and entities. Also * draw the player's inventory if it exists. */ + glUseProgramObjectARB(shaderProgram); player->near=true; // Draw the player's name @@ -606,17 +604,6 @@ void render(){ * Apply shaders if desired. */ - #ifdef SHADERS - glUseProgramObjectARB(shaderProgram); - glUniform2f(glGetUniformLocation(shaderProgram, "lightLocation"), 640,100); - glUniform3f(glGetUniformLocation(shaderProgram, "lightColor"), 1,1,1); - glUniform1f(glGetUniformLocation(shaderProgram, "lightStrength"), 100 + (1000-(shade*10))); - //std::cout << 100 + (1000-(shade*10)) << std::endl; - glColor4ub(0,0,0,200); - glRectf(offset.x-SCREEN_WIDTH/2,0,offset.x+SCREEN_WIDTH/2,SCREEN_HEIGHT); - glUseProgramObjectARB(0); - #endif //SHADERS - handAngle = atan((ui::mouse.y - (player->loc.y + player->height/2)) / (ui::mouse.x - player->loc.x + player->width/2))*180/PI; if(ui::mouse.x < player->loc.x){ if(handAngle <= 0) @@ -693,6 +680,8 @@ void render(){ /* * Here we draw a black overlay if it's been requested. */ + glUseProgramObjectARB(0); + if(fadeIntensity){ if(fadeWhite) @@ -556,7 +556,7 @@ namespace ui { hub.y-=fontSize*1.15; glRectf(hub.x, hub.y, - hub.x+(player->health/player->maxHealth)*130, + hub.x+(player->health/player->maxHealth?player->maxHealth:1)*130, hub.y+12); } @@ -1,4 +1,4 @@ #version 120
void main(){
- gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
+ gl_FragColor = glColor;
}
|