Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vittorioromeo committed Feb 28, 2013
1 parent 383ba65 commit 24637c5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
3 changes: 1 addition & 2 deletions Global/Assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ namespace hg
root["name"] = mName;
root["scores"] = Json::objectValue;
writer.write(o, root);
o.flush();
o.close();
o.flush(); o.close();

profileDataMap.clear();
loadProfiles();
Expand Down
2 changes: 1 addition & 1 deletion Global/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace hg
bool getPulse();
bool getBeatPulse();
bool getInvincible();
bool get3D();
bool get3D(); // TODO!!
}

#endif /* CONFIG_H_ */
21 changes: 21 additions & 0 deletions HGGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,27 @@ using namespace sses;

namespace hg
{
void HexagonGame::draw()
{
window.clear(Color::Black);
if(!getNoBackground()) { backgroundCamera.apply(); styleData.drawBackground(window.getRenderWindow(), {0, 0}, getSides()); }
if(get3D())
{
status.drawing3D = true;
for(unsigned int i{0}; i < depthCameras.size(); ++i)
{
status.overrideColor = getColorDarkened(styleData.getMainColor(), 1.5f);
status.overrideColor.a /= 2;
status.overrideColor.a -= i * 3;
depthCameras[i].apply();
manager.draw();
}
status.drawing3D = false;
}
backgroundCamera.apply(); manager.draw();
overlayCamera.apply(); drawText(); render(flashPolygon);
}

void HexagonGame::render(Drawable &mDrawable) { window.draw(mDrawable); }

void HexagonGame::initFlashEffect()
Expand Down
31 changes: 3 additions & 28 deletions HexagonGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,13 @@ namespace hg
HexagonGame::HexagonGame(GameWindow& mGameWindow) : window(mGameWindow)
{
initFlashEffect();
for(int i{0}; i < 15; ++i) depthCameras.push_back({window, {}});
for(int i{0}; i < 15; ++i) depthCameras.push_back({window, {}}); // TODO: FIX AND ADD STYLE PARAMETERS

game.onUpdate += [&](float mFrameTime) { update(mFrameTime); };
game.onUpdate += [&](float) { inputMovement = 0; inputFocused = false; };

game.onDraw += [&](){ window.clear(Color::Black); };
game.onDraw += [&](){ backgroundCamera.apply(); };
if(!getNoBackground()) game.onDraw += [&](){ styleData.drawBackground(window.getRenderWindow(), {0, 0}, getSides()); };

if(get3D())
{
game.onDraw += [&]()
{
status.drawing3D = true;
for(unsigned int i{0}; i < depthCameras.size(); ++i)
{
status.overrideColor = getColorDarkened(styleData.getMainColor(), 1.5f);
status.overrideColor.a /= 2;
status.overrideColor.a -= i * 3;
depthCameras[i].apply();
manager.draw();
}
status.drawing3D = false;
};
}

game.onDraw += [&](){ backgroundCamera.apply(); };
game.onDraw += [&](){ manager.draw(); };

game.onDraw += [&](){ overlayCamera.apply(); };
game.onDraw += [&](){ drawText(); };
game.onDraw += [&](){ render(flashPolygon); };
game.onDraw += [&](){ draw(); };


using k = Keyboard::Key;
game.addInput({k::Left}, [&](float){ inputMovement = -1; });
Expand Down
3 changes: 3 additions & 0 deletions HexagonGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ namespace hg
void updateFlash(float mFrameTime);
void update3D(float mFrameTime);

// Draw methods
void draw();

// Gameplay methods
void incrementDifficulty();
void sideChange(int mSideNumber);
Expand Down

0 comments on commit 24637c5

Please sign in to comment.