diff --git a/inferno/src/inferno/application.cpp b/inferno/src/inferno/application.cpp index 73047b0..72b4418 100644 --- a/inferno/src/inferno/application.cpp +++ b/inferno/src/inferno/application.cpp @@ -132,14 +132,14 @@ namespace Inferno { dbg() << "Application shutdown"; } - void Application::onEvent(Event &e) + void Application::onEvent(Event& e) { EventDispatcher dispatcher(e); dispatcher.dispatch(NF_BIND_EVENT(Application::onWindowClose)); dispatcher.dispatch(NF_BIND_EVENT(Application::onWindowResize)); } - bool Application::onWindowClose(WindowCloseEvent &e) + bool Application::onWindowClose(WindowCloseEvent& e) { // Suppress unused warning (void)e; @@ -151,7 +151,7 @@ namespace Inferno { return true; } - bool Application::onWindowResize(WindowResizeEvent &e) + bool Application::onWindowResize(WindowResizeEvent& e) { // Suppress unused warning (void)e; diff --git a/inferno/src/inferno/event/event.h b/inferno/src/inferno/event/event.h index 599eaf1..da76162 100644 --- a/inferno/src/inferno/event/event.h +++ b/inferno/src/inferno/event/event.h @@ -67,19 +67,19 @@ namespace Inferno { class EventDispatcher { public: - EventDispatcher(Event &e) : m_event(e) {} + EventDispatcher(Event& e) : m_event(e) {} // Easily dispatch all type of Events, call with: // dispatch(std::bind(&F, this, std::placeholders::_1)); // T is the type of Event - // F is the function to call, signature: bool name(T &e); + // F is the function to call, signature: bool name(T& e); template - bool dispatch(const F &function) + bool dispatch(const F& function) { // If type is same as member variable type if (T::getTypeStatic() == m_event.getType()) { // Call the function - m_event.handled = function(static_cast(m_event)); + m_event.handled = function(static_cast(m_event)); return true; } @@ -87,7 +87,7 @@ namespace Inferno { } private: - Event &m_event; + Event& m_event; }; // Add class type functions macro @@ -101,7 +101,7 @@ namespace Inferno { virtual char getCategoryFlags() const override { return category; } // Make Events easily printable - inline std::ostream& operator<<(std::ostream &os, const Event &e) + inline std::ostream& operator<<(std::ostream& os, const Event& e) { return os << e.toString(); } diff --git a/inferno/src/inferno/file.h b/inferno/src/inferno/file.h index 2c683ae..7441547 100644 --- a/inferno/src/inferno/file.h +++ b/inferno/src/inferno/file.h @@ -13,10 +13,10 @@ namespace Inferno { class File { public: - static std::string read(const std::string &path); + static std::string read(const std::string& path); template - static void ioRead(T &t, const std::string &path) + static void ioRead(T& t, const std::string& path) { std::ifstream file(path); ASSERT(file.is_open(), "File could not open! {}", path.c_str()); @@ -28,7 +28,7 @@ namespace Inferno { } template - static void ioWrite(T &t, const std::string &path) + static void ioWrite(T& t, const std::string& path) { std::ofstream file (path); ASSERT(file.is_open(), "File could not open! {}", path.c_str()); diff --git a/inferno/src/inferno/input.cpp b/inferno/src/inferno/input.cpp index 23ff6ab..e333010 100644 --- a/inferno/src/inferno/input.cpp +++ b/inferno/src/inferno/input.cpp @@ -19,7 +19,7 @@ namespace Inferno { m_yOffset = 0.0f; } - bool Input::onMousePosition(MousePositionEvent &e) + bool Input::onMousePosition(MousePositionEvent& e) { // Prevent weird jump on first cursor window enter if(m_firstMousePos) { diff --git a/inferno/src/inferno/input.h b/inferno/src/inferno/input.h index 366f497..d08f0ef 100644 --- a/inferno/src/inferno/input.h +++ b/inferno/src/inferno/input.h @@ -11,7 +11,7 @@ namespace Inferno { public: static void update(); - static bool onMousePosition(MousePositionEvent &e); + static bool onMousePosition(MousePositionEvent& e); static bool isKeyPressed(int key); static bool isMouseButtonPressed(int button); diff --git a/inferno/src/inferno/render/buffer.cpp b/inferno/src/inferno/render/buffer.cpp index d119421..3e352af 100644 --- a/inferno/src/inferno/render/buffer.cpp +++ b/inferno/src/inferno/render/buffer.cpp @@ -95,7 +95,7 @@ namespace Inferno { // ----------------------------------------- - BufferLayout::BufferLayout(const std::initializer_list &elements) : + BufferLayout::BufferLayout(const std::initializer_list& elements) : m_elements(elements), m_stride(0) { this->calculateOffsetsAndStride(); @@ -104,7 +104,7 @@ namespace Inferno { void BufferLayout::calculateOffsetsAndStride() { m_stride = 0; - for (auto &element : m_elements) { + for (auto& element : m_elements) { element.setOffset(m_stride); m_stride += element.getSize(); } @@ -189,13 +189,13 @@ namespace Inferno { glBindVertexArray(0); } - void VertexArray::addVertexBuffer(const std::shared_ptr &vertexBuffer) + void VertexArray::addVertexBuffer(const std::shared_ptr& vertexBuffer) { this->bind(); vertexBuffer->bind(); uint32_t index = 0; - for (const auto &element : vertexBuffer->getLayout()) { + for (const auto& element : vertexBuffer->getLayout()) { glEnableVertexAttribArray(index); glVertexAttribPointer( index, @@ -213,7 +213,7 @@ namespace Inferno { vertexBuffer->unbind(); } - void VertexArray::setIndexBuffer(const std::shared_ptr &indexBuffer) + void VertexArray::setIndexBuffer(const std::shared_ptr& indexBuffer) { this->bind(); indexBuffer->bind(); diff --git a/inferno/src/inferno/render/buffer.h b/inferno/src/inferno/render/buffer.h index f4121a3..4fbc4c5 100644 --- a/inferno/src/inferno/render/buffer.h +++ b/inferno/src/inferno/render/buffer.h @@ -36,11 +36,11 @@ namespace Inferno { inline uint32_t getOffset() const { return m_offset; } inline bool getNormalized() const { return m_normalized; } - inline void setType(const BufferElementType &type) { m_type = type; } - inline void setName(const std::string &name) { m_name = name; } - inline void setSize(const uint32_t &size) { m_size = size; } - inline void setOffset(const uint32_t &offset) { m_offset = offset; } - inline void setNormalized(const bool &normalized) { m_normalized = normalized; } + inline void setType(const BufferElementType& type) { m_type = type; } + inline void setName(const std::string& name) { m_name = name; } + inline void setSize(const uint32_t& size) { m_size = size; } + inline void setOffset(const uint32_t& offset) { m_offset = offset; } + inline void setNormalized(const bool& normalized) { m_normalized = normalized; } private: BufferElementType m_type; @@ -56,9 +56,9 @@ namespace Inferno { class BufferLayout { public: BufferLayout() {} - BufferLayout(const std::initializer_list &elements); + BufferLayout(const std::initializer_list& elements); - inline const std::vector &getElements() const { return m_elements; } + inline const std::vector& getElements() const { return m_elements; } inline uint32_t getStride() const { return m_stride; } // Iterators @@ -86,9 +86,9 @@ namespace Inferno { void bind() const; void unbind() const; - inline BufferLayout const &getLayout() const { return m_layout; } + inline const BufferLayout& getLayout() const { return m_layout; } - inline void setLayout(const BufferLayout &layout) { m_layout = layout; } + inline void setLayout(const BufferLayout& layout) { m_layout = layout; } private: uint32_t m_id; @@ -124,11 +124,11 @@ namespace Inferno { void bind() const; void unbind() const; - void addVertexBuffer(const std::shared_ptr &vertexBuffer); - void setIndexBuffer(const std::shared_ptr &indexBuffer); + void addVertexBuffer(const std::shared_ptr& vertexBuffer); + void setIndexBuffer(const std::shared_ptr& indexBuffer); - const std::vector> &getVertexBuffers() const { return m_vertexBuffers; } - const std::shared_ptr &getIndexBuffer() const { return m_indexBuffer; } + const std::vector>& getVertexBuffers() const { return m_vertexBuffers; } + const std::shared_ptr& getIndexBuffer() const { return m_indexBuffer; } private: uint32_t m_id; diff --git a/inferno/src/inferno/render/context.cpp b/inferno/src/inferno/render/context.cpp index 620df49..23b44f5 100644 --- a/inferno/src/inferno/render/context.cpp +++ b/inferno/src/inferno/render/context.cpp @@ -38,7 +38,7 @@ namespace Inferno { "Inferno requires at least OpenGL version 4.5!"); #endif - Window &w = *(Window*)glfwGetWindowUserPointer(m_window); + Window& w = *(Window*)glfwGetWindowUserPointer(m_window); // Disable vsync if (!w.isVSync()) { diff --git a/inferno/src/inferno/render/shader.cpp b/inferno/src/inferno/render/shader.cpp index 6473058..0821a38 100644 --- a/inferno/src/inferno/render/shader.cpp +++ b/inferno/src/inferno/render/shader.cpp @@ -46,49 +46,49 @@ namespace Inferno { return location; } - void Shader::setInt(const std::string &name, int value) + void Shader::setInt(const std::string& name, int value) { // Set unifrom int glUniform1i(findUniform(name), value); } - void Shader::setFloat(const std::string &name, float value) const + void Shader::setFloat(const std::string& name, float value) const { // Set uniform float glUniform1f(findUniform(name), value); } - void Shader::setFloat(const std::string &name, float v1, float v2, float v3, float v4) const + void Shader::setFloat(const std::string& name, float v1, float v2, float v3, float v4) const { // Set uniform vec4 data glUniform4f(findUniform(name), v1, v2, v3, v4); } - void Shader::setFloat(const std::string &name, glm::vec2 value) const + void Shader::setFloat(const std::string& name, glm::vec2 value) const { // Set uniform vec2 data glUniform2f(findUniform(name), value.x, value.y); } - void Shader::setFloat(const std::string &name, glm::vec3 value) const + void Shader::setFloat(const std::string& name, glm::vec3 value) const { // Set uniform vec3 data glUniform3f(findUniform(name), value.x, value.y, value.z); } - void Shader::setFloat(const std::string &name, glm::vec4 value) const + void Shader::setFloat(const std::string& name, glm::vec4 value) const { // Set uniform vec4 data glUniform4f(findUniform(name), value.x, value.y, value.z, value.w); } - void Shader::setFloat(const std::string &name, glm::mat3 matrix) const + void Shader::setFloat(const std::string& name, glm::mat3 matrix) const { // Set uniform mat3 data glUniformMatrix3fv(findUniform(name), 1, GL_FALSE, glm::value_ptr(matrix)); } - void Shader::setFloat(const std::string &name, glm::mat4 matrix) const + void Shader::setFloat(const std::string& name, glm::mat4 matrix) const { // Set uniform mat4 data glUniformMatrix4fv(findUniform(name), 1, GL_FALSE, glm::value_ptr(matrix)); diff --git a/inferno/src/inferno/window.cpp b/inferno/src/inferno/window.cpp index 7d7faaf..c7ec98c 100644 --- a/inferno/src/inferno/window.cpp +++ b/inferno/src/inferno/window.cpp @@ -78,7 +78,7 @@ namespace Inferno { // Window close callback glfwSetWindowCloseCallback(m_window, [](GLFWwindow* window) { - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); WindowCloseEvent event; w.m_eventCallback(event); @@ -86,7 +86,7 @@ namespace Inferno { // Window resize callback glfwSetWindowSizeCallback(m_window, [](GLFWwindow* window, int width, int height) { - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); w.m_windowProperties.width = width; w.m_windowProperties.height = height; @@ -101,7 +101,7 @@ namespace Inferno { (void)scanCode; (void)mods; - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); switch (action) { case GLFW_PRESS: { @@ -127,7 +127,7 @@ namespace Inferno { // Suppress unused warning (void)mods; - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); switch (action) { case GLFW_PRESS: { @@ -145,7 +145,7 @@ namespace Inferno { // Mouse position callback glfwSetCursorPosCallback(m_window, [](GLFWwindow* window, double xPos, double yPos) { - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); MousePositionEvent event(xPos, yPos); w.m_eventCallback(event); @@ -153,7 +153,7 @@ namespace Inferno { // Mouse scroll callback glfwSetScrollCallback(m_window, [](GLFWwindow* window, double xOffset, double yOffset) { - Window &w = *(Window*)glfwGetWindowUserPointer(window); + Window& w = *(Window*)glfwGetWindowUserPointer(window); MouseScrollEvent event(xOffset, yOffset); w.m_eventCallback(event);