Corregidos ~2570 issues automáticamente con clang-tidy --fix-errors más ajustes manuales posteriores: - modernize: designated-initializers, trailing-return-type, use-auto, avoid-c-arrays (→ std::array<>), use-ranges, use-emplace, deprecated-headers, use-equals-default, pass-by-value, return-braced-init-list, use-default-member-init - readability: math-missing-parentheses, implicit-bool-conversion, braces-around-statements, isolate-declaration, use-std-min-max, identifier-naming, else-after-return, redundant-casting, convert-member-functions-to-static, make-member-function-const, static-accessed-through-instance - performance: avoid-endl, unnecessary-value-param, type-promotion, inefficient-vector-operation - dead code: XOR_KEY (orphan tras eliminar encryptData/decryptData), dead stores en engine.cpp y png_shape.cpp - NOLINT justificado en 10 funciones con alta complejidad cognitiva (initialize, render, main, processEvents, update×3, performDemoAction, randomizeOnDemoStart, renderDebugHUD, AppLogo::update) Compilación: gcc -Wall sin warnings. clang-tidy: 0 issues. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <SDL3/SDL_gpu.h>
|
|
#include <SDL3/SDL_video.h>
|
|
|
|
// ============================================================================
|
|
// GpuContext — SDL_GPU device + swapchain wrapper
|
|
// Replaces SDL_Renderer as the main rendering backend.
|
|
// ============================================================================
|
|
class GpuContext {
|
|
public:
|
|
bool init(SDL_Window* window);
|
|
void destroy();
|
|
|
|
SDL_GPUDevice* device() const { return device_; }
|
|
SDL_Window* window() const { return window_; }
|
|
SDL_GPUTextureFormat swapchainFormat() const { return swapchain_format_; }
|
|
|
|
// Per-frame helpers
|
|
SDL_GPUCommandBuffer* acquireCommandBuffer();
|
|
// Returns nullptr if window is minimized (swapchain not available).
|
|
SDL_GPUTexture* acquireSwapchainTexture(SDL_GPUCommandBuffer* cmd_buf,
|
|
Uint32* out_w,
|
|
Uint32* out_h);
|
|
static void submit(SDL_GPUCommandBuffer* cmd_buf);
|
|
|
|
// VSync control (call after init)
|
|
bool setVSync(bool enabled);
|
|
|
|
private:
|
|
SDL_GPUDevice* device_ = nullptr;
|
|
SDL_Window* window_ = nullptr;
|
|
SDL_GPUTextureFormat swapchain_format_ = SDL_GPU_TEXTUREFORMAT_INVALID;
|
|
};
|