Skip to content

anonymous /void Engine::GameLoop()
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
/* 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
Something went wrong with that request. Please try again.