Created
June 24, 2012 01:53
-
-
Save anonymous/2980990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is in the main game loop */ | |
case Game_Engine::Play: | |
if(gk::IsDown(SDLK_w)) // Adjust light or black overlay alpha | |
alpha += 0.05f; | |
else if(gk::IsDown(SDLK_s)) | |
alpha -= 0.05f; | |
if(gk::IsDown(SDLK_d)) | |
light += 0.05f; | |
else if(gk::IsDown(SDLK_a)) | |
light -= 0.05f; | |
this->Light.Move(x, y); // Move "light" to mouse coordinates | |
/* Update everything on-screen */ | |
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |
this->Background.Update(); | |
this->Map.Update(this->Player); | |
this->Player.Update(); | |
glColor4f(1, 1, 1, alpha); | |
glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA); | |
this->Light.Update(); | |
glColor4f(1, 1, 1, light); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment