Skip to content
Snippets Groups Projects
Commit 581d138d authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

fix linting errors

parent b349a9aa
No related branches found
No related tags found
No related merge requests found
Showing
with 87 additions and 80 deletions
......@@ -97,8 +97,8 @@ namespace demo {
auto& manager = area->entities();
{
player = manager.create();
auto& cellPos = manager.add<CellPos>(player);
auto& robotState = manager.add<RobotState>(player);
manager.add<CellPos>(player);
manager.add<RobotState>(player);
}
return player;
......@@ -126,7 +126,7 @@ namespace demo {
fggl::math::vec2i size{32, 32};
auto btn = std::make_unique<fggl::gui::Button>(pos, size);
btn->label(action.name);
btn->addCallback([=](){
btn->addCallback([=, this](){
this->m_program.m_instructions.push_back({action.name, action.callback});
});
btnGrid->add(std::move(btn));
......
......@@ -46,7 +46,7 @@ namespace demo {
mesh.pipeline = "redbook/debug";
}
auto& material = manager.add<fggl::gfx::PhongMaterial>(model);
manager.add<fggl::gfx::PhongMaterial>(model);
return model;
}
......@@ -93,7 +93,7 @@ namespace demo {
static void setup_lighting(fggl::entity::EntityManager& ecs) {
auto light = ecs.create();
auto& transform = ecs.add<fggl::math::Transform>(light);
ecs.add<fggl::math::Transform>(light);
auto& lightComp = ecs.add<fggl::gfx::DirectionalLight>(light);
lightComp.position = fggl::math::vec3( 10.0F, 5.0F, 0.0F );
......@@ -149,7 +149,7 @@ namespace demo {
}
}
void Viewer::cycleAsset(uint64_t idx) {
void Viewer::cycleAsset(uint64_t /*idx*/) {
auto *loader = owner().service<fggl::assets::Loader>();
auto *manager = owner().service<fggl::assets::AssetManager>();
......
......@@ -48,7 +48,7 @@ static void setup_camera(fggl::entity::EntityManager& world) {
world.add<fggl::gfx::Camera>(prototype);
}
static fggl::entity::EntityID setup_environment(fggl::entity::EntityManager& world, fggl::entity::EntityFactory* factory, const fggl::math::vec2& size, demo::RollState& state) {
static fggl::entity::EntityID setup_environment(fggl::entity::EntityManager& world, fggl::entity::EntityFactory* /*factory*/, const fggl::math::vec2& /*size*/, demo::RollState& state) {
// ensure the state is clean
state.closestPickup = fggl::entity::INVALID;
state.mode = demo::DebugMode::NORMAL;
......
......@@ -54,7 +54,7 @@ namespace demo {
static void setup_lighting(fggl::entity::EntityManager& ecs) {
auto light = ecs.create();
auto& transform = ecs.add<fggl::math::Transform>(light);
ecs.add<fggl::math::Transform>(light);
auto& lightComp = ecs.add<fggl::gfx::DirectionalLight>(light);
lightComp.position = fggl::math::vec3( 10.0F, 5.0F, 0.0F );
......
......@@ -51,7 +51,7 @@ namespace fggl::audio::openal {
return nullptr;
}
auto load_vorbis_short(std::filesystem::path path, assets::MemoryBlock& block) -> bool {
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);
......
......@@ -17,7 +17,6 @@
//
#include "fggl/data/assimp/module.hpp"
#include "fggl/data/model.hpp"
#include "fggl/debug/logging.hpp"
#include "fggl/assets/manager.hpp"
#include "fggl/mesh/mesh.hpp"
......@@ -212,7 +211,7 @@ namespace fggl::data::models {
return nullptr;
}
auto load_assimp_texture(assets::Loader* loader, const assets::AssetID& guid, const assets::LoaderContext& data, void* userPtr) -> assets::AssetRefRaw {
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) ) {
......
......@@ -21,9 +21,9 @@
struct GLFWwindow;
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 auto ImGui_ImplGlfw_InitForOpenGL(GLFWwindow *window, bool installCallbacks) -> bool;
IMGUI_IMPL_API auto ImGui_ImplGlfw_InitForVulkan(GLFWwindow *window, bool installCallbacks) -> bool;
IMGUI_IMPL_API auto ImGui_ImplGlfw_InitForOther(GLFWwindow *window, bool installCallbacks) -> bool;
IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown();
IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame();
......
......@@ -25,7 +25,7 @@
#include "imgui.h" // IMGUI_IMPL_API
// Backend API
IMGUI_IMPL_API auto ImGui_ImplOpenGL3_Init(const char *glsl_version = NULL) -> bool;
IMGUI_IMPL_API auto ImGui_ImplOpenGL3_Init(const char *glsl_version = nullptr) -> 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);
......
......@@ -22,7 +22,7 @@
namespace fggl::entity {
auto load_scene(assets::Loader* loader, const assets::AssetID& asset, const assets::LoaderContext& data, void* ptr) -> assets::AssetRefRaw {
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;
......@@ -77,7 +77,7 @@ namespace fggl::entity {
return nullptr;
}
auto load_prototype(assets::Loader* loader, const assets::AssetID &guid, const assets::LoaderContext& data, EntityFactory* factory) -> assets::AssetRefRaw {
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.
......
......@@ -45,7 +45,7 @@ namespace fggl::entity {
return assets::INVALID_ASSET_TYPE;
}
auto get_scene_deps(const std::string& packName, std::filesystem::path packRoot, assets::ResourceRecord& rr) -> bool {
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 ) {
......
......@@ -27,7 +27,6 @@
#include <glm/ext/matrix_clip_space.hpp>
#include <glm/ext/matrix_transform.hpp>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <memory>
......@@ -141,7 +140,7 @@ namespace fggl::gfx {
cache->load(ShaderConfig::named("debug"));
}
static void splat_checkerboard(GLuint* memory, int width = 128, int height = 128) {
static void splat_checkerboard(GLuint* memory, unsigned int width = 128, unsigned int height = 128) {
int counter = 0;
auto colour = ogl4::TEX_CHECKER;
......
......@@ -159,7 +159,7 @@ namespace fggl::gfx::ogl4 {
return;
}
// setup the shader
// set up the shader
shader.use();
auto projMat = glm::ortho(0.0F, 1920.0F, 1080.0F, 0.F);
shader.setUniformMtx(shader.uniform("projection"), projMat);
......@@ -167,7 +167,7 @@ namespace fggl::gfx::ogl4 {
// bind the vbo we'll use for writing
m_vao.bind();
// setup the openGL state we expect for rendering
// set up the openGL state we expect for rendering
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
......@@ -179,7 +179,7 @@ namespace fggl::gfx::ogl4 {
const auto label = textCmd.text;
math::vec2 penPos(textCmd.pos);
// setup a non-owning holder for the characters
// set up a non-owning holder for the characters
data::Texture2D tex;
tex.channels = 1;
......
......@@ -31,29 +31,32 @@ namespace fggl::gfx {
constexpr const char *SHAPE_SPHERE{"sphere"};
constexpr const char *SHAPE_BOX{"box"};
static void process_shape(const YAML::Node &node, mesh::Mesh3D &mesh) {
auto transform = data::OFFSET_NONE;
auto offset = node["offset"].as<math::vec3>(math::VEC3_ZERO);
transform = glm::translate(transform, offset);
auto scale = node["scale"].as<math::vec3>(math::VEC3_ONES);
transform = glm::scale(transform, scale);
debug::debug("scale: {}, {}, {}", scale.x, scale.y, scale.z);
// now the shape itself
auto type = node["type"].as<std::string>();
if (type == SHAPE_BOX) {
data::make_cube(mesh, transform);
} else if (type == SHAPE_SPHERE) {
auto stacks = node["stacks"].as<uint32_t>(DEFAULT_STACKS);
auto slices = node["slices"].as<uint32_t>(DEFAULT_SLICES);
data::make_sphere(mesh, transform, stacks, slices);
} else {
debug::log(debug::Level::warning, "unknown shape type requested: {}", type);
namespace {
void process_shape(const YAML::Node &node, mesh::Mesh3D &mesh) {
auto transform = data::OFFSET_NONE;
auto offset = node["offset"].as<math::vec3>(math::VEC3_ZERO);
transform = glm::translate(transform, offset);
auto scale = node["scale"].as<math::vec3>(math::VEC3_ONES);
transform = glm::scale(transform, scale);
debug::debug("scale: {}, {}, {}", scale.x, scale.y, scale.z);
// now the shape itself
auto type = node["type"].as<std::string>();
if (type == SHAPE_BOX) {
data::make_cube(mesh, transform);
} else if (type == SHAPE_SPHERE) {
auto stacks = node["stacks"].as<uint32_t>(DEFAULT_STACKS);
auto slices = node["slices"].as<uint32_t>(DEFAULT_SLICES);
data::make_sphere(mesh, transform, stacks, slices);
} else {
debug::log(debug::Level::warning, "unknown shape type requested: {}", type);
}
}
}
void attach_mesh(const entity::ComponentSpec &spec, entity::EntityManager &manager, const entity::EntityID &id, modules::Services &services) {
// check for the asset service
......@@ -144,7 +147,7 @@ namespace fggl::gfx {
void attach_material(const entity::ComponentSpec &spec,
entity::EntityManager &manager,
const entity::EntityID &id,
modules::Services& services ) {
modules::Services& /*services*/ ) {
auto &mat = manager.add<gfx::PhongMaterial>(id);
mat.ambient = spec.get<math::vec3>("ambient", gfx::DEFAULT_AMBIENT);
mat.diffuse = spec.get<math::vec3>("diffuse", gfx::DEFAULT_DIFFUSE);
......@@ -152,7 +155,7 @@ namespace fggl::gfx {
mat.shininess = spec.get<float>("ambient", gfx::DEFAULT_SHININESS);
}
void attach_light_directional(const entity::ComponentSpec &spec, entity::EntityManager &manager, const entity::EntityID &id, modules::Services& services) {
void attach_light_directional(const entity::ComponentSpec &spec, entity::EntityManager &manager, const entity::EntityID &id, modules::Services& /*services*/) {
auto &light = manager.add<gfx::DirectionalLight>(id);
light.position = spec.get<math::vec3>("direction", -math::UP);
light.ambient = spec.get<math::vec3>("ambient", gfx::colours::WHITE);
......@@ -160,7 +163,7 @@ namespace fggl::gfx {
light.diffuse = spec.get<math::vec3>("diffuse", gfx::colours::WHITE);
}
void attach_light_point(const entity::ComponentSpec &spec, entity::EntityManager &manager, const entity::EntityID &id, modules::Services& services) {
void attach_light_point(const entity::ComponentSpec &spec, entity::EntityManager &manager, const entity::EntityID &id, modules::Services& /*services*/) {
auto &light = manager.add<gfx::PointLight>(id);
light.position = spec.get<math::vec3>("position", math::VEC3_ZERO);
......
......@@ -21,7 +21,7 @@
namespace fggl::grid {
std::vector<IntHex> lineTo(const IntHex& start, const IntHex& end) {
int distance = start.distance(end);
const int distance = start.distance(end);
std::vector<IntHex> line;
for (auto i=0; i < distance; ++i) {
line.push_back( round2(hexLerp(start, end, 1.0F/distance * i)) );
......
......@@ -20,6 +20,8 @@
namespace fggl::gui::renderer {
constexpr int PADDING = 15;
void draw_box(gfx::Path2D &path, glm::vec2 topLeft, glm::vec2 bottomRight) {
path.moveTo({topLeft.x, topLeft.y});
path.pathTo({bottomRight.x, topLeft.y});
......@@ -130,7 +132,7 @@ namespace fggl::gui::renderer {
if ( root.hasAttr("text") ) {
auto text = root.get<std::string>("text");
paint.text(text, {background.left, background.top + 15});
paint.text(text, {background.left, background.top + PADDING});
}
for (const auto& child : root) {
......
......@@ -25,31 +25,33 @@
namespace fggl::platform {
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};
namespace {
inline auto get_user_path(const char *env, const char *fallback) -> std::filesystem::path {
const char *path = std::getenv(env);
if (path != nullptr) {
return {path};
}
return {fallback};
}
return {fallback};
}
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) {
std::string pathListStr(pathList);
std::string::size_type pos = 0;
while (pos < pathListStr.size()) {
std::string::size_type nextPos = pathListStr.find(':', pos);
if (nextPos == std::string::npos) {
nextPos = pathListStr.size();
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) {
std::string pathListStr(pathList);
std::string::size_type pos = 0;
while (pos < pathListStr.size()) {
std::string::size_type nextPos = pathListStr.find(':', pos);
if (nextPos == std::string::npos) {
nextPos = pathListStr.size();
}
std::string path = pathListStr.substr(pos, nextPos - pos);
paths.push_back(std::filesystem::path(path) / folderName);
pos = nextPos + 1;
}
std::string path = pathListStr.substr(pos, nextPos - pos);
paths.push_back(std::filesystem::path(path) / folderName);
pos = nextPos + 1;
}
return paths;
}
return paths;
}
auto calc_engine_paths(const char *base) -> EnginePaths {
......@@ -98,7 +100,7 @@ namespace fggl::platform {
return debugPath;
}
// if the file existed, it shoudl exist in the user space
// if the file existed, it should exist in the user space
return userPath;
}
......
......@@ -28,7 +28,7 @@ namespace fggl::scenes {
m_input = app.service<input::Input>();
}
void GameBase::update(float dt) {
void GameBase::update(float /*dt*/) {
// detect the user quitting
if (m_input != nullptr) {
bool escapePressed = m_input->keyboard.pressed(glfwGetKeyScancode(GLFW_KEY_ESCAPE));
......@@ -59,7 +59,7 @@ namespace fggl::scenes {
m_world.reset();
}
void Game::update(float dt) {
void Game::update(float /*dt*/) {
assert(m_world && "called game update, but there was no world - was activate called?");
if (m_input != nullptr) {
......
......@@ -22,8 +22,10 @@ namespace fggl::scenes {
using fggl::input::MouseButton;
using fggl::input::MouseAxis;
BasicMenu::BasicMenu(fggl::App &app) : AppState(app), m_inputs(nullptr), m_active(), m_hover(nullptr) {
m_inputs = app.service<input::Input>();
constexpr float SCREEN_WIDTH = 1920.0F;
constexpr float SCREEN_HEIGHT = 1080.0F;
BasicMenu::BasicMenu(fggl::App &app) : AppState(app), m_inputs(app.service<input::Input>()), m_active(), m_cursorPos(), m_hover(nullptr) {
}
void BasicMenu::update(float /*dt*/) {
......@@ -33,8 +35,8 @@ namespace fggl::scenes {
// in canvas space
math::vec2 projected;
projected.x = math::rescale_ndc(m_cursorPos.x, 0, 1920.0F);
projected.y = math::rescale_ndc(m_cursorPos.y, 0, 1080.0F);
projected.x = math::rescale_ndc(m_cursorPos.x, 0, SCREEN_WIDTH);
projected.y = math::rescale_ndc(m_cursorPos.y, 0, SCREEN_HEIGHT);
m_canvas.onMouseOver(projected);
if (m_inputs->mouse.pressed(MouseButton::LEFT)) {
......@@ -71,7 +73,7 @@ namespace fggl::scenes {
// figure out the position based off the old logic
// FIXME should be the container's job
math::vec2 pos{1920.0F - (padX + btnSize.x), padY};
math::vec2 pos{SCREEN_WIDTH - (padX + btnSize.x), padY};
pos.y += ( (m_items.size()-1.0F) * (btnSize.y + spacing));
// build the button
......
......@@ -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 ASSERT_MSG(exp, msg) assert(((void)(msg), exp))
#include <cassert>
#include <string>
......@@ -86,8 +86,8 @@ namespace fggl {
class App {
public:
explicit App(modules::Manager *serivces, const Identifer &name);
App(modules::Manager *services, const Identifer &name, const Identifer &folderName);
explicit App(modules::Manager *manager, const Identifer &name);
App(modules::Manager *manager, const Identifer &name, const Identifer &folderName);
// class is non copy-able
App(const App &app) = delete;
......
......@@ -63,7 +63,7 @@ namespace fggl::util {
}
StateType &active() const {
assertm(m_states.find(m_active) != m_states.end(), "active state does not exist!");
ASSERT_MSG(m_states.find(m_active) != m_states.end(), "active state does not exist!");
return *(m_states.at(m_active).get());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment