57 |
void set_inventory (Inventory *inv); |
void set_inventory (Inventory *inv); |
58 |
void update_inventory (Inventory *inv); |
void update_inventory (Inventory *inv); |
59 |
|
|
60 |
void show_text (const std::string &str, |
void show_text (const std::string &str, TextMode m=TEXT_SCROLLING); |
|
TextMode m=TEXT_SCROLLING); |
|
61 |
void hide_text() { m_textview.deactivate(); } |
void hide_text() { m_textview.deactivate(); } |
62 |
|
|
63 |
|
void set_counter (int new_counter) { |
64 |
|
if (m_showcounter_p && new_counter != m_counter) { |
65 |
|
m_changedp = true; |
66 |
|
} |
67 |
|
m_counter = new_counter; |
68 |
|
} |
69 |
|
void counter_activate (bool active) { |
70 |
|
if (active != m_showcounter_p) { |
71 |
|
m_showcounter_p = active; |
72 |
|
m_changedp = true; |
73 |
|
} |
74 |
|
} |
75 |
|
|
76 |
private: |
private: |
77 |
ScreenArea m_itemarea; |
ScreenArea m_itemarea; |
78 |
ScreenArea m_textarea; |
ScreenArea m_textarea; |
79 |
vector<Model*> m_models; |
vector<Model*> m_models; |
80 |
bool m_changedp; |
bool m_changedp; |
81 |
Inventory * m_inventory; |
Inventory * m_inventory; |
82 |
TextDisplay m_textview; |
TextDisplay m_textview; |
83 |
|
|
84 |
double m_leveltime; |
double m_leveltime; |
85 |
bool m_showtime_p; |
bool m_showtime_p; |
86 |
|
int m_counter; |
87 |
|
bool m_showcounter_p; |
88 |
}; |
}; |
89 |
} |
} |
90 |
|
|
97 |
m_inventory(0), |
m_inventory(0), |
98 |
m_textview (m_textarea, *enigma::GetFont("dreamorp24")), |
m_textview (m_textarea, *enigma::GetFont("dreamorp24")), |
99 |
m_leveltime (0), |
m_leveltime (0), |
100 |
m_showtime_p (true) |
m_showtime_p (true), |
101 |
|
m_counter (0), |
102 |
|
m_showcounter_p(false) |
103 |
{} |
{} |
104 |
|
|
105 |
StatusBarImpl::~StatusBarImpl() |
StatusBarImpl::~StatusBarImpl() |
113 |
|
|
114 |
blit(gc, a.x, a.y, enigma::GetImage ("inventory")); |
blit(gc, a.x, a.y, enigma::GetImage ("inventory")); |
115 |
|
|
116 |
if (m_showtime_p) |
if (m_showtime_p || m_showcounter_p) { |
117 |
{ |
char buf[8]; |
|
char time[8]; |
|
|
int minutes = static_cast<int>(m_leveltime/60) % 100; |
|
|
int seconds = static_cast<int>(m_leveltime) % 60; |
|
118 |
Font *f = enigma::GetFont ("timefont"); |
Font *f = enigma::GetFont ("timefont"); |
119 |
|
int len; |
120 |
|
int xoff = 0; |
121 |
|
|
122 |
|
if (m_showtime_p) { |
123 |
|
int minutes = static_cast<int>(m_leveltime/60) % 100; |
124 |
|
int seconds = static_cast<int>(m_leveltime) % 60; |
125 |
|
|
126 |
|
if (m_showcounter_p) { |
127 |
|
len = sprintf (buf, "%d:%02d:%d", minutes, seconds, m_counter); |
128 |
|
// @@@FIXME: preferred variant - needs '/' character in 'timefont' : |
129 |
|
// len = sprintf (buf, "%d:%02d/%d", minutes, seconds, m_counter); |
130 |
|
xoff = int(70-(len/2.0)*16+.5); |
131 |
|
} |
132 |
|
else { |
133 |
|
len = sprintf (buf, "%d:%02d", minutes, seconds); |
134 |
|
// xoff = 30; // approx. 70-2.5*16 |
135 |
|
xoff = int(70-(len/2.0)*16+.5); |
136 |
|
} |
137 |
|
} |
138 |
|
else { |
139 |
|
len = sprintf (buf, "%d", m_counter); |
140 |
|
xoff = int(70-(len/2.0)*16+.5); |
141 |
|
} |
142 |
|
|
143 |
sprintf (time, "%02d : %02d", minutes, seconds); |
Surface *s = f->render (buf); |
144 |
Surface *s = f->render (time); |
blit(gc, a.x + xoff, a.y+13, s); |
|
blit(gc, a.x + 30, a.y+13, s); |
|
145 |
delete s; |
delete s; |
146 |
} |
} |
147 |
else |
else |
198 |
if (m_textview.is_active()) |
if (m_textview.is_active()) |
199 |
{ |
{ |
200 |
m_textview.tick (dtime); |
m_textview.tick (dtime); |
201 |
m_changedp = m_textview.has_changed(); |
m_changedp |= m_textview.has_changed(); |
202 |
} |
} |
203 |
|
|
204 |
double oldtime=m_leveltime; |
double oldtime=m_leveltime; |