diff --git a/Src/C64_SDL.h b/Src/C64_SDL.h index 03a42ed..dc58854 100644 --- a/Src/C64_SDL.h +++ b/Src/C64_SDL.h @@ -617,8 +617,8 @@ void C64::VBlank(bool draw_frame) } if (now - last_time_update > 1000) { - printf("%.2f kbytes / second\n", - ((bytes_sent * 1000.0) / ((float)now - last_time_update)) / 1024.0); + TheDisplay->NetworkTrafficMeter(((bytes_sent * 1000.0) / + ((float)now - last_time_update)) / 1024.0); for (int i = 0; i < this->network_server->n_clients; i++) this->network_server->clients[i]->ResetBytesSent(); bytes_sent = 0; diff --git a/Src/Display.h b/Src/Display.h index a5ec532..276e7c5 100644 --- a/Src/Display.h +++ b/Src/Display.h @@ -71,6 +71,7 @@ public: void Update(void); void UpdateLEDs(int l0, int l1, int l2, int l3); void Speedometer(int speed); + void NetworkTrafficMeter(float kb_per_s); uint8 *BitmapBase(void); int BitmapXMod(void); #ifdef __riscos__ @@ -141,6 +142,7 @@ private: #ifdef HAVE_SDL char speedometer_string[16]; // Speedometer text + char networktraffic_string[16]; // Speedometer text void draw_string(SDL_Surface *s, int x, int y, const char *str, uint8 front_color, uint8 back_color); #endif diff --git a/Src/Display_SDL.h b/Src/Display_SDL.h index 056ff4d..ba2128f 100644 --- a/Src/Display_SDL.h +++ b/Src/Display_SDL.h @@ -129,6 +129,7 @@ C64Display::C64Display(C64 *the_c64) : TheC64(the_c64) { quit_requested = false; speedometer_string[0] = 0; + networktraffic_string[0] = 0; printf("ssof2 %d:%d\n", sizeof(C64Display), sizeof(C64)); // Open window @@ -224,6 +225,8 @@ void C64Display::Update(uint8 *src_pixels) /* Stretch */ SDL_SoftStretch(sdl_screen, &srcrect, real_screen, &dstrect); } + + draw_string(real_screen, 0, 0, networktraffic_string, black, fill_gray); SDL_Flip(real_screen); } @@ -295,6 +298,11 @@ void C64Display::Speedometer(int speed) delay++; } +void C64Display::NetworkTrafficMeter(float kb_per_s) +{ + sprintf(this->networktraffic_string, "%6.2f KB/S", + kb_per_s); +} /* * Return pointer to bitmap data