cppcheck
This commit is contained in:
@@ -51,7 +51,7 @@ void Input::applyGamepadBindingsFromOptions() {
|
||||
}
|
||||
|
||||
// Obtener el primer gamepad conectado
|
||||
auto& gamepad = gamepads_[0];
|
||||
const auto& gamepad = gamepads_[0];
|
||||
|
||||
// Aplicar bindings desde Options
|
||||
// Los valores pueden ser:
|
||||
|
||||
@@ -201,7 +201,7 @@ void OpenGLShader::createQuadGeometry() {
|
||||
checkGLError("glVertexAttribPointer(position)");
|
||||
|
||||
// Atributo 1: Coordenadas de textura (2 floats)
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*)(2 * sizeof(float)));
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), reinterpret_cast<void*>(2 * sizeof(float)));
|
||||
glEnableVertexAttribArray(1);
|
||||
checkGLError("glVertexAttribPointer(texcoord)");
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ auto Screen::get() -> Screen* {
|
||||
|
||||
// Constructor
|
||||
Screen::Screen()
|
||||
: palettes_(Asset::get()->getListByType(Asset::Type::PALETTE)) {
|
||||
: window_width_(0),
|
||||
window_height_(0),
|
||||
palettes_(Asset::get()->getListByType(Asset::Type::PALETTE)) {
|
||||
// Arranca SDL VIDEO, crea la ventana y el renderizador
|
||||
initSDLVideo();
|
||||
if (Options::video.fullscreen) {
|
||||
@@ -456,11 +458,10 @@ void Screen::initShaders() {
|
||||
|
||||
// Obtiene información sobre la pantalla
|
||||
void Screen::getDisplayInfo() {
|
||||
int i;
|
||||
int num_displays = 0;
|
||||
SDL_DisplayID* displays = SDL_GetDisplays(&num_displays);
|
||||
if (displays != nullptr) {
|
||||
for (i = 0; i < num_displays; ++i) {
|
||||
for (int i = 0; i < num_displays; ++i) {
|
||||
SDL_DisplayID instance_id = displays[i];
|
||||
const char* name = SDL_GetDisplayName(instance_id);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ void Surface::loadPalette(const std::string& file_path) {
|
||||
}
|
||||
|
||||
// Carga una paleta desde otra paleta
|
||||
void Surface::loadPalette(Palette palette) {
|
||||
void Surface::loadPalette(const Palette& palette) {
|
||||
palette_ = palette;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class Surface {
|
||||
|
||||
// Carga una paleta desde un archivo
|
||||
void loadPalette(const std::string& file_path);
|
||||
void loadPalette(Palette palette);
|
||||
void loadPalette(const Palette& palette);
|
||||
|
||||
// Copia una región de la SurfaceData de origen a la SurfaceData de destino
|
||||
void render(float dx, float dy, float sx, float sy, float w, float h);
|
||||
|
||||
@@ -35,8 +35,8 @@ void Resource::destroy() { delete Resource::resource; }
|
||||
auto Resource::get() -> Resource* { return Resource::resource; }
|
||||
|
||||
// Constructor
|
||||
Resource::Resource() {
|
||||
loading_text_ = Screen::get()->getText();
|
||||
Resource::Resource()
|
||||
: loading_text_(Screen::get()->getText()) {
|
||||
load();
|
||||
}
|
||||
|
||||
@@ -353,9 +353,9 @@ void Resource::createText() {
|
||||
{"subatomic", "subatomic.gif", "subatomic.txt"},
|
||||
{"8bithud", "8bithud.gif", "8bithud.txt"}};
|
||||
|
||||
for (const auto& resource : resources) {
|
||||
texts_.emplace_back(resource.key, std::make_shared<Text>(getSurface(resource.texture_file), getTextFile(resource.text_file)));
|
||||
printWithDots("Text : ", resource.key, "[ DONE ]");
|
||||
for (const auto& res_info : resources) {
|
||||
texts_.emplace_back(res_info.key, std::make_shared<Text>(getSurface(res_info.texture_file), getTextFile(res_info.text_file)));
|
||||
printWithDots("Text : ", res_info.key, "[ DONE ]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ void Resource::renderProgress() {
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
const auto TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
const auto LOADING_TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
const auto BAR_COLOR = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
const int TEXT_HEIGHT = loading_text_->getCharacterSize();
|
||||
const int CENTER_X = Options::game.width / 2;
|
||||
@@ -427,7 +427,7 @@ void Resource::renderProgress() {
|
||||
CENTER_X - (loading_text_->lenght(APP_NAME) / 2),
|
||||
CENTER_Y - TEXT_HEIGHT,
|
||||
APP_NAME,
|
||||
TEXT_COLOR);
|
||||
LOADING_TEXT_COLOR);
|
||||
|
||||
// Draw VERSION centered below center
|
||||
const std::string VERSION_TEXT = "(" + std::string(Version::GIT_HASH) + ")";
|
||||
@@ -435,7 +435,7 @@ void Resource::renderProgress() {
|
||||
CENTER_X - (loading_text_->lenght(VERSION_TEXT) / 2),
|
||||
CENTER_Y + TEXT_HEIGHT,
|
||||
VERSION_TEXT,
|
||||
TEXT_COLOR);
|
||||
LOADING_TEXT_COLOR);
|
||||
|
||||
// Draw progress bar border
|
||||
const float WIRED_BAR_WIDTH = Options::game.width - (X_PADDING * 2);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class Director {
|
||||
public:
|
||||
Director(std::vector<std::string> const& args); // Constructor
|
||||
explicit Director(std::vector<std::string> const& args); // Constructor
|
||||
~Director(); // Destructor
|
||||
static auto run() -> int; // Bucle principal
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ Title::Title()
|
||||
axis_cooldown_(0.0F),
|
||||
remap_completed_(false) {
|
||||
// Inicializa variables
|
||||
temp_keys_[0] = temp_keys_[1] = temp_keys_[2] = SDL_SCANCODE_UNKNOWN;
|
||||
temp_buttons_[0] = temp_buttons_[1] = temp_buttons_[2] = -1;
|
||||
|
||||
state_ = SceneManager::options == SceneManager::Options::TITLE_WITH_LOADING_SCREEN ? State::SHOW_LOADING_SCREEN : State::MAIN_MENU;
|
||||
SceneManager::current = SceneManager::Scene::TITLE;
|
||||
SceneManager::options = SceneManager::Options::NONE;
|
||||
|
||||
Reference in New Issue
Block a user