perf: aplicar checks performance-* (91 fixes)
Cambios aplicados: - Reemplazar std::endl con '\n' (91 casos) * std::endl hace flush del buffer (más lento) * '\n' solo inserta newline (más rápido) * Mejora rendimiento de logging/debug Check excluido: - performance-enum-size: Tamaño de enum no es crítico para rendimiento
This commit is contained in:
@@ -19,12 +19,12 @@ constexpr Uint32 IGNORE_MOTION_DURATION = 1000; // Ignorar primers 1000ms
|
||||
void forceHide() {
|
||||
// Forçar ocultació sincronitzant estat SDL i estat intern
|
||||
std::cout << "[Mouse::forceHide] Ocultant cursor i sincronitzant estat. cursor_visible=" << cursor_visible
|
||||
<< " -> false" << std::endl;
|
||||
<< " -> false" << '\n';
|
||||
SDL_HideCursor();
|
||||
cursor_visible = false;
|
||||
last_mouse_move_time = 0;
|
||||
initialization_time = SDL_GetTicks(); // Marcar temps per ignorar esdeveniments inicials
|
||||
std::cout << "[Mouse::forceHide] Ignorant moviments durant " << IGNORE_MOTION_DURATION << "ms" << std::endl;
|
||||
std::cout << "[Mouse::forceHide] Ignorant moviments durant " << IGNORE_MOTION_DURATION << "ms" << '\n';
|
||||
}
|
||||
|
||||
void setForceHidden(bool force) {
|
||||
@@ -59,13 +59,13 @@ void handleEvent(const SDL_Event& event) {
|
||||
// Ignorar esdeveniments fantasma de SDL durant el període inicial
|
||||
if (initialization_time > 0 && (current_time - initialization_time < IGNORE_MOTION_DURATION)) {
|
||||
std::cout << "[Mouse::handleEvent] Ignorant moviment fantasma de SDL. time=" << current_time
|
||||
<< " (inicialització fa " << (current_time - initialization_time) << "ms)" << std::endl;
|
||||
<< " (inicialització fa " << (current_time - initialization_time) << "ms)" << '\n';
|
||||
return;
|
||||
}
|
||||
|
||||
last_mouse_move_time = current_time;
|
||||
if (!cursor_visible) {
|
||||
std::cout << "[Mouse::handleEvent] Mostrant cursor per moviment REAL. time=" << last_mouse_move_time << std::endl;
|
||||
std::cout << "[Mouse::handleEvent] Mostrant cursor per moviment REAL. time=" << last_mouse_move_time << '\n';
|
||||
SDL_ShowCursor();
|
||||
cursor_visible = true;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ void updateCursorVisibility() {
|
||||
Uint32 current_time = SDL_GetTicks();
|
||||
if (cursor_visible && (current_time - last_mouse_move_time > cursor_hide_time)) {
|
||||
std::cout << "[Mouse::updateCursorVisibility] Ocultant cursor per timeout. current=" << current_time
|
||||
<< " last=" << last_mouse_move_time << " diff=" << (current_time - last_mouse_move_time) << std::endl;
|
||||
<< " last=" << last_mouse_move_time << " diff=" << (current_time - last_mouse_move_time) << '\n';
|
||||
SDL_HideCursor();
|
||||
cursor_visible = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user