Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Commit

Permalink
change timer in timer
Browse files Browse the repository at this point in the history
  • Loading branch information
purerosefallen committed Mar 24, 2018
1 parent cd1f9a9 commit 7bc4c77
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
14 changes: 8 additions & 6 deletions gframe/drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,14 @@ void Game::DrawMisc() {
}
}
if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
DrawShadowText(numFont, L"/", Resize(455, 31, 525, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, L"/", Resize(795, 31, 865, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[0], Resize(455, 31, 490, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(490, 31, 525, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], Resize(795, 31, 830, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(830, 31, 865, 50), Resize(0, 1, 2, 0), 0xffffffff, 0xff000000, true, false, 0);
DrawShadowText(numFont, L"/", Resize(455, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[0], Resize(455, 31, 490, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(490, 31, 525, 50), Resize(0, 1, 2, 0), dInfo.time_color[0], 0xff000000, true, false, 0);

DrawShadowText(numFont, L"/", Resize(795, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_left[1], Resize(795, 31, 830, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);
DrawShadowText(numFont, dInfo.str_time_limit, Resize(830, 31, 865, 50), Resize(0, 1, 2, 0), dInfo.time_color[1], 0xff000000, true, false, 0);

driver->draw2DRectangle(Resize(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(Resize(525, 34, 625, 44), 0xffffffff);
driver->draw2DRectangle(Resize(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
Expand Down
13 changes: 13 additions & 0 deletions gframe/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,19 @@ void Game::MainLoop() {
// device->drop();
}
void Game::RefreshTimeDisplay() {
for(int i = 0; i < 2; ++i) {
if(dInfo.time_left[i] && dInfo.time_limit) {
if(dInfo.time_left[i] >= dInfo.time_limit / 2)
dInfo.time_color[i] = 0xffffffff;
else if(dInfo.time_left[i] >= dInfo.time_limit / 3)
dInfo.time_color[i] = 0xffffff00;
else if(dInfo.time_left[i] >= dInfo.time_limit / 6)
dInfo.time_color[i] = 0xffff7f00;
else
dInfo.time_color[i] = 0xffff0000;
} else
dInfo.time_color[i] = 0xffffffff;
}
myswprintf(dInfo.str_time_left[0], L"%d", dInfo.time_left[0]);
myswprintf(dInfo.str_time_left[1], L"%d", dInfo.time_left[1]);
myswprintf(dInfo.str_time_limit, L"%d", dInfo.time_limit);
Expand Down
1 change: 1 addition & 0 deletions gframe/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct DuelInfo {
unsigned short time_left[2];
wchar_t str_time_limit[16];
wchar_t str_time_left[2][16];
video::SColor time_color[2];
bool isReplaySwapped;
};

Expand Down

0 comments on commit 7bc4c77

Please sign in to comment.