mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-04-21 03:51:37 +02:00
Use SDL_GetTicks for message time keeping
This commit is contained in:
parent
4722d9f028
commit
41433858cc
@ -147,7 +147,7 @@ private:
|
||||
char networktraffic_string[80]; // Speedometer text
|
||||
void draw_string(SDL_Surface *s, int x, int y, const char *str, uint8 front_color, uint8 back_color);
|
||||
char *on_screen_message;
|
||||
int on_screen_message_start_time;
|
||||
Uint32 on_screen_message_start_time;
|
||||
int on_screen_message_time;
|
||||
#endif
|
||||
|
||||
|
@ -229,12 +229,11 @@ void C64Display::Update(uint8 *src_pixels)
|
||||
|
||||
draw_string(real_screen, 0, 0, networktraffic_string, black, fill_gray);
|
||||
if (this->on_screen_message) {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Uint32 time_now = SDL_GetTicks();
|
||||
|
||||
draw_string(real_screen, 60, 30,
|
||||
this->on_screen_message, black, fill_gray);
|
||||
if (tv.tv_sec - this->on_screen_message_start_time > this->on_screen_message_time)
|
||||
if (time_now - this->on_screen_message_start_time > this->on_screen_message_time * 1000)
|
||||
this->on_screen_message = NULL;
|
||||
}
|
||||
|
||||
@ -248,11 +247,10 @@ void C64Display::Update()
|
||||
|
||||
void C64Display::display_status_string(char *str, int seconds)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
Uint32 time_now = SDL_GetTicks();
|
||||
|
||||
this->on_screen_message = str;
|
||||
this->on_screen_message_start_time = tv.tv_sec;
|
||||
this->on_screen_message_start_time = time_now;
|
||||
this->on_screen_message_time = seconds;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user