Skip to content

Commit

Permalink
Merge pull request #92 from marcelofg55/upstream
Browse files Browse the repository at this point in the history
Main game screen now shows the time of day as a text (for now) at the…
  • Loading branch information
Andrettin committed Mar 30, 2016
2 parents f0837ec + 92c61eb commit 8a9b776
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ extern void UpdateMessages();
extern void DrawMessages();
/// Draw the player resource in resource line
extern void DrawResources();
/// Draw the time of day
extern void DrawDayTime();
/// Set message to display
extern void SetMessage(const char *fmt, ...) PRINTF_VAARG_ATTRIBUTE(1, 2);
/// Set message to display with event point
Expand Down
1 change: 1 addition & 0 deletions src/include/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ class CUserInterface
CResourceInfo Resources[MaxResourceInfo];/// Icon+Text of all resources

CInfoPanel InfoPanel; /// Info panel
CInfoPanel TimePanel; /// Time panel
std::vector<CUnitInfoPanel *> InfoPanelContents;/// Info panel contents

std::vector<CPopup *> ButtonPopups; /// Popup windows for buttons
Expand Down
1 change: 1 addition & 0 deletions src/stratagus/mainloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ void UpdateDisplay()

UI.InfoPanel.Draw();
DrawResources();
DrawDayTime();
UI.StatusLine.Draw();
UI.StatusLine.DrawCosts();
UI.ButtonPanel.Draw();
Expand Down
1 change: 1 addition & 0 deletions src/tolua/ui.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class CUserInterface

CResourceInfo Resources[MaxResourceInfo];
CInfoPanel InfoPanel;
CInfoPanel TimePanel;
CUIButton *SingleSelectedButton;

vector<CUIButton> SelectedButtons;
Expand Down
28 changes: 28 additions & 0 deletions src/ui/mainscr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,34 @@ void DrawResources()
}
}

/*----------------------------------------------------------------------------
-- DAYTIME
----------------------------------------------------------------------------*/

/**
** Draw the day time.
*/
void DrawDayTime() {
char timesText[MaxTimesOfDay][16] = {
"NoTime",
"Dawn",
"Morning",
"Midday",
"Afternoon",
"Dusk",
"First Watch",
"Midnight",
"Second Watch"
};
CLabel label(GetGameFont());

if (GameTimeOfDay >= MaxTimesOfDay)
return;

// TODO: Instead of a simple text here we could use an icon per time of day
label.Draw(UI.TimePanel.X, UI.TimePanel.Y, timesText[GameTimeOfDay]);
}

/*----------------------------------------------------------------------------
-- MESSAGE
----------------------------------------------------------------------------*/
Expand Down

0 comments on commit 8a9b776

Please sign in to comment.