build: unifica .clang-format/.clang-tidy i exclou external/ i spv/ amb dummies
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include <unistd.h> // for getuid
|
||||
#endif
|
||||
|
||||
#include <cstdlib> // for exit, EXIT_FAILURE, srand
|
||||
#include <cstdlib> // for exit, EXIT_FAILURE, srand
|
||||
#include <filesystem>
|
||||
#include <fstream> // for basic_ostream, operator<<, basi...
|
||||
#include <iostream> // for cout
|
||||
@@ -24,14 +24,14 @@
|
||||
#include "intro.h" // for Intro
|
||||
#include "jail_audio.hpp" // for JA_Init
|
||||
#include "lang.h" // for Lang, MAX_LANGUAGES, ba_BA, en_UK
|
||||
#include "resource.h"
|
||||
#include "resource_helper.h"
|
||||
#include "logo.h" // for Logo
|
||||
#include "mouse.hpp" // for Mouse::handleEvent, Mouse::upda...
|
||||
#include "screen.h" // for FILTER_NEAREST, Screen, FILTER_...
|
||||
#include "texture.h" // for Texture
|
||||
#include "title.h" // for Title
|
||||
#include "utils.h" // for options_t, input_t, boolToString
|
||||
#include "resource.h"
|
||||
#include "resource_helper.h"
|
||||
#include "screen.h" // for FILTER_NEAREST, Screen, FILTER_...
|
||||
#include "texture.h" // for Texture
|
||||
#include "title.h" // for Title
|
||||
#include "utils.h" // for options_t, input_t, boolToString
|
||||
|
||||
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
|
||||
#include <pwd.h>
|
||||
@@ -62,13 +62,13 @@ Director::Director(int argc, const char *argv[]) {
|
||||
// En wasm siempre se usa filesystem (MEMFS) porque el propio --preload-file
|
||||
// de emscripten ya empaqueta data/ — no hay resources.pack.
|
||||
{
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
const bool enable_fallback = true;
|
||||
#elif defined(RELEASE_BUILD)
|
||||
#elif defined(RELEASE_BUILD)
|
||||
const bool enable_fallback = false;
|
||||
#else
|
||||
#else
|
||||
const bool enable_fallback = true;
|
||||
#endif
|
||||
#endif
|
||||
if (!ResourceHelper::initializeResourceSystem("resources.pack", enable_fallback)) {
|
||||
std::cerr << "Fatal: resource system init failed (missing resources.pack?)" << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -105,11 +105,11 @@ Director::Director(int argc, const char *argv[]) {
|
||||
#else
|
||||
{
|
||||
const std::string binDir = std::filesystem::path(executablePath).parent_path().string();
|
||||
#ifdef MACOS_BUNDLE
|
||||
#ifdef MACOS_BUNDLE
|
||||
input = new Input(binDir + "/../Resources/gamecontrollerdb.txt");
|
||||
#else
|
||||
#else
|
||||
input = new Input(binDir + "/gamecontrollerdb.txt");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
initInput();
|
||||
|
||||
2
source/external/.clang-format
vendored
Normal file
2
source/external/.clang-format
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: Never
|
||||
4
source/external/.clang-tidy
vendored
Normal file
4
source/external/.clang-tidy
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# source/external/.clang-tidy
|
||||
Checks: '-*'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
@@ -15,16 +15,16 @@
|
||||
#include "input.h" // for inputs_e, Input, REPEAT_TRUE, REPEAT_FALSE
|
||||
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
|
||||
#include "jail_audio.hpp" // for JA_PlaySound, JA_DeleteSound, JA_LoadSound
|
||||
#include "resource.h"
|
||||
#include "lang.h" // for Lang
|
||||
#include "menu.h" // for Menu
|
||||
#include "movingsprite.h" // for MovingSprite
|
||||
#include "player.h" // for Player, DEATH_COUNTER
|
||||
#include "screen.h" // for Screen
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER
|
||||
#include "texture.h" // for Texture
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER
|
||||
#include "texture.h" // for Texture
|
||||
struct JA_Sound_t;
|
||||
|
||||
// Constructor
|
||||
|
||||
@@ -21,17 +21,18 @@ static void installWebStandardMapping(SDL_JoystickID jid) {
|
||||
|
||||
char mapping[512];
|
||||
SDL_snprintf(mapping, sizeof(mapping),
|
||||
"%s,%s,"
|
||||
"a:b0,b:b1,x:b2,y:b3,"
|
||||
"leftshoulder:b4,rightshoulder:b5,"
|
||||
"lefttrigger:b6,righttrigger:b7,"
|
||||
"back:b8,start:b9,"
|
||||
"leftstick:b10,rightstick:b11,"
|
||||
"dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,"
|
||||
"guide:b16,"
|
||||
"leftx:a0,lefty:a1,rightx:a2,righty:a3,"
|
||||
"platform:Emscripten",
|
||||
guidStr, name);
|
||||
"%s,%s,"
|
||||
"a:b0,b:b1,x:b2,y:b3,"
|
||||
"leftshoulder:b4,rightshoulder:b5,"
|
||||
"lefttrigger:b6,righttrigger:b7,"
|
||||
"back:b8,start:b9,"
|
||||
"leftstick:b10,rightstick:b11,"
|
||||
"dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,"
|
||||
"guide:b16,"
|
||||
"leftx:a0,lefty:a1,rightx:a2,righty:a3,"
|
||||
"platform:Emscripten",
|
||||
guidStr,
|
||||
name);
|
||||
SDL_AddGamepadMapping(mapping);
|
||||
#else
|
||||
(void)jid;
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
#include "jail_audio.hpp" // for JA_StopMusic
|
||||
#include "lang.h" // for Lang
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for color_t, section_t
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for color_t, section_t
|
||||
|
||||
// Constructor
|
||||
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, section_t *section) {
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include "jail_audio.hpp" // for JA_StopMusic, JA_DeleteMusic, JA_LoadMusic
|
||||
#include "lang.h" // for Lang
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "text.h" // for Text
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for section_t, color_t
|
||||
#include "writer.h" // for Writer
|
||||
#include "screen.h" // for Screen
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "text.h" // for Text
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for section_t, color_t
|
||||
#include "writer.h" // for Writer
|
||||
|
||||
// Constructor
|
||||
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, section_t *section) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string.h> // Para strcpy, strlen
|
||||
|
||||
#define STB_VORBIS_HEADER_ONLY
|
||||
#include "stb_vorbis.c"
|
||||
#include "external/stb_vorbis.c"
|
||||
|
||||
// --- Public Enums ---
|
||||
enum JA_Channel_state { JA_CHANNEL_INVALID,
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
|
||||
#include "jail_audio.hpp" // for JA_StopMusic
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for section_t, color_t
|
||||
#include "screen.h" // for Screen
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "texture.h" // for Texture
|
||||
#include "utils.h" // for section_t, color_t
|
||||
|
||||
// Valores de inicialización y fin
|
||||
constexpr int INIT_FADE = 100;
|
||||
|
||||
@@ -43,7 +43,7 @@ Reescribiendo el código el 27/09/2022
|
||||
#include <SDL3/SDL_main.h>
|
||||
|
||||
#include "director.h"
|
||||
#include "stb_vorbis.c"
|
||||
#include "external/stb_vorbis.c"
|
||||
|
||||
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {
|
||||
auto *director = new Director(argc, const_cast<const char **>(argv));
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
|
||||
#include "jail_audio.hpp" // for JA_LoadSound, JA_PlaySound, JA_DeleteSound
|
||||
#include "resource_helper.h"
|
||||
#include "text.h" // for Text
|
||||
#include "text.h" // for Text
|
||||
|
||||
// Constructor
|
||||
Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class Resource {
|
||||
JA_Music_t *getMusic(const std::string &name);
|
||||
std::vector<std::string> &getAnimationLines(const std::string &name);
|
||||
Text *getText(const std::string &name); // name sin extensión: "smb2", "nokia2", ...
|
||||
Menu *getMenu(const std::string &name); // name sin extensión: "title", "options", ...
|
||||
Menu *getMenu(const std::string &name); // name sin extensión: "title", "options", ...
|
||||
const std::vector<uint8_t> &getDemoBytes() const { return demoBytes_; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -74,4 +74,4 @@ namespace ResourceHelper {
|
||||
}
|
||||
return pack_path;
|
||||
}
|
||||
}
|
||||
} // namespace ResourceHelper
|
||||
|
||||
@@ -12,4 +12,4 @@ namespace ResourceHelper {
|
||||
|
||||
bool shouldUseResourcePack(const std::string& filepath);
|
||||
std::string getPackPath(const std::string& asset_path);
|
||||
}
|
||||
} // namespace ResourceHelper
|
||||
|
||||
@@ -189,7 +189,7 @@ std::vector<uint8_t> ResourcePack::getResource(const std::string& filename) {
|
||||
}
|
||||
|
||||
std::vector<uint8_t> result(data_.begin() + entry.offset,
|
||||
data_.begin() + entry.offset + entry.size);
|
||||
data_.begin() + entry.offset + entry.size);
|
||||
|
||||
uint32_t checksum = calculateChecksum(result);
|
||||
if (checksum != entry.checksum) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "asset.h" // for Asset
|
||||
#include "mouse.hpp" // for Mouse::cursorVisible, Mouse::lastMouseMoveTime
|
||||
#include "resource.h"
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_STROKE
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_STROKE
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
@@ -30,26 +30,26 @@
|
||||
// interna a SDL_SetWindowFullscreen(false) és la peça que realment fa eixir
|
||||
// SDL del seu estat intern de fullscreen — sense això res més funciona.
|
||||
namespace {
|
||||
Screen *g_screen_instance = nullptr;
|
||||
Screen *g_screen_instance = nullptr;
|
||||
|
||||
void deferredCanvasResize(void * /*userData*/) {
|
||||
if (g_screen_instance) {
|
||||
g_screen_instance->handleCanvasResized();
|
||||
void deferredCanvasResize(void * /*userData*/) {
|
||||
if (g_screen_instance) {
|
||||
g_screen_instance->handleCanvasResized();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EM_BOOL onEmFullscreenChange(int /*eventType*/, const EmscriptenFullscreenChangeEvent *event, void * /*userData*/) {
|
||||
if (g_screen_instance && event) {
|
||||
g_screen_instance->syncFullscreenFlagFromBrowser(event->isFullscreen != 0);
|
||||
EM_BOOL onEmFullscreenChange(int /*eventType*/, const EmscriptenFullscreenChangeEvent *event, void * /*userData*/) {
|
||||
if (g_screen_instance && event) {
|
||||
g_screen_instance->syncFullscreenFlagFromBrowser(event->isFullscreen != 0);
|
||||
}
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
|
||||
EM_BOOL onEmOrientationChange(int /*eventType*/, const EmscriptenOrientationChangeEvent * /*event*/, void * /*userData*/) {
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
EM_BOOL onEmOrientationChange(int /*eventType*/, const EmscriptenOrientationChangeEvent * /*event*/, void * /*userData*/) {
|
||||
emscripten_async_call(deferredCanvasResize, nullptr, 0);
|
||||
return EM_FALSE;
|
||||
}
|
||||
} // namespace
|
||||
#endif // __EMSCRIPTEN__
|
||||
|
||||
|
||||
@@ -30,21 +30,21 @@ class Screen {
|
||||
|
||||
// Render loop
|
||||
void clean(color_t color = {0x00, 0x00, 0x00}); // Limpia la pantalla
|
||||
void start(); // Prepara para empezar a dibujar en la textura de juego
|
||||
void blit(); // Vuelca el contenido del renderizador en pantalla
|
||||
void start(); // Prepara para empezar a dibujar en la textura de juego
|
||||
void blit(); // Vuelca el contenido del renderizador en pantalla
|
||||
|
||||
// Video y ventana
|
||||
void setVideoMode(bool fullscreen); // Establece el modo de video
|
||||
void toggleVideoMode(); // Cambia entre pantalla completa y ventana
|
||||
void handleCanvasResized(); // En Emscripten, reaplica setVideoMode tras un cambio del navegador (salida de fullscreen con Esc, rotación). No-op fuera de Emscripten
|
||||
void setVideoMode(bool fullscreen); // Establece el modo de video
|
||||
void toggleVideoMode(); // Cambia entre pantalla completa y ventana
|
||||
void handleCanvasResized(); // En Emscripten, reaplica setVideoMode tras un cambio del navegador (salida de fullscreen con Esc, rotación). No-op fuera de Emscripten
|
||||
void syncFullscreenFlagFromBrowser(bool isFullscreen); // Sincroniza el flag interno de fullscreen con el estado real del navegador. Debe llamarse antes de diferir handleCanvasResized. No-op fuera de Emscripten
|
||||
void toggleIntegerScale(); // Alterna el escalado entero
|
||||
void setIntegerScale(bool enabled); // Establece el escalado entero
|
||||
void toggleVSync(); // Alterna el V-Sync
|
||||
void setVSync(bool enabled); // Establece el V-Sync
|
||||
auto decWindowZoom() -> bool; // Reduce el zoom de la ventana (devuelve true si cambió)
|
||||
auto incWindowZoom() -> bool; // Aumenta el zoom de la ventana (devuelve true si cambió)
|
||||
auto setWindowZoom(int zoom) -> bool; // Establece el zoom de la ventana (devuelve true si cambió)
|
||||
void toggleIntegerScale(); // Alterna el escalado entero
|
||||
void setIntegerScale(bool enabled); // Establece el escalado entero
|
||||
void toggleVSync(); // Alterna el V-Sync
|
||||
void setVSync(bool enabled); // Establece el V-Sync
|
||||
auto decWindowZoom() -> bool; // Reduce el zoom de la ventana (devuelve true si cambió)
|
||||
auto incWindowZoom() -> bool; // Aumenta el zoom de la ventana (devuelve true si cambió)
|
||||
auto setWindowZoom(int zoom) -> bool; // Establece el zoom de la ventana (devuelve true si cambió)
|
||||
|
||||
// Borde
|
||||
void setBorderColor(color_t color); // Cambia el color del borde
|
||||
@@ -55,10 +55,10 @@ class Screen {
|
||||
|
||||
private:
|
||||
// Helpers internos de setVideoMode
|
||||
void applyFullscreen(bool fullscreen); // SDL_SetWindowFullscreen + visibilidad del cursor
|
||||
void applyWindowedLayout(); // Calcula windowWidth/Height/dest + SDL_SetWindowSize + SDL_SetWindowPosition
|
||||
void applyFullscreenLayout(); // SDL_GetWindowSize + delegación a computeFullscreenGameRect
|
||||
void computeFullscreenGameRect(); // Calcula dest en fullscreen (integerScale / keepAspect / stretched)
|
||||
void applyFullscreen(bool fullscreen); // SDL_SetWindowFullscreen + visibilidad del cursor
|
||||
void applyWindowedLayout(); // Calcula windowWidth/Height/dest + SDL_SetWindowSize + SDL_SetWindowPosition
|
||||
void applyFullscreenLayout(); // SDL_GetWindowSize + delegación a computeFullscreenGameRect
|
||||
void computeFullscreenGameRect(); // Calcula dest en fullscreen (integerScale / keepAspect / stretched)
|
||||
void applyLogicalPresentation(bool fullscreen); // SDL_SetRenderLogicalPresentation + persistencia a options
|
||||
|
||||
// Emscripten
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <iostream> // for basic_ostream, operator<<, cout, endl
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h" // for stbi_failure_reason, stbi_image_free
|
||||
#include "external/stb_image.h" // for stbi_failure_reason, stbi_image_free
|
||||
|
||||
SDL_ScaleMode Texture::currentScaleMode = SDL_SCALEMODE_NEAREST;
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
#include "lang.h" // for Lang, ba_BA, en_UK, es_ES
|
||||
#include "menu.h" // for Menu
|
||||
#include "resource.h"
|
||||
#include "screen.h" // for Screen, FILTER_LINEAL, FILTER_NEAREST
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
#include "screen.h" // for Screen, FILTER_LINEAL, FILTER_NEAREST
|
||||
#include "smartsprite.h" // for SmartSprite
|
||||
#include "sprite.h" // for Sprite
|
||||
#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW
|
||||
#include "texture.h" // for Texture
|
||||
|
||||
// Constructor
|
||||
Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, section_t *section) {
|
||||
|
||||
Reference in New Issue
Block a user