diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d84cf0e..619192f 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -16,6 +16,7 @@ "slevesque.shader", "ms-vscode.cpptools-themes", "twxs.cmake", - "ms-vscode.cmake-tools" + "ms-vscode.cmake-tools", + "mine.cpplint" ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 19ec9dc..0dba757 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +1,5 @@ { "tasks": [ - { - "type": "cppbuild", - "label": "C/C++: g++-20 build learnogl", - "command": "/usr/bin/g++", - "args": [ - "-g", - "-std=c++2a", - "-I${workspaceFolder}/dependencies/include", - "-L${workspaceFolder}/dependencies/library", - "-Wall", - "${workspaceFolder}/learnOpenGl/engine/*.hpp", - "${workspaceFolder}/learnOpenGl/engine/*.cpp", - "${workspaceFolder}/learnOpenGl/engine/glad.c", - "-o", - "${workspaceFolder}/learnOpenGl/engine/match", - "-lglut", - "-lglfw", - "-lGLU", - "-lGL", - "-lm", - "-ldl", - "-pipe", - "-Wno-volatile", - "-O0" - ], - "options": { - "cwd": "${fileDirname}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Task generated by Debugger." - }, { "type": "cppbuild", "label": "C/C++: g++-20 build breakout", diff --git a/breakout/breakout.cpp b/breakout/breakout.cpp index 8b0b824..dc61315 100644 --- a/breakout/breakout.cpp +++ b/breakout/breakout.cpp @@ -1,17 +1,20 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_CPP #define BREAKOUT_CPP -#include "../dependencies/include/glad/glad.h" #include - -#include "game.hpp" -#include "resourceManager.hpp" - #include +#include "../dependencies/include/glad/glad.h" +#include "./game.hpp" +#include "./resourceManager.hpp" + + + // GLFW function declarations void framebuffer_size_callback(GLFWwindow* window, int width, int height); -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode); +void key_callback(GLFWwindow* window, int key, +int scancode, int action, int mode); // The Width of the screen const unsigned int SCREEN_WIDTH = 800; @@ -31,13 +34,13 @@ int main(int argc, char *argv[]) #endif glfwWindowHint(GLFW_RESIZABLE, false); - GLFWwindow* window = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Breakout", nullptr, nullptr); + GLFWwindow* window = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, + "Breakout", nullptr, nullptr); glfwMakeContextCurrent(window); // glad: load all OpenGL function pointers // --------------------------------------- - if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) - { + if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { std::cout << "Failed to initialize GLAD" << std::endl; return -1; } @@ -60,8 +63,7 @@ int main(int argc, char *argv[]) float deltaTime = 0.0f; float lastFrame = 0.0f; - while (!glfwWindowShouldClose(window)) - { + while (!glfwWindowShouldClose(window)) { // calculate delta time // -------------------- float currentFrame = glfwGetTime(); @@ -94,13 +96,13 @@ int main(int argc, char *argv[]) return 0; } -void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode) -{ - // when a user presses the escape key, we set the WindowShouldClose property to true, closing the application +void key_callback(GLFWwindow* window, int key, +int scancode, int action, int mode) { + // when a user presses the escape key, we set the + // WindowShouldClose property to true, closing the application if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - if (key >= 0 && key < 1024) - { + if (key >= 0 && key < 1024) { if (action == GLFW_PRESS) Breakout.Keys[key] = true; else if (action == GLFW_RELEASE) @@ -110,10 +112,12 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod void framebuffer_size_callback(GLFWwindow* window, int width, int height) { - // make sure the viewport matches the new window dimensions; note that width and + // make sure the viewport matches the new window dimensions; + // note that width and // height will be significantly larger than specified on retina displays. glViewport(0, 0, width, height); } -#endif // BREAKOUT_CPP \ No newline at end of file +#endif +// BREAKOUT_CPP diff --git a/breakout/game.cpp b/breakout/game.cpp index 550451f..4bd0f44 100644 --- a/breakout/game.cpp +++ b/breakout/game.cpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef GAME_CPP #define GAME_CPP #include "./game.hpp" diff --git a/breakout/game.hpp b/breakout/game.hpp index 886d3cc..54698f5 100644 --- a/breakout/game.hpp +++ b/breakout/game.hpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_GAME_HPP_ #define BREAKOUT_GAME_HPP_ diff --git a/breakout/resourceManager.cpp b/breakout/resourceManager.cpp index a6f463e..0dcef7b 100644 --- a/breakout/resourceManager.cpp +++ b/breakout/resourceManager.cpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_RESOURCE_MANAGER_HPP_ #define BREAKOUT_RESOURCE_MANAGER_HPP_ diff --git a/breakout/resourceManager.hpp b/breakout/resourceManager.hpp index cb949f2..f3189c7 100644 --- a/breakout/resourceManager.hpp +++ b/breakout/resourceManager.hpp @@ -1,5 +1,4 @@ - - +// Copyright [2023] Krzysztof Rudnicki /******************************************************************* ** This code is part of Breakout. ** diff --git a/breakout/shader.cpp b/breakout/shader.cpp index 06953d6..09d1ddd 100644 --- a/breakout/shader.cpp +++ b/breakout/shader.cpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_SHADER_CPP #define BREAKOUT_SHADER_CPP #include "./shader.hpp" diff --git a/breakout/shader.hpp b/breakout/shader.hpp index aaca42a..b4b29c7 100644 --- a/breakout/shader.hpp +++ b/breakout/shader.hpp @@ -1,5 +1,4 @@ - - +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_SHADER_HPP_ #define BREAKOUT_SHADER_HPP_ diff --git a/breakout/texture.cpp b/breakout/texture.cpp index a2c8b25..befc1aa 100644 --- a/breakout/texture.cpp +++ b/breakout/texture.cpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_TEXTURE_CPP_ #define BREAKOUT_TEXTURE_CPP_ diff --git a/breakout/texture.hpp b/breakout/texture.hpp index 4d68134..3803a45 100644 --- a/breakout/texture.hpp +++ b/breakout/texture.hpp @@ -1,3 +1,4 @@ +// Copyright [2023] Krzysztof Rudnicki #ifndef BREAKOUT_TEXTURE_HPP_ #define BREAKOUT_TEXTURE_HPP_