diff --git a/fggl/app.cpp b/fggl/app.cpp index 12811d4d2ff775e5aaec98c44e35e147659212f6..603d8e0d0c6dde32bb196a23d27c5f131d4eefad 100644 --- a/fggl/app.cpp +++ b/fggl/app.cpp @@ -28,7 +28,7 @@ namespace fggl { m_states(), m_subsystems(services) {} - int App::run(int /*argc*/, const char **/*argv*/) { + auto App::run(int /*argc*/, const char **/*argv*/) -> int { auto *windowing = m_subsystems->get<display::WindowService>(); { diff --git a/fggl/assets/module.cpp b/fggl/assets/module.cpp index e56972a325f9f392384cc883785fe9a68b36208d..5532515e1ba71fa669143d5b3565cbdc5e216bdf 100644 --- a/fggl/assets/module.cpp +++ b/fggl/assets/module.cpp @@ -20,10 +20,10 @@ namespace fggl::assets { - bool AssetFolders::factory(modules::ModuleService service, modules::Services &services) { + auto AssetFolders::factory(modules::ModuleService service, modules::Services &services) -> bool { if (service == Loader::service) { - auto storage = services.get<data::Storage>(); - auto checkin = services.get<CheckinAdapted>(); + auto *storage = services.get<data::Storage>(); + auto *checkin = services.get<CheckinAdapted>(); services.create<Loader>(storage, checkin); return true; } diff --git a/fggl/assets/packed/module.cpp b/fggl/assets/packed/module.cpp index 3a5646923b4069f10d17ad2f62957651be89ccf0..44e9e56353d2859d336e303772150e68871da937 100644 --- a/fggl/assets/packed/module.cpp +++ b/fggl/assets/packed/module.cpp @@ -20,7 +20,7 @@ namespace fggl::assets { - bool PackedAssets::factory(modules::ModuleService service, modules::Services &services) { + auto PackedAssets::factory(modules::ModuleService service, modules::Services &services) -> bool { if (service == RawCheckin::service) { services.create<RawCheckin>(); return true; diff --git a/fggl/assets/types.cpp b/fggl/assets/types.cpp index a1c44187c252f4517611e1c0ada62a719cd0c89f..b65a652d8bfbf9a19d9cec9ad1c8b0da8621ff92 100644 --- a/fggl/assets/types.cpp +++ b/fggl/assets/types.cpp @@ -19,7 +19,7 @@ #include "fggl/assets/types.hpp" namespace fggl::assets { - AssetID make_asset_id_rt(const std::string &pack, const std::string &path, const std::string &view) { + auto make_asset_id_rt(const std::string &pack, const std::string &path, const std::string &view) -> AssetID { auto fullPath = pack + ":" + path; if (!view.empty()) { fullPath += "[" + view + "]"; @@ -33,7 +33,7 @@ namespace fggl::assets { return AssetID::make(hash); } - AssetID asset_from_user(const std::string &input, const std::string &pack) { + auto asset_from_user(const std::string &input, const std::string &pack) -> AssetID { if (input.find(':') != std::string::npos ) { // probably fully qualified diff --git a/fggl/audio/fallback/audio.cpp b/fggl/audio/fallback/audio.cpp index a8544c2c31c94dff3a551e9195811cd3c67597a9..50edca4b81a45437df6fbbff5e64bdc43cd226b9 100644 --- a/fggl/audio/fallback/audio.cpp +++ b/fggl/audio/fallback/audio.cpp @@ -26,7 +26,7 @@ namespace fggl::audio { void NullAudioService::play(const fggl::audio::AudioClipShort &, bool) { } - bool NullAudio::factory(modules::ModuleService service, modules::Services &services){ + auto NullAudio::factory(modules::ModuleService service, modules::Services &services) -> bool{ if (service == SERVICE_AUDIO_PLAYBACK) { services.bind<audio::AudioService, audio::NullAudioService>(); return true; diff --git a/fggl/audio/openal/audio.cpp b/fggl/audio/openal/audio.cpp index f9a3d244c2861d7517a0818ca9040015898ec165..d118f01f01b2646f7aa43f3b48ed798bb304b8c3 100644 --- a/fggl/audio/openal/audio.cpp +++ b/fggl/audio/openal/audio.cpp @@ -34,7 +34,7 @@ namespace fggl::audio::openal { - assets::AssetRefRaw load_vorbis(assets::Loader* /*loader*/, const assets::AssetID &guid, const assets::LoaderContext &data, void* userPtr) { + auto load_vorbis(assets::Loader* /*loader*/, const assets::AssetID &guid, const assets::LoaderContext &data, void* userPtr) -> assets::AssetRefRaw { auto *manager = static_cast<assets::AssetManager*>(userPtr); auto filePath = data.assetPath; @@ -51,20 +51,16 @@ namespace fggl::audio::openal { return nullptr; } - bool load_vorbis_short(std::filesystem::path path, assets::MemoryBlock& block) { + auto load_vorbis_short(std::filesystem::path path, assets::MemoryBlock& block) -> bool { // vorbis auto* clip = new AudioClipShort(); clip->sampleCount = stb_vorbis_decode_filename( path.c_str(), &clip->channels, &clip->sampleRate, &clip->data); debug::info("clip loaded: channels={}, sampleRate={}, sampleCount={}", clip->channels, clip->sampleRate, clip->sampleCount); - if ( clip->sampleCount == -1 ) { - return false; - } - - return true; + return clip->sampleCount != 1; } - assets::AssetTypeID check_vorbis(std::filesystem::path path ) { + auto check_vorbis(const std::filesystem::path& path ) -> assets::AssetTypeID { if ( path.extension() != ".ogg" ) { return assets::INVALID_ASSET_TYPE; } diff --git a/fggl/audio/openal/module.cpp b/fggl/audio/openal/module.cpp index 964d5c108264bf4abdb2d986faeccd5ad4fb45a1..909dc63c9885d61be82ad3c024bb781680aa2254 100644 --- a/fggl/audio/openal/module.cpp +++ b/fggl/audio/openal/module.cpp @@ -20,7 +20,7 @@ namespace fggl::audio { - bool OpenAL::factory(modules::ModuleService service, modules::Services &services) { + auto OpenAL::factory(modules::ModuleService service, modules::Services &services) -> bool { if (service == SERVICE_AUDIO_PLAYBACK) { auto* assets = services.get<assets::AssetManager>(); diff --git a/fggl/data/assimp/module.cpp b/fggl/data/assimp/module.cpp index 0530bff7d4a115749da7d71757e93f05bb831041..0b070168e1eb2567c1ffe82bd3873dd21f8fde22 100644 --- a/fggl/data/assimp/module.cpp +++ b/fggl/data/assimp/module.cpp @@ -31,19 +31,19 @@ namespace fggl::data::models { - constexpr math::vec3 convert(aiVector3D& vec) { + constexpr auto convert(aiVector3D& vec) -> math::vec3 { return {vec.x, vec.y, vec.z}; } - constexpr math::vec2 convert2(aiVector2D& vec) { + constexpr auto convert2(aiVector2D& vec) -> math::vec2 { return {vec.x, vec.y}; } - constexpr math::vec2 convert2(aiVector3D& vec) { + constexpr auto convert2(aiVector3D& vec) -> math::vec2 { return {vec.x, vec.y}; } - constexpr math::vec3 convert(aiColor3D& col) { + constexpr auto convert(aiColor3D& col) -> math::vec3 { return {col.r, col.g, col.b}; } @@ -108,7 +108,7 @@ namespace fggl::data::models { } } - inline bool isLoaded(assets::AssetID asset) const { + inline auto isLoaded(assets::AssetID asset) const -> bool { return manager->has(asset); } @@ -119,7 +119,7 @@ namespace fggl::data::models { }; - static std::vector<assets::AssetID> process_texture( const aiTextureType type, const aiMaterial* assimpMat, AssetStuff& stuff, const assets::LoaderContext& config) { + static auto process_texture( const aiTextureType type, const aiMaterial* assimpMat, AssetStuff& stuff, const assets::LoaderContext& config) -> std::vector<assets::AssetID> { std::vector<assets::AssetID> matRefs; matRefs.reserve( assimpMat->GetTextureCount(type) ); @@ -138,7 +138,7 @@ namespace fggl::data::models { return matRefs; } - static math::vec3 process_mat_colour(const aiMaterial* mat, const char* name, int a1, int a2) { + static auto process_mat_colour(const aiMaterial* mat, const char* name, int a1, int a2) -> math::vec3 { aiColor3D col{0.0F, 0.0F, 0.0F}; mat->Get( name, a1, a2, col ); debug::info("read colour: {}, {}, {}, {}", name, col.r, col.g, col.b); @@ -147,7 +147,7 @@ namespace fggl::data::models { } static void process_material(const assets::AssetID& guid, aiMaterial* assimpMat, AssetStuff stuff, const assets::LoaderContext& config) { - mesh::Material* material = new mesh::Material(); + auto* material = new mesh::Material(); debug::info("processing: {}", guid); @@ -163,7 +163,7 @@ namespace fggl::data::models { stuff.set( guid, material ); } - assets::AssetRefRaw load_assimp_model(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { + auto load_assimp_model(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) -> assets::AssetRefRaw { // auto *filePath = std::get<assets::AssetPath *>(data); auto filePath = data.assetPath; @@ -199,7 +199,7 @@ namespace fggl::data::models { } // now we can try importing the mesh data - mesh::MultiMesh3D* packedMesh = new mesh::MultiMesh3D(); + auto* packedMesh = new mesh::MultiMesh3D(); process_node( *packedMesh, scene->mRootNode, scene, matAssets); // now we try importing the materials @@ -212,8 +212,8 @@ namespace fggl::data::models { return nullptr; } - assets::AssetRefRaw load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) { - assets::AssetManager* manager = (assets::AssetManager*)userPtr; + auto load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) -> assets::AssetRefRaw { + auto* manager = (assets::AssetManager*)userPtr; if ( manager->has(guid) ) { // already loaded. @@ -238,7 +238,7 @@ namespace fggl::data::models { return nullptr; } - bool load_tex_stb(const std::filesystem::path& filePath, assets::MemoryBlock& block) { + auto load_tex_stb(const std::filesystem::path& filePath, assets::MemoryBlock& block) -> bool { stbi_set_flip_vertically_on_load(1); //load the texture data into memory @@ -258,7 +258,7 @@ namespace fggl::data::models { } } - assets::AssetTypeID is_tex_stb(const std::filesystem::path& filePath) { + auto is_tex_stb(const std::filesystem::path& filePath) -> assets::AssetTypeID { // detect jpgs if ( filePath.extension() == ".jpg" || filePath.extension() == ".jpeg" ) { return TEXTURE_RGBA; @@ -272,7 +272,7 @@ namespace fggl::data::models { return assets::INVALID_ASSET_TYPE; } - assets::AssetTypeID is_model_assimp(const std::filesystem::path& filePath) { + auto is_model_assimp(const std::filesystem::path& filePath) -> assets::AssetTypeID { auto ext = filePath.extension().string(); std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower); @@ -283,7 +283,7 @@ namespace fggl::data::models { return assets::INVALID_ASSET_TYPE; } - bool extract_requirements(const std::string& packName, const std::filesystem::path& packRoot, assets::ResourceRecord& rr) { + auto extract_requirements(const std::string& packName, const std::filesystem::path& packRoot, assets::ResourceRecord& rr) -> bool { Assimp::Importer importer; const aiScene *scene = importer.ReadFile( rr.m_path, aiProcess_Triangulate | aiProcess_FlipUVs); if ( !scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode ) { @@ -314,7 +314,7 @@ namespace fggl::data::models { return true; } - bool AssimpModule::factory(modules::ModuleService service, modules::Services &serviceManager) { + auto AssimpModule::factory(modules::ModuleService service, modules::Services &serviceManager) -> bool { if ( service == MODEL_PROVIDER ) { auto* assetLoader = serviceManager.get<assets::Loader>(); assetLoader->setFactory( MODEL_MULTI3D, load_assimp_model, assets::LoadType::PATH ); diff --git a/fggl/data/heightmap.cpp b/fggl/data/heightmap.cpp index 04735b4e7530be2fd62dfb70710734878f885c3e..ed2f1ae2c5697a4bd3e39e59d03782e453770dc6 100644 --- a/fggl/data/heightmap.cpp +++ b/fggl/data/heightmap.cpp @@ -29,7 +29,7 @@ namespace fggl::data { const int gridOffset = sizeX * sizeY; // calculate normals for each triangle - math::vec3 *triNormals = new math::vec3[sizeX * sizeY * 2]; + auto *triNormals = new math::vec3[sizeX * sizeY * 2]; for (int i = 0; i < sizeX - 1; i++) { for (int j = 0; j < sizeY - 1; j++) { // calculate vertex @@ -57,7 +57,7 @@ namespace fggl::data { const auto lastRow = (i == sizeX - 1); const auto lastCol = (i == sizeY - 1); - auto finalNormal = glm::vec3(0.0f, 0.0f, 0.0f); + auto finalNormal = glm::vec3(0.0F, 0.0F, 0.0F); if (!firstRow && !firstCol) { finalNormal += triNormals[idx(i - 1, j - 1, sizeY)]; @@ -78,7 +78,7 @@ namespace fggl::data { } locations[idx(i, j, sizeY)].normal = - glm::normalize(finalNormal) * -1.0f; //FIXME the normals seem wrong. + glm::normalize(finalNormal) * -1.0F; //FIXME the normals seem wrong. } } delete[] triNormals; @@ -98,8 +98,8 @@ namespace fggl::data { auto zPos = float(z); std::size_t idx1 = idx(x, z, data::heightMaxZ); - locations[idx1].colour = fggl::math::vec3(1.0f, 1.0f, 1.0f); - locations[idx1].posititon = math::vec3(-0.5f + xPos, level, -0.5f - zPos); + locations[idx1].colour = fggl::math::vec3(1.0F, 1.0F, 1.0F); + locations[idx1].posititon = math::vec3(-0.5F + xPos, level, -0.5F - zPos); } } gridVertexNormals(locations.data()); diff --git a/fggl/data/model.cpp b/fggl/data/model.cpp index c3c843f0ae06481892f4382f37a65f1c33d2c07a..7451ed33c38666fa2bf8895102362d4c541f0877 100644 --- a/fggl/data/model.cpp +++ b/fggl/data/model.cpp @@ -28,13 +28,13 @@ void Mesh::pushIndex(unsigned int idx) { m_index.push_back(idx); } -Mesh::IndexType Mesh::pushVertex(Vertex vert) { +auto Mesh::pushVertex(Vertex vert) -> Mesh::IndexType { auto idx = m_verts.size(); m_verts.push_back(vert); return idx; } -Mesh::IndexType Mesh::indexOf(Vertex term) { +auto Mesh::indexOf(Vertex term) -> Mesh::IndexType { auto itr = std::find(m_verts.begin(), m_verts.end(), term); if (itr == m_verts.end()) { return INVALID_IDX; diff --git a/fggl/data/module.cpp b/fggl/data/module.cpp index 883e1d916f92b56b6e4de0d6444690e692e06453..1872b5f34dc97757bc648438b61b48c5dfba30c7 100644 --- a/fggl/data/module.cpp +++ b/fggl/data/module.cpp @@ -20,7 +20,7 @@ namespace fggl::data { - bool LocalStorage::factory(modules::ModuleService service, modules::Services &data) { + auto LocalStorage::factory(modules::ModuleService service, modules::Services &data) -> bool { if (service == SERVICE_STORAGE) { // FIXME: no easy way to set the application name auto pathConfig = fggl::platform::calc_engine_paths("fggl-demo"); diff --git a/fggl/data/procedural.cpp b/fggl/data/procedural.cpp index 6770d0efadc45ed6c29f20f4d166c1c0ecc3a3af..27e4a9627eaffb0d5118f0cf6634db23020d6538 100644 --- a/fggl/data/procedural.cpp +++ b/fggl/data/procedural.cpp @@ -26,7 +26,7 @@ using namespace fggl::data; // from https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal -static glm::vec3 calcSurfaceNormal(glm::vec3 vert1, glm::vec3 vert2, glm::vec3 vert3) { +static auto calcSurfaceNormal(glm::vec3 vert1, glm::vec3 vert2, glm::vec3 vert3) -> glm::vec3 { const glm::vec3 edge1 = vert2 - vert1; const glm::vec3 edge2 = vert3 - vert1; return glm::normalize(glm::cross(edge1, edge2)); @@ -183,7 +183,7 @@ namespace fggl::data { } // namespace fggl::data -fggl::data::Mesh fggl::data::make_triangle() { +auto fggl::data::make_triangle() -> fggl::data::Mesh { constexpr fggl::math::vec3 pos[]{ {-0.5F, -0.5F, 0.0F}, {0.5F, -0.5F, 0.0F}, @@ -204,7 +204,7 @@ fggl::data::Mesh fggl::data::make_triangle() { return mesh; } -fggl::data::Mesh fggl::data::make_quad_xy() { +auto fggl::data::make_quad_xy() -> fggl::data::Mesh { constexpr fggl::math::vec3 pos[]{ {-0.5F, -0.5F, 0.0F}, {0.5F, -0.5F, 0.0F}, @@ -229,7 +229,7 @@ fggl::data::Mesh fggl::data::make_quad_xy() { return mesh; } -fggl::data::Mesh fggl::data::make_quad_xz() { +auto fggl::data::make_quad_xz() -> fggl::data::Mesh { constexpr std::array<fggl::math::vec3, 4> pos{{ {-0.5F, 0.0F, -0.5F}, {0.5F, 0.0F, -0.5F}, @@ -254,7 +254,7 @@ fggl::data::Mesh fggl::data::make_quad_xz() { return mesh; } -fggl::mesh::Mesh3D fggl::data::make_cube(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) { +auto fggl::data::make_cube(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) -> fggl::mesh::Mesh3D { // done as two loops, top loop is 0,1,2,3, bottom loop is 4,5,6,7 constexpr std::array<fggl::math::vec3, 8> pos{{ {-0.5, 0.5, -0.5}, // 0 TOP LOOP @@ -285,7 +285,7 @@ fggl::mesh::Mesh3D fggl::data::make_cube(fggl::mesh::Mesh3D &mesh, const fggl::m return mesh; } -fggl::mesh::Mesh3D fggl::data::make_slope(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) { +auto fggl::data::make_slope(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) -> fggl::mesh::Mesh3D { // done as two loops, top loop is 0,1,2,3, bottom loop is 4,5,6,7 // FIXME remove 2 and 3 and renumber the index list accordingly @@ -316,7 +316,7 @@ fggl::mesh::Mesh3D fggl::data::make_slope(fggl::mesh::Mesh3D &mesh, const fggl:: return mesh; } -fggl::mesh::Mesh3D fggl::data::make_ditch(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) { +auto fggl::data::make_ditch(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) -> fggl::mesh::Mesh3D { // done as two loops, top loop is 0,1,2,3, bottom loop is 4,5,6,7 // FIXME remove 2 and renumber the index list accordingly @@ -349,7 +349,7 @@ fggl::mesh::Mesh3D fggl::data::make_ditch(fggl::mesh::Mesh3D &mesh, const fggl:: return mesh; } -fggl::mesh::Mesh3D fggl::data::make_point(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) { +auto fggl::data::make_point(fggl::mesh::Mesh3D &mesh, const fggl::math::mat4 &transform) -> fggl::mesh::Mesh3D { // done as two loops, top loop is 0,1,2,3, bottom loop is 4,5,6,7 constexpr fggl::math::vec3 pos[]{ diff --git a/fggl/debug/imgui/include/imgui_impl_glfw.h b/fggl/debug/imgui/include/imgui_impl_glfw.h index 20348cc36320c3d8b2ae6f2a5a6fe82d53fbf3b1..470148bd84289d6ded1074df1b946f97491e0a44 100644 --- a/fggl/debug/imgui/include/imgui_impl_glfw.h +++ b/fggl/debug/imgui/include/imgui_impl_glfw.h @@ -21,9 +21,9 @@ struct GLFWwindow; -IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow *window, bool install_callbacks); -IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow *window, bool install_callbacks); -IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow *window, bool install_callbacks); +IMGUI_IMPL_API auto ImGui_ImplGlfw_InitForOpenGL(GLFWwindow *window, bool install_callbacks) -> bool; +IMGUI_IMPL_API auto ImGui_ImplGlfw_InitForVulkan(GLFWwindow *window, bool install_callbacks) -> bool; +IMGUI_IMPL_API auto ImGui_ImplGlfw_InitForOther(GLFWwindow *window, bool install_callbacks) -> bool; IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); diff --git a/fggl/debug/imgui/include/imgui_impl_opengl3.h b/fggl/debug/imgui/include/imgui_impl_opengl3.h index 90fa1ad5e4ffe068e8865b1e1a270aad4cfb9e37..1ada73d3a9010f203c40c0041fdfda60887e109c 100644 --- a/fggl/debug/imgui/include/imgui_impl_opengl3.h +++ b/fggl/debug/imgui/include/imgui_impl_opengl3.h @@ -25,15 +25,15 @@ #include "imgui.h" // IMGUI_IMPL_API // Backend API -IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char *glsl_version = NULL); +IMGUI_IMPL_API auto ImGui_ImplOpenGL3_Init(const char *glsl_version = NULL) -> bool; IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData *draw_data); // (Optional) Called by Init/NewFrame/Shutdown -IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); +IMGUI_IMPL_API auto ImGui_ImplOpenGL3_CreateFontsTexture() -> bool; IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); -IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); +IMGUI_IMPL_API auto ImGui_ImplOpenGL3_CreateDeviceObjects() -> bool; IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); // Specific OpenGL ES versions diff --git a/fggl/debug/logging.cpp b/fggl/debug/logging.cpp index 3c726c54c7256cb862e8cf7aa9cea9bcfdbed230..47918b409195331289ef81cfea95b6f13fd7d250 100644 --- a/fggl/debug/logging.cpp +++ b/fggl/debug/logging.cpp @@ -23,7 +23,7 @@ #include <cxxabi.h> namespace fggl::debug { - std::string demangle(const char *name) { + auto demangle(const char *name) -> std::string { int status = -4; std::unique_ptr<char, decltype(&std::free)> res{ diff --git a/fggl/entity/loader/loader.cpp b/fggl/entity/loader/loader.cpp index 076aa57ff6ea203d93d698baef6dcdf1d92aff94..f75f363ba8c859153e516693cad27c4d0f25734e 100644 --- a/fggl/entity/loader/loader.cpp +++ b/fggl/entity/loader/loader.cpp @@ -22,8 +22,8 @@ namespace fggl::entity { - assets::AssetRefRaw load_scene(assets::Loader* loader, const assets::AssetID& asset, const assets::LoaderContext& data, void* ptr) { - scenes::Game* gamePtr = (scenes::Game*)ptr; + auto load_scene(assets::Loader* loader, const assets::AssetID& asset, const assets::LoaderContext& data, void* ptr) -> assets::AssetRefRaw { + auto* gamePtr = (scenes::Game*)ptr; auto filePath = data.assetPath; // load assets @@ -77,7 +77,7 @@ namespace fggl::entity { return nullptr; } - assets::AssetRefRaw load_prototype(assets::Loader* loader, const assets::AssetID &guid, const assets::LoaderContext& data, EntityFactory* factory) { + auto load_prototype(assets::Loader* loader, const assets::AssetID &guid, const assets::LoaderContext& data, EntityFactory* factory) -> assets::AssetRefRaw { auto filePath = data.assetPath; // We need to process the prototypes, and load them into the asset system. @@ -105,7 +105,7 @@ namespace fggl::entity { } if ( prefab["tags"].IsDefined() ) { - for ( auto& tagNode : prefab["tags"] ) { + for ( const auto& tagNode : prefab["tags"] ) { entity.tags.push_back( tagNode.as< util::GUID >() ); } } diff --git a/fggl/entity/module.cpp b/fggl/entity/module.cpp index 3d70df9c5951aa00c5d57a0603799d1c1acdbf47..29256f52ffb8cf02929d4ce261967936aa74cc82 100644 --- a/fggl/entity/module.cpp +++ b/fggl/entity/module.cpp @@ -37,7 +37,7 @@ namespace fggl::entity { factory->bind(math::Transform::guid, make_transform); } - static assets::AssetTypeID is_scene(std::filesystem::path path) { + static auto is_scene(std::filesystem::path path) -> assets::AssetTypeID { if ( path.extension() == ".yml" ) { return ENTITY_SCENE; } @@ -45,7 +45,7 @@ namespace fggl::entity { return assets::INVALID_ASSET_TYPE; } - bool get_scene_deps(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr) { + auto get_scene_deps(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr) -> bool { auto nodes = YAML::LoadAllFromFile( rr.m_path ); for ( auto& node : nodes ) { @@ -65,7 +65,7 @@ namespace fggl::entity { } - bool ECS::factory(modules::ModuleService service, modules::Services &services) { + auto ECS::factory(modules::ModuleService service, modules::Services &services) -> bool { if (service == EntityFactory::service) { auto *factory = services.create<EntityFactory>(services); install_component_factories(factory); diff --git a/fggl/gfx/atlas.cpp b/fggl/gfx/atlas.cpp index 680d1f4fcea3fe06702e40d28269f4ebb9f73ba4..d3b502bd0611da0f00342a7cc74c0d24b8f3fbc2 100644 --- a/fggl/gfx/atlas.cpp +++ b/fggl/gfx/atlas.cpp @@ -42,8 +42,8 @@ static void unpack_stbrp_query(Query &query, std::vector<stbrp_rect> &data) { } } -bool pack_iter(int width, int height, std::vector<stbrp_rect> &query) { - stbrp_node *tmp = new stbrp_node[width]; +auto pack_iter(int width, int height, std::vector<stbrp_rect> &query) -> bool { + auto *tmp = new stbrp_node[width]; // setup context stbrp_context context; @@ -56,7 +56,7 @@ bool pack_iter(int width, int height, std::vector<stbrp_rect> &query) { namespace fggl::gfx { - bool pack(std::vector<Bounds2D> &pack) { + auto pack(std::vector<Bounds2D> &pack) -> bool { // setup query structure std::vector<stbrp_rect> query; query.reserve(pack.size()); diff --git a/fggl/gfx/input.cpp b/fggl/gfx/input.cpp index 5d104e27a7828734dd0017100423508200550cde..800760cd0899ba5c839f7559dfcbd21ee1406c79 100644 --- a/fggl/gfx/input.cpp +++ b/fggl/gfx/input.cpp @@ -53,15 +53,15 @@ void Input::mousePos(double x, double y) { m_mouse_curr.cursor[1] = y; } -double Input::cursorDeltaX() const { +auto Input::cursorDeltaX() const -> double { return m_mouse_last.cursor[0] - m_mouse_curr.cursor[0]; } -double Input::cursorDeltaY() const { +auto Input::cursorDeltaY() const -> double { return m_mouse_last.cursor[1] - m_mouse_curr.cursor[1]; } -const double *Input::mousePos() const { +auto Input::mousePos() const -> const double * { return m_mouse_curr.scroll.data(); } @@ -70,15 +70,15 @@ void Input::mouseScroll(double deltaX, double deltaY) { m_mouse_curr.scroll[1] = deltaY; } -const double *Input::mouseScroll() const { +auto Input::mouseScroll() const -> const double * { return m_mouse_curr.scroll.data(); } -double Input::scrollDeltaX() const { +auto Input::scrollDeltaX() const -> double { return m_mouse_curr.scroll[0]; } -double Input::scrollDeltaY() const { +auto Input::scrollDeltaY() const -> double { return m_mouse_curr.scroll[1]; } @@ -90,15 +90,15 @@ void Input::mouseBtn(const MouseButton btn, bool state) { } } -bool Input::mouseDown(const MouseButton btn) const { +auto Input::mouseDown(const MouseButton btn) const -> bool { return m_mouse_curr.buttons & btn; } -bool Input::mousePressed(const MouseButton btn) const { +auto Input::mousePressed(const MouseButton btn) const -> bool { return (m_mouse_curr.buttons & btn) && !(m_mouse_last.buttons & btn); } -bool Input::mouseReleased(const MouseButton btn) const { +auto Input::mouseReleased(const MouseButton btn) const -> bool { return !(m_mouse_curr.buttons & btn) && (m_mouse_last.buttons & btn); } @@ -114,11 +114,11 @@ void Input::joystickDisconnect(int id) { m_joydata[id] = Joystick(); } -bool Input::hasJoystick(int id) const { +auto Input::hasJoystick(int id) const -> bool { return m_joysticks[id]; } -const fggl::gfx::Joystick &Input::joystick(int id) const { +auto Input::joystick(int id) const -> const fggl::gfx::Joystick & { return m_joydata[id]; } @@ -126,22 +126,22 @@ void Input::padState(int id, const PadState &state) { m_pad_curr[id] = state; } -bool Input::padDown(int id, PadButton btn) { +auto Input::padDown(int id, PadButton btn) -> bool { return m_pad_curr[id].buttons[(int) btn]; } -bool Input::padPressed(int id, PadButton btn) { +auto Input::padPressed(int id, PadButton btn) -> bool { return m_pad_curr[id].buttons[(int) btn] && !m_pad_last[id].buttons[(int) btn]; } -bool Input::padReleased(int id, PadButton btn) { +auto Input::padReleased(int id, PadButton btn) -> bool { return !m_pad_curr[id].buttons[(int) btn] && m_pad_last[id].buttons[(int) btn]; } -float Input::padAxis(int id, PadAxis axis) { +auto Input::padAxis(int id, PadAxis axis) -> float { return m_pad_curr[id].axes[(int) axis]; } -float Input::padAxisDelta(int id, PadAxis axis) { +auto Input::padAxisDelta(int id, PadAxis axis) -> float { return m_pad_last[id].axes[(int) axis] - m_pad_curr[id].axes[(int) axis]; } diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp index 772920c252d823cbfb70f1448ee6bcc3bb139037..f35642c72de9d9c511769c05b7e8803927e3a2b7 100644 --- a/fggl/gfx/ogl/renderer.cpp +++ b/fggl/gfx/ogl/renderer.cpp @@ -151,7 +151,7 @@ namespace fggl::gfx { } } - static ogl::Image make_solid(uint8_t width, uint8_t height, GLuint colour) { + static auto make_solid(uint8_t width, uint8_t height, GLuint colour) -> ogl::Image { auto *texData = new GLuint[width * height]; for (int i = 0; i < width * height; ++i) { diff --git a/fggl/gfx/ogl/shader.cpp b/fggl/gfx/ogl/shader.cpp index 6ba49c412cca3cca377870a138b60b2706225c6d..31d96b6a91ededf341c89dcdcd406703b7a3571b 100644 --- a/fggl/gfx/ogl/shader.cpp +++ b/fggl/gfx/ogl/shader.cpp @@ -23,7 +23,7 @@ namespace fggl::gfx { - bool ShaderCache::compileShaderFromSource(const std::string &source, GLuint sid) { + auto ShaderCache::compileShaderFromSource(const std::string &source, GLuint sid) -> bool { // upload and compile shader const char *src = source.c_str(); glShaderSource(sid, 1, &src, nullptr); @@ -47,7 +47,7 @@ namespace fggl::gfx { return true; } - bool ShaderCache::readAndCompileShader(const std::string &filename, GLuint shader) { + auto ShaderCache::readAndCompileShader(const std::string &filename, GLuint shader) -> bool { std::string source; bool result = m_storage->load(fggl::data::Data, filename, &source); if (!result) { @@ -89,7 +89,7 @@ namespace fggl::gfx { } - bool ShaderCache::loadFromDisk(GLuint pid, const std::string &pipelineName) { + auto ShaderCache::loadFromDisk(GLuint pid, const std::string &pipelineName) -> bool { BinaryCache cache; auto fname = "shader_" + pipelineName + ".bin"; @@ -113,7 +113,7 @@ namespace fggl::gfx { m_storage->save(fggl::data::Cache, fname, &cache); } - ShaderCache::ShaderPtr ShaderCache::getOrLoad(const ShaderConfig &config) { + auto ShaderCache::getOrLoad(const ShaderConfig &config) -> ShaderCache::ShaderPtr { try { return m_shaders.at(config.name); } catch (std::out_of_range &e) { @@ -121,7 +121,7 @@ namespace fggl::gfx { } } - ShaderCache::ShaderPtr ShaderCache::get(const std::string &name) { + auto ShaderCache::get(const std::string &name) -> ShaderCache::ShaderPtr { auto itr = m_shaders.find(name); if ( itr != m_shaders.end() ){ return itr->second; @@ -129,7 +129,7 @@ namespace fggl::gfx { return nullptr; } - ShaderCache::ShaderPtr ShaderCache::load(const ShaderConfig &config) { + auto ShaderCache::load(const ShaderConfig &config) -> ShaderCache::ShaderPtr { spdlog::debug("starting shader program generation for {}", config.name); GLuint pid = glCreateProgram(); @@ -200,7 +200,7 @@ namespace fggl::gfx { return shaderPtr; } - ShaderCache::ShaderPtr ShaderCache::load(const ShaderSources &sources, bool allowBinaryCache) { + auto ShaderCache::load(const ShaderSources &sources, bool allowBinaryCache) -> ShaderCache::ShaderPtr { spdlog::debug("starting shader program generation for {}", sources.name); @@ -281,7 +281,7 @@ namespace fggl::gfx { glGetProgramBinary(pid, length, &cache->size, &cache->format, cache->data); } - bool ShaderCache::cacheLoad(GLuint pid, const BinaryCache *cache) { + auto ShaderCache::cacheLoad(GLuint pid, const BinaryCache *cache) -> bool { if (!m_binary) { return false; } @@ -306,7 +306,7 @@ namespace fggl::gfx { } template<> - bool fggl::data::fggl_deserialize(std::filesystem::path &data, fggl::gfx::BinaryCache *out) { + auto fggl::data::fggl_deserialize(std::filesystem::path &data, fggl::gfx::BinaryCache *out) -> bool { auto* f = #ifdef _MSC_VER _wfopen(data.c_str(), L"r"); @@ -350,7 +350,7 @@ namespace fggl::gfx { template<> -bool fggl::data::fggl_deserialize(std::filesystem::path &data, std::string *out) { +auto fggl::data::fggl_deserialize(std::filesystem::path &data, std::string *out) -> bool { std::ifstream ifs(data); out->assign((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); @@ -358,10 +358,10 @@ bool fggl::data::fggl_deserialize(std::filesystem::path &data, std::string *out) } template<> -bool fggl::data::fggl_serialize(std::filesystem::path &data, const fggl::gfx::BinaryCache *out) { +auto fggl::data::fggl_serialize(std::filesystem::path &data, const fggl::gfx::BinaryCache *out) -> bool { // try and write - auto f = + auto *f = #ifdef _MSC_VER _wfopen( data.c_str(), L"w"); #else diff --git a/fggl/gfx/ogl/types.cpp b/fggl/gfx/ogl/types.cpp index 2753c2880212c5ce192fdc49b232a1c51f3e655d..a72dde8319d94b9b88804a43c93fca84abcd6483 100644 --- a/fggl/gfx/ogl/types.cpp +++ b/fggl/gfx/ogl/types.cpp @@ -44,7 +44,7 @@ namespace fggl::gfx::ogl { other.m_obj = 0; } - VertexArray &VertexArray::operator=(VertexArray &&other) { + auto VertexArray::operator=(VertexArray &&other) -> VertexArray & { if (this != &other) { release(); std::swap(m_obj, other.m_obj); diff --git a/fggl/gfx/ogl4/canvas.cpp b/fggl/gfx/ogl4/canvas.cpp index 95aa89ae27abdbbeb4a97f8053635ae763fb92ad..00da747d4f1dd1c9e0304d97e6fb1193ecd80fdc 100644 --- a/fggl/gfx/ogl4/canvas.cpp +++ b/fggl/gfx/ogl4/canvas.cpp @@ -161,7 +161,7 @@ namespace fggl::gfx::ogl4 { // setup the shader shader.use(); - auto projMat = glm::ortho(0.0f, 1920.0f, 1080.0f, 0.f); + auto projMat = glm::ortho(0.0F, 1920.0F, 1080.0F, 0.F); shader.setUniformMtx(shader.uniform("projection"), projMat); // bind the vbo we'll use for writing diff --git a/fggl/gfx/ogl4/meshes.cpp b/fggl/gfx/ogl4/meshes.cpp index c0f0c2ffdb7aef5f6e389aff4b3a6be29df9904e..7ccae929f1fae6c83576c749e485c26aa9f8cc00 100644 --- a/fggl/gfx/ogl4/meshes.cpp +++ b/fggl/gfx/ogl4/meshes.cpp @@ -23,8 +23,8 @@ namespace fggl::gfx::ogl4 { - static std::shared_ptr<ogl::ArrayBuffer> setup_array_buffer(std::shared_ptr<ogl::VertexArray> &vao, - const std::vector<mesh::Vertex3D> &data) { + static auto setup_array_buffer(std::shared_ptr<ogl::VertexArray> &vao, + const std::vector<mesh::Vertex3D> &data) -> std::shared_ptr<ogl::ArrayBuffer> { // upload the data to the GPU auto buff = std::make_shared<ogl::ArrayBuffer>(); buff->write(data.size() * sizeof(mesh::Vertex3D), data.data(), ogl::BufUsage::STATIC_DRAW); @@ -43,7 +43,7 @@ namespace fggl::gfx::ogl4 { return buff; } - static std::shared_ptr<ogl::ElementBuffer> setup_index_buffer(const std::vector<uint32_t>& data) { + static auto setup_index_buffer(const std::vector<uint32_t>& data) -> std::shared_ptr<ogl::ElementBuffer> { auto elementBuffer = std::make_shared<ogl::ElementBuffer>(); elementBuffer->write(data.size() * sizeof(uint32_t), data.data(), ogl::BufUsage::STATIC_DRAW); @@ -148,9 +148,9 @@ namespace fggl::gfx::ogl4 { shader->setUniformI(shader->uniform("lights[0].isLocal"), local); shader->setUniformI(shader->uniform("lights[0].isSpot"), 0); - shader->setUniformF(shader->uniform("lights[0].constantAttenuation"), 5.0f); - shader->setUniformF(shader->uniform("lights[0].linearAttenuation"), 0.0f); - shader->setUniformF(shader->uniform("lights[0].quadraticAttenuation"), 0.0f); + shader->setUniformF(shader->uniform("lights[0].constantAttenuation"), 5.0F); + shader->setUniformF(shader->uniform("lights[0].linearAttenuation"), 0.0F); + shader->setUniformF(shader->uniform("lights[0].quadraticAttenuation"), 0.0F); shader->setUniformF(shader->uniform("Strength"), 0.6F); @@ -162,20 +162,20 @@ namespace fggl::gfx::ogl4 { shader->setUniformF(shader->uniform("EyeDirection"), viewDir); shader->setUniformF(shader->uniform("lights[0].position"), lightPos); } else { - auto camModelView = (viewMatrix * camTransform.model() * math::vec4(0.0f, 0.0f, 0.0f, 1.0f)); - auto modelModelView = (viewMatrix * transform.model() * math::vec4(0.0f, 0.0f, 0.0f, 1.0f)); + auto camModelView = (viewMatrix * camTransform.model() * math::vec4(0.0F, 0.0F, 0.0F, 1.0F)); + auto modelModelView = (viewMatrix * transform.model() * math::vec4(0.0F, 0.0F, 0.0F, 1.0F)); math::vec3 viewDir = glm::normalize(camModelView - modelModelView); shader->setUniformF(shader->uniform("EyeDirection"), viewDir); shader->setUniformF(shader->uniform("lights[0].position"), - math::vec3(viewMatrix * math::vec4(lightPos, 1.0f))); + math::vec3(viewMatrix * math::vec4(lightPos, 1.0F))); } - shader->setUniformF(shader->uniform("lights[0].ambient"), {0.0f, 0.5f, 0.0f}); - shader->setUniformF(shader->uniform("lights[0].colour"), {0.5f, 0.5f, 0.5f}); + shader->setUniformF(shader->uniform("lights[0].ambient"), {0.0F, 0.5F, 0.0F}); + shader->setUniformF(shader->uniform("lights[0].colour"), {0.5F, 0.5F, 0.5F}); } - static ogl::Texture* upload_texture( assets::AssetID name, assets::AssetManager* manager ) { + static auto upload_texture( assets::AssetID name, assets::AssetManager* manager ) -> ogl::Texture* { debug::info("loading texture: {}", name.get()); auto uploadedTex = assets::make_asset_id_rt("ogl", std::to_string(name.get()) ); @@ -184,7 +184,7 @@ namespace fggl::gfx::ogl4 { return texture; } - auto textureData = manager->get<data::Texture2D>(name); + auto *textureData = manager->get<data::Texture2D>(name); ogl::Image image{ .type = ogl::PixelFormat::UNSIGNED_BYTE, .format = ogl::ImageFormat::RGB, @@ -198,13 +198,13 @@ namespace fggl::gfx::ogl4 { return manager->set(uploadedTex, texture); } - static Material* get_fallback_material(assets::AssetManager* manager) { + static auto get_fallback_material(assets::AssetManager* manager) -> Material* { auto* fallback = manager->get<Material>(FALLBACK_MAT); if ( fallback != nullptr ) { return fallback; } - Material* mat = new Material(); + auto* mat = new Material(); mat->m_diffCol = FALLBACK_COLOUR; mat->m_specCol= FALLBACK_COLOUR; @@ -214,7 +214,7 @@ namespace fggl::gfx::ogl4 { return manager->set(FALLBACK_MAT, mat); } - static Material* upload_material( assets::AssetID name, assets::AssetManager* manager ) { + static auto upload_material( assets::AssetID name, assets::AssetManager* manager ) -> Material* { auto* meshMaterial = manager->get<mesh::Material>(name); if ( meshMaterial == nullptr ){ debug::error("attempted to load material {}, but did not exist!", name.get()); @@ -255,7 +255,7 @@ namespace fggl::gfx::ogl4 { return manager->set( uploadedMat, material); } - MeshData upload_mesh(const mesh::Mesh3D& rawMesh, assets::AssetManager* manager) { + auto upload_mesh(const mesh::Mesh3D& rawMesh, assets::AssetManager* manager) -> MeshData { auto vao = std::make_shared<ogl::VertexArray>(); return { .vao = vao, @@ -267,7 +267,7 @@ namespace fggl::gfx::ogl4 { }; } - std::vector<MeshData> upload_multi_mesh(const mesh::MultiMesh3D& rawMesh, assets::AssetManager* manager) { + auto upload_multi_mesh(const mesh::MultiMesh3D& rawMesh, assets::AssetManager* manager) -> std::vector<MeshData> { std::vector<MeshData> gpuMeshes; for (const auto& mesh : rawMesh.meshes) { gpuMeshes.push_back( upload_mesh(mesh, manager) ); diff --git a/fggl/gfx/ogl4/models.cpp b/fggl/gfx/ogl4/models.cpp index 831b3a2d1fc32fed6b482d16e8e3a55fa88bf647..c063618b774ee1eb19c3ddcd49ffe14a9b48fecd 100644 --- a/fggl/gfx/ogl4/models.cpp +++ b/fggl/gfx/ogl4/models.cpp @@ -28,8 +28,8 @@ namespace fggl::gfx::ogl4 { - static std::shared_ptr<ogl::ArrayBuffer> setup_array_buffer(std::shared_ptr<ogl::VertexArray> &vao, - const std::vector<data::Vertex> &data) { + static auto setup_array_buffer(std::shared_ptr<ogl::VertexArray> &vao, + const std::vector<data::Vertex> &data) -> std::shared_ptr<ogl::ArrayBuffer> { auto buff = std::make_shared<ogl::ArrayBuffer>(); buff->write(data.size() * sizeof(data::Vertex), data.data(), ogl::BufUsage::STATIC_DRAW); @@ -45,8 +45,8 @@ namespace fggl::gfx::ogl4 { } - static std::shared_ptr<ogl::ElementBuffer> setup_index_buffer(std::shared_ptr<ogl::VertexArray> &vao, - const std::vector<uint32_t> &data) { + static auto setup_index_buffer(std::shared_ptr<ogl::VertexArray> &vao, + const std::vector<uint32_t> &data) -> std::shared_ptr<ogl::ElementBuffer> { auto elementBuffer = std::make_shared<ogl::ElementBuffer>(); elementBuffer->write(data.size() * sizeof(uint32_t), data.data(), ogl::BufUsage::STATIC_DRAW); @@ -67,7 +67,7 @@ namespace fggl::gfx::ogl4 { modelComp.drawType = ogl::Primitive::TRIANGLE; } - StaticModel* StaticModelRenderer::uploadMesh(assets::AssetID guid, const data::Mesh &mesh, bool allowCache) { + auto StaticModelRenderer::uploadMesh(assets::AssetID guid, const data::Mesh &mesh, bool allowCache) -> StaticModel* { assert( m_assets != nullptr ); // if the asset has already been uploaded, we don't need to do anything @@ -117,7 +117,7 @@ namespace fggl::gfx::ogl4 { return modelAsset; }*/ - StaticModelGPU* StaticModelRenderer::uploadMesh2(const assets::AssetID& meshName, const data::Mesh &mesh) { + auto StaticModelRenderer::uploadMesh2(const assets::AssetID& meshName, const data::Mesh &mesh) -> StaticModelGPU* { assert( m_assets != nullptr ); if ( m_assets->has(meshName) ) { @@ -191,8 +191,8 @@ namespace fggl::gfx::ogl4 { // terrain auto terrain = world.find<data::HeightMap>(); - for (auto &renderable : terrain) { - auto currModel = world.tryGet<StaticModel>(renderable); + for (const auto &renderable : terrain) { + auto *currModel = world.tryGet<StaticModel>(renderable); if (currModel != nullptr) { continue; } diff --git a/fggl/gfx/ogl4/module.cpp b/fggl/gfx/ogl4/module.cpp index 534b0166f3a555eaac8bc8bb1fc9c686c6306b7b..8757be785b4cd38776e9b0af719f82a32585d52d 100644 --- a/fggl/gfx/ogl4/module.cpp +++ b/fggl/gfx/ogl4/module.cpp @@ -82,7 +82,7 @@ namespace fggl::gfx { mesh::MultiMesh3D* multiMesh; for (const auto &node : spec.config["shape"]) { - mesh::Mesh3D* meshAsset = new mesh::Mesh3D(); + auto* meshAsset = new mesh::Mesh3D(); process_shape(node, *meshAsset); multiMesh->meshes.push_back(*meshAsset); delete meshAsset; @@ -99,7 +99,7 @@ namespace fggl::gfx { #endif } else { - mesh::Mesh3D* meshAsset = new mesh::Mesh3D(); + auto* meshAsset = new mesh::Mesh3D(); process_shape(spec.config["shape"], *meshAsset); #ifdef FGGL_ALLOW_DEFERRED_UPLOAD @@ -169,7 +169,7 @@ namespace fggl::gfx { light.quadratic = spec.get<float>("quadratic", 0.000007F); } - bool OpenGL4::factory(modules::ModuleService service, modules::Services &services) { + auto OpenGL4::factory(modules::ModuleService service, modules::Services &services) -> bool { if (service == WindowGraphics::service) { // setup the thing responsible for graphics auto *storage = services.get<data::Storage>(); diff --git a/fggl/gfx/ogl4/setup.cpp b/fggl/gfx/ogl4/setup.cpp index 85fbde7baf509164d8b086954c5735ecd42ec014..7668b21e753106b1f51e74f389985091664db60c 100644 --- a/fggl/gfx/ogl4/setup.cpp +++ b/fggl/gfx/ogl4/setup.cpp @@ -20,7 +20,7 @@ namespace fggl::gfx::ogl4 { - Graphics *WindowGraphics::create(display::Window &window) { + auto WindowGraphics::create(display::Window &window) -> Graphics * { return new OpenGL4Backend(m_storage, m_fonts, m_assets, (GlFunctionLoader)glfwGetProcAddress); } diff --git a/fggl/gfx/window.cpp b/fggl/gfx/window.cpp index 43ddacd0da647e51642127418ae1c112e02d16d4..cf1da9c482749b34b34aa9c7409d668a2b37950c 100644 --- a/fggl/gfx/window.cpp +++ b/fggl/gfx/window.cpp @@ -218,14 +218,14 @@ namespace fggl::display::glfw { glfwMakeContextCurrent(m_window); } - fggl::math::vec2i Window::frameSize() const { + auto Window::frameSize() const -> fggl::math::vec2i { assert(m_window != nullptr); math::vec2i size; glfwGetFramebufferSize(m_window, &size.x, &size.y); return size; } - bool Window::wantClose() const { + auto Window::wantClose() const -> bool { assert(m_window != nullptr); return glfwWindowShouldClose(m_window) == GLFW_TRUE; } diff --git a/fggl/gui/containers.cpp b/fggl/gui/containers.cpp index 9626b7d25b9fef182801c9d169c53c0b3b4e9c18..15da80673aa12839530bd05872f897d60a4ece22 100644 --- a/fggl/gui/containers.cpp +++ b/fggl/gui/containers.cpp @@ -17,7 +17,7 @@ namespace fggl::gui { - Widget *Container::getChildAt(const math::vec2 &point) { + auto Container::getChildAt(const math::vec2 &point) -> Widget * { for (auto &child : m_children) { if (child->contains(point)) { return child->getChildAt(point); @@ -27,7 +27,7 @@ namespace fggl::gui { return nullptr; } - bool Container::contains(const math::vec2 &point) { + auto Container::contains(const math::vec2 &point) -> bool { return true; } @@ -82,8 +82,8 @@ namespace fggl::gui { int rows = m_children.size() / m_cols; // figure out the width and heights - float* widths = new float[m_cols]{0.0F}; - float* heights = new float[rows]{0.0F}; + auto* widths = new float[m_cols]{0.0F}; + auto* heights = new float[rows]{0.0F}; for ( auto idx = 0U; idx < m_children.size(); ++idx) { auto& child = m_children[idx]; int col = idx % m_cols; @@ -145,7 +145,7 @@ namespace fggl::gui { void Panel::render(gfx::Paint &paint) { // background painting time gfx::Path2D background(topLeft()); - background.colour(math::vec3(32.0f / 255.0f, 74.0F / 255.0F, 135.0F / 255.0F)); + background.colour(math::vec3(32.0F / 255.0F, 74.0F / 255.0F, 135.0F / 255.0F)); draw_box(background, topLeft(), bottomRight()); paint.fill(background); diff --git a/fggl/gui/fonts.cpp b/fggl/gui/fonts.cpp index a8d91a960bb2040d6c451b84c2458728ddf40b73..172cc47108df4d6b47ac5004dbefd417f7492102 100644 --- a/fggl/gui/fonts.cpp +++ b/fggl/gui/fonts.cpp @@ -37,7 +37,7 @@ namespace fggl::gui { FT_Done_FreeType(m_context); } - GlyphMetrics &FontFace::populateMetrics(char letter) { + auto FontFace::populateMetrics(char letter) -> GlyphMetrics & { if (FT_Load_Char(m_face, letter, FT_LOAD_RENDER)) { // something bad happened return m_metrics['?']; diff --git a/fggl/gui/widget.cpp b/fggl/gui/widget.cpp index 08b92d4b011370be7655b48d6231067c68b4ac15..94809b446f86ea2da9554c8d6da22cd656fab439 100644 --- a/fggl/gui/widget.cpp +++ b/fggl/gui/widget.cpp @@ -22,7 +22,7 @@ namespace fggl::gui { void button_border(gfx::Path2D &path, glm::vec2 pos, glm::vec2 size) { // outer box - path.colour({1.0f, 0.0f, 0.0f}); + path.colour({1.0F, 0.0F, 0.0F}); path.pathTo({pos.x + size.x, pos.y}); path.pathTo({pos.x + size.x, pos.y + size.y}); path.pathTo({pos.x, pos.y + size.y}); @@ -32,7 +32,7 @@ namespace fggl::gui { math::vec2 innerTop{pos.x + 5, pos.y + 5}; math::vec2 innerBottom{pos.x + size.x - 5, pos.y + size.y - 5}; - path.colour({1.0f, 1.0f, 0.0f}); + path.colour({1.0F, 1.0F, 0.0F}); path.moveTo({innerTop.x, innerTop.y}); path.pathTo({innerBottom.x, innerTop.y}); path.pathTo({innerBottom.x, innerBottom.y}); @@ -52,7 +52,7 @@ namespace fggl::gui { const auto bottomRight{topLeft + size}; // background - path.colour({0.5f, 0.5f, 0.5f}); + path.colour({0.5F, 0.5F, 0.5F}); draw_box(path, topLeft, bottomRight); // fill @@ -65,13 +65,13 @@ namespace fggl::gui { innerBottom.x = innerTop.x + barWidth; // draw the bar - path.colour({0.8f, 0.0f, 0.0f}); + path.colour({0.8F, 0.0F, 0.0F}); draw_box(path, innerTop, innerBottom); // part of the bar that's not filled in math::vec2 emptyTop{innerBottom.x, innerTop.y}; math::vec2 emptyBottom{trueBottom, innerBottom.y}; - path.colour({0.4f, 0.0f, 0.0f}); + path.colour({0.4F, 0.0F, 0.0F}); draw_box(path, emptyTop, emptyBottom); } @@ -90,7 +90,7 @@ namespace fggl::gui { math::vec2 selectorTop{innerTop.x + selectorValue - (selectorWidth / 2), topLeft.y}; math::vec2 selectorBottom{selectorTop.x + selectorWidth, bottomRight.y}; - path.colour({1.0f, 1.0f, 1.0f}); + path.colour({1.0F, 1.0F, 1.0F}); draw_box(path, selectorTop, selectorBottom); } @@ -101,18 +101,18 @@ namespace fggl::gui { math::vec2 innerTop{pos.x + 5, pos.y + 5}; math::vec2 innerBottom{pos.x + size.x - 5, pos.y + size.y - 5}; - math::vec3 baseColour{0.5f, 0.5f, 0.5f}; + math::vec3 baseColour{0.5F, 0.5F, 0.5F}; if (active) { - baseColour *= 1.2f; + baseColour *= 1.2F; } if (pressed) { - baseColour *= 0.8f; + baseColour *= 0.8F; } - math::vec3 lightColour{baseColour * 1.2f}; - math::vec3 darkColour{baseColour * 0.8f}; + math::vec3 lightColour{baseColour * 1.2F}; + math::vec3 darkColour{baseColour * 0.8F}; if (pressed) { // flip light and dark for selected buttons auto tmp = darkColour; diff --git a/fggl/gui/widgets.cpp b/fggl/gui/widgets.cpp index 967e85730f64ae8d9385b23c40b2f68a511f539f..829288ead7c0e81725c02929f2628c109a26454b 100644 --- a/fggl/gui/widgets.cpp +++ b/fggl/gui/widgets.cpp @@ -55,7 +55,7 @@ namespace fggl::gui { m_label.size(topLeft(), size()); } - std::string Button::label() const { + auto Button::label() const -> std::string { return m_label.text(); } diff --git a/fggl/input/camera_input.cpp b/fggl/input/camera_input.cpp index 831349235abdea2c5ae9d5267a3c4c1661a1975b..17eb21270b202af76a0f910076f53a4202de9d08 100644 --- a/fggl/input/camera_input.cpp +++ b/fggl/input/camera_input.cpp @@ -27,10 +27,10 @@ namespace fggl::input { // see https://asliceofrendering.com/camera/2019/11/30/ArcballCamera/ auto &camTransform = ecs.get<fggl::math::Transform>(cam); auto &camComp = ecs.get<fggl::gfx::Camera>(cam); - auto &mouse = input.mouse; + const auto &mouse = input.mouse; - glm::vec4 position(camTransform.origin(), 1.0f); - glm::vec4 pivot(camComp.target, 1.0f); + glm::vec4 position(camTransform.origin(), 1.0F); + glm::vec4 pivot(camComp.target, 1.0F); glm::mat4 view = glm::lookAt(camTransform.origin(), camComp.target, camTransform.up()); glm::vec3 viewDir = -glm::transpose(view)[2]; glm::vec3 rightDir = glm::transpose(view)[0]; @@ -41,12 +41,12 @@ namespace fggl::input { float yAngle = (-mouse.axisDelta(fggl::input::MouseAxis::Y)) * deltaAngleY; // rotate the camera around the pivot on the first axis - glm::mat4x4 rotationMatrixX(1.0f); + glm::mat4x4 rotationMatrixX(1.0F); rotationMatrixX = glm::rotate(rotationMatrixX, xAngle, fggl::math::UP); position = (rotationMatrixX * (position - pivot)) + pivot; // rotate the camera around the pivot on the second axis - glm::mat4x4 rotationMatrixY(1.0f); + glm::mat4x4 rotationMatrixY(1.0F); rotationMatrixY = glm::rotate(rotationMatrixY, yAngle, rightDir); glm::vec3 finalPos = (rotationMatrixY * (position - pivot)) + pivot; @@ -66,17 +66,17 @@ namespace fggl::input { glm::vec3 motion(0.0F); float delta = input.mouse.axis(fggl::input::MouseAxis::SCROLL_Y); - if ((glm::length(dir) < maxZoom && delta < 0.0f) || (glm::length(dir) > minZoom && delta > 0.0f)) { + if ((glm::length(dir) < maxZoom && delta < 0.0F) || (glm::length(dir) > minZoom && delta > 0.0F)) { motion -= (forward * delta); camTransform.origin(camTransform.origin() + motion); } } void process_freecam(entity::EntityManager &ecs, const Input &input, entity::EntityID cam) { - float rotationValue = 0.0f; - glm::vec3 translation(0.0f); + float rotationValue = 0.0F; + glm::vec3 translation(0.0F); - auto &keyboard = input.keyboard; + const auto &keyboard = input.keyboard; auto &settings = ecs.get<FreeCamKeys>(cam); // calculate rotation (user input) @@ -107,24 +107,24 @@ namespace fggl::input { auto camTransform = ecs.get<fggl::math::Transform>(cam); auto camComp = ecs.get<fggl::gfx::Camera>(cam); - glm::vec4 position(camTransform.origin(), 1.0f); - glm::vec4 pivot(camComp.target, 1.0f); + glm::vec4 position(camTransform.origin(), 1.0F); + glm::vec4 pivot(camComp.target, 1.0F); // apply movement - if (translation != glm::vec3(0.0f)) { + if (translation != glm::vec3(0.0F)) { const auto rotation = (position - pivot); const float angle = atan2f(rotation.x, rotation.z); const auto rotationMat = glm::rotate(MAT_IDENTITY, angle, fggl::math::UP); - auto deltaMove = (rotationMat * glm::vec4(translation, 1.0f)) * PAN_SPEED; - deltaMove.w = 0.0f; + auto deltaMove = (rotationMat * glm::vec4(translation, 1.0F)) * PAN_SPEED; + deltaMove.w = 0.0F; position += deltaMove; pivot += deltaMove; } // apply rotation - if (rotationValue != 0.0f) { + if (rotationValue != 0.0F) { glm::mat4 rotation = glm::rotate(MAT_IDENTITY, rotationValue, fggl::math::UP); position = (rotation * (position - pivot)) + pivot; } @@ -134,24 +134,24 @@ namespace fggl::input { } void process_edgescroll(entity::EntityManager &ecs, const Input &input, entity::EntityID cam) { - glm::vec3 translation(0.0f); + glm::vec3 translation(0.0F); - auto &mouse = input.mouse; + const auto &mouse = input.mouse; // calculate movement (user input) - if (mouse.axis(MouseAxis::Y) < 0.9f) { + if (mouse.axis(MouseAxis::Y) < 0.9F) { translation -= fggl::math::RIGHT; } - if (mouse.axis(MouseAxis::Y) > -0.9f) { + if (mouse.axis(MouseAxis::Y) > -0.9F) { translation += fggl::math::RIGHT; } - if (mouse.axis(MouseAxis::X) > -0.9f) { + if (mouse.axis(MouseAxis::X) > -0.9F) { translation += fggl::math::FORWARD; } - if (mouse.axis(MouseAxis::X) < 0.9f) { + if (mouse.axis(MouseAxis::X) < 0.9F) { translation -= fggl::math::FORWARD; } @@ -159,17 +159,17 @@ namespace fggl::input { auto &camTransform = ecs.get<fggl::math::Transform>(cam); auto &camComp = ecs.get<fggl::gfx::Camera>(cam); - glm::vec4 position(camTransform.origin(), 1.0f); - glm::vec4 pivot(camComp.target, 1.0f); + glm::vec4 position(camTransform.origin(), 1.0F); + glm::vec4 pivot(camComp.target, 1.0F); // apply movement - if (translation != glm::vec3(0.0f)) { + if (translation != glm::vec3(0.0F)) { const auto rotation = (position - pivot); const float angle = atan2f(rotation.x, rotation.z); const auto rotationMat = glm::rotate(MAT_IDENTITY, angle, fggl::math::UP); - auto deltaMove = (rotationMat * glm::vec4(translation, 1.0f)) * PAN_SPEED; - deltaMove.w = 0.0f; + auto deltaMove = (rotationMat * glm::vec4(translation, 1.0F)) * PAN_SPEED; + deltaMove.w = 0.0F; position += deltaMove; pivot += deltaMove; diff --git a/fggl/math/shapes.cpp b/fggl/math/shapes.cpp index 4d093db030519c4ddb5fbf985969b099ca0a66ea..333cabaae7e2354df876b9180251d8d7b6abe9f5 100644 --- a/fggl/math/shapes.cpp +++ b/fggl/math/shapes.cpp @@ -27,7 +27,7 @@ namespace fggl::math::phs3d { max = maxElm(max, point); } - AABB AABB::fromPoints(const std::vector<math::vec3> &points) { + auto AABB::fromPoints(const std::vector<math::vec3> &points) -> AABB { AABB box; for (const auto &point : points) { box.add(point); @@ -42,7 +42,7 @@ namespace fggl::math::phs3d { // this feels like something that should be vectorizable... for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - if (m[i][j] > 0.0f) { + if (m[i][j] > 0.0F) { min[j] += m[i][j] * other.min[j]; max[j] += m[i][j] * other.max[j]; } else { @@ -53,7 +53,7 @@ namespace fggl::math::phs3d { } } - Plane Plane::fromPoints(const math::vec3 p1, const math::vec3 p2, const math::vec3 p3) { + auto Plane::fromPoints(const math::vec3 p1, const math::vec3 p2, const math::vec3 p3) -> Plane { const auto e3 = p2 - p1; const auto e1 = p3 - p2; auto normal = glm::normalize(glm::cross(e3, e1)); @@ -61,7 +61,7 @@ namespace fggl::math::phs3d { return {normal, d}; } - static math::vec3 bestFitNormal(const std::vector<math::vec3> &points) { + static auto bestFitNormal(const std::vector<math::vec3> &points) -> math::vec3 { assert(!points.empty()); math::vec3 result; @@ -80,9 +80,9 @@ namespace fggl::math::phs3d { return glm::normalize(result); }; - static float bestFitD(const std::vector<math::vec3> &points, glm::vec3 normal) { + static auto bestFitD(const std::vector<math::vec3> &points, glm::vec3 normal) -> float { math::vec3 sum; - for (auto &point : points) { + for (const auto &point : points) { sum += point; } sum *= 1.0F / points.size(); @@ -98,7 +98,7 @@ namespace fggl::math::phs3d { const char b; }; - static bary_axis baryCalcAxis(const math::vec3 &normal) { + static auto baryCalcAxis(const math::vec3 &normal) -> bary_axis { if ((fabs(normal.x) >= fabs(normal.y)) && (fabs(normal.x) >= fabs(normal.z))) { // discard x return {Y, Z}; @@ -111,7 +111,7 @@ namespace fggl::math::phs3d { } } - bool Triangle::CartToBarycentric(const math::vec3 &cart, Barycentric &outVal) { + auto Triangle::CartToBarycentric(const math::vec3 &cart, Barycentric &outVal) -> bool { // everything is const because I'm paying the compiler is smarter than me... const auto d1 = v[1] - v[0]; @@ -134,19 +134,19 @@ namespace fggl::math::phs3d { const float v4 = cart[ax.b] - v[2][ax.b]; const float denom = v1 * u2 - v2 * u1; - if (denom == 0.0f) { + if (denom == 0.0F) { return false; } // finally, we can work it out - const float oneOverDenom = 1.0f / denom; + const float oneOverDenom = 1.0F / denom; outVal.b[0] = (v4 * u2 - v2 * u4) * oneOverDenom; outVal.b[1] = (v1 * u3 - v3 * u1) * oneOverDenom; - outVal.b[2] = 1.0f - outVal.b[0] - outVal.b[1]; + outVal.b[2] = 1.0F - outVal.b[0] - outVal.b[1]; return true; } - bool Triangle::CartToBarycentric2(const math::vec3 &cart, Barycentric &outVal) { + auto Triangle::CartToBarycentric2(const math::vec3 &cart, Barycentric &outVal) -> bool { const auto e1 = v[2] - v[1]; const auto e2 = v[0] - v[2]; const auto e3 = v[1] - v[0]; @@ -157,7 +157,7 @@ namespace fggl::math::phs3d { const auto normal = glm::normalize(glm::cross(e1, e2)); const auto denom = glm::dot(glm::cross(e1, e2), normal); - assert(denom != 0.0f); + assert(denom != 0.0F); outVal.b[0] = glm::dot(glm::cross(e1, d3), normal) / denom; outVal.b[1] = glm::dot(glm::cross(e2, d1), normal) / denom; diff --git a/fggl/math/triangulation.cpp b/fggl/math/triangulation.cpp index b72b2a526f553ae0e2c90de61293c681135b5eb8..9a9aefa15ebc804f7958346384da71c96b722e1a 100644 --- a/fggl/math/triangulation.cpp +++ b/fggl/math/triangulation.cpp @@ -28,7 +28,7 @@ namespace fggl::math { // deal with the indices const auto nTris = polygon.size() - 2; - for (auto i = 0u; i < nTris; i++) { + for (auto i = 0U; i < nTris; i++) { mesh.add_index(firstIdx); mesh.add_index(prevIdx); diff --git a/fggl/phys/null.cpp b/fggl/phys/null.cpp index dc46b38a10d7aa301c349d157ee6b9fe1c2de6f0..e993987c88c341adf901a320505b959dbb815646 100644 --- a/fggl/phys/null.cpp +++ b/fggl/phys/null.cpp @@ -20,7 +20,7 @@ namespace fggl::phys { - bool NullPhysics::factory(modules::ModuleService serviceName, modules::Services &serviceManager) { + auto NullPhysics::factory(modules::ModuleService serviceName, modules::Services &serviceManager) -> bool { if (serviceName == phys::PhysicsProvider::service) { serviceManager.bind<phys::PhysicsProvider, NullPhysicsProvider>(); return true; diff --git a/fggl/platform/linux/paths.cpp b/fggl/platform/linux/paths.cpp index df687821ea21118dddc4bcca48fba6cc7257318b..39a2e1e261a951e6f984eaed7bf8c2dcb76c2d31 100644 --- a/fggl/platform/linux/paths.cpp +++ b/fggl/platform/linux/paths.cpp @@ -25,7 +25,7 @@ namespace fggl::platform { - inline static std::filesystem::path get_user_path(const char *env, const char *fallback) { + inline static auto get_user_path(const char *env, const char *fallback) -> std::filesystem::path { const char *path = std::getenv(env); if (path != nullptr) { return {path}; @@ -33,7 +33,7 @@ namespace fggl::platform { return {fallback}; } - static std::vector<std::filesystem::path> get_path_list(const char *env, const char *folderName) { + static auto get_path_list(const char *env, const char *folderName) -> std::vector<std::filesystem::path> { const char *pathList = std::getenv(env); std::vector<std::filesystem::path> paths; if (pathList) { @@ -52,7 +52,7 @@ namespace fggl::platform { return paths; } - EnginePaths calc_engine_paths(const char *base) { + auto calc_engine_paths(const char *base) -> EnginePaths { auto dataDirs = get_path_list(ENV_DATA_DIRS, base); if (dataDirs.empty()) { for (const auto &defaultDir : DEFAULT_DATA_DIRS) { @@ -76,7 +76,7 @@ namespace fggl::platform { }; } - std::filesystem::path locate_data(const EnginePaths &paths, const std::filesystem::path &relPath) { + auto locate_data(const EnginePaths &paths, const std::filesystem::path &relPath) -> std::filesystem::path { auto userPath = paths.userData / relPath; if (std::filesystem::exists(userPath)) { return userPath; @@ -102,7 +102,7 @@ namespace fggl::platform { return userPath; } - std::filesystem::path locate_config(const EnginePaths &paths, const std::filesystem::path &relPath) { + auto locate_config(const EnginePaths &paths, const std::filesystem::path &relPath) -> std::filesystem::path { auto userPath = paths.userConfig / relPath; if (std::filesystem::exists(userPath)) { return userPath; @@ -120,7 +120,7 @@ namespace fggl::platform { return userPath; } - std::filesystem::path locate_cache(const EnginePaths &paths, const std::filesystem::path &relPath) { + auto locate_cache(const EnginePaths &paths, const std::filesystem::path &relPath) -> std::filesystem::path { auto userPath = paths.userCache / relPath; if (std::filesystem::exists(userPath)) { return userPath; diff --git a/fggl/util/guid.cpp b/fggl/util/guid.cpp index 5823c9a3cf1ce7509ec2a87bedad13c3894e4d4e..bf63bface196e83e58c688897d190f9899ae8dc8 100644 --- a/fggl/util/guid.cpp +++ b/fggl/util/guid.cpp @@ -27,7 +27,7 @@ namespace fggl::util { std::map<GUID, std::string> guidTable; } - GUID intern_string(const char *str) { + auto intern_string(const char *str) -> GUID { assert(str != nullptr); GUID guid = make_guid(str); @@ -40,7 +40,7 @@ namespace fggl::util { return guid; } - std::string guid_to_string(GUID guid) { + auto guid_to_string(GUID guid) -> std::string { auto tableValue = guidTable.find(guid); if (tableValue != guidTable.end()) { return tableValue->second; @@ -51,12 +51,12 @@ namespace fggl::util { } -fggl::util::GUID operator "" _fid(const char *str) { +auto operator "" _fid(const char *str) -> fggl::util::GUID { fggl::util::intern_string(str); return fggl::util::make_guid(str); } -fggl::util::GUID operator "" _fid(const char *str, std::size_t) { +auto operator "" _fid(const char *str, std::size_t) -> fggl::util::GUID { fggl::util::intern_string(str); return fggl::util::make_guid(str); } diff --git a/include/fggl/app.hpp b/include/fggl/app.hpp index f0a4be539e1314fe52d05c02b6a996fea1268271..3da371bb920209299915f7733370532c4eae4268 100644 --- a/include/fggl/app.hpp +++ b/include/fggl/app.hpp @@ -15,7 +15,7 @@ #ifndef FGGL_INCLUDE_FGGL_APP_HPP #define FGGL_INCLUDE_FGGL_APP_HPP -#define assertm(exp, msg) assert(((void)msg, exp)) +#define assertm(exp, msg) assert(((void)(msg), exp)) #include <cassert> #include <string> @@ -76,7 +76,7 @@ namespace fggl { virtual void deactivate() {} - inline App& owner() const { + [[nodiscard]] inline auto owner() const -> App& { return m_owner; } @@ -93,8 +93,8 @@ namespace fggl { App(const App &app) = delete; App(const App &&app) = delete; - App &operator=(const App &other) = delete; - App &operator=(App &&other) = delete; + auto operator=(const App &other) -> App & = delete; + auto operator=(App &&other) -> App & = delete; inline void setWindow(display::Window *window) { m_window = window; @@ -103,10 +103,10 @@ namespace fggl { /** * Perform main game loop functions. */ - int run(int argc, const char **argv); + auto run(int argc, const char **argv) -> int; template<typename T> - T *addState(const Identifer &name) { + auto addState(const Identifer &name) -> T * { static_assert(std::is_base_of<AppState, T>::value, "States must be AppStates"); return m_states.put<T>(name, *this); } @@ -118,12 +118,12 @@ namespace fggl { m_states.active().activate();*/ } - inline AppState &active_state() const { + inline auto active_state() const -> AppState & { return m_states.active(); } template<typename T> - inline T *service() { + inline auto service() -> T * { try { return m_subsystems->template get<T>(); } catch (std::out_of_range &e) { @@ -132,11 +132,11 @@ namespace fggl { } } - inline modules::Services& services() { + inline auto services() -> modules::Services& { return m_subsystems->services(); } - inline bool running() const { + inline auto running() const -> bool { return m_running; } diff --git a/include/fggl/audio/openal/audio.hpp b/include/fggl/audio/openal/audio.hpp index ee74dccdaf2199f20e06fcf8a5b798e5aa6da707..b82e26eb447ee73294c967799721585de6ffdaa2 100644 --- a/include/fggl/audio/openal/audio.hpp +++ b/include/fggl/audio/openal/audio.hpp @@ -39,7 +39,7 @@ namespace fggl::audio::openal { assets::AssetRefRaw load_vorbis(assets::Loader* loader, const assets::AssetID &, const assets::LoaderContext &, void* userPtr); bool load_vorbis_short(std::filesystem::path path, assets::MemoryBlock& block); - assets::AssetTypeID check_vorbis( std::filesystem::path path ); + assets::AssetTypeID check_vorbis( const std::filesystem::path& path ); enum class AudioType { MONO_8 = AL_FORMAT_MONO8,