mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 15:43:19 +02:00
feat: updated breakout.cpp according to cpplint standard
This commit is contained in:
parent
ab5b0daa4e
commit
40cee498e3
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@ -16,6 +16,7 @@
|
|||||||
"slevesque.shader",
|
"slevesque.shader",
|
||||||
"ms-vscode.cpptools-themes",
|
"ms-vscode.cpptools-themes",
|
||||||
"twxs.cmake",
|
"twxs.cmake",
|
||||||
"ms-vscode.cmake-tools"
|
"ms-vscode.cmake-tools",
|
||||||
|
"mine.cpplint"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
37
.vscode/tasks.json
vendored
37
.vscode/tasks.json
vendored
@ -1,42 +1,5 @@
|
|||||||
{
|
{
|
||||||
"tasks": [
|
"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",
|
"type": "cppbuild",
|
||||||
"label": "C/C++: g++-20 build breakout",
|
"label": "C/C++: g++-20 build breakout",
|
||||||
|
|||||||
@ -1,17 +1,20 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_CPP
|
#ifndef BREAKOUT_CPP
|
||||||
#define BREAKOUT_CPP
|
#define BREAKOUT_CPP
|
||||||
|
|
||||||
#include "../dependencies/include/glad/glad.h"
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include "game.hpp"
|
|
||||||
#include "resourceManager.hpp"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "../dependencies/include/glad/glad.h"
|
||||||
|
#include "./game.hpp"
|
||||||
|
#include "./resourceManager.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// GLFW function declarations
|
// GLFW function declarations
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
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
|
// The Width of the screen
|
||||||
const unsigned int SCREEN_WIDTH = 800;
|
const unsigned int SCREEN_WIDTH = 800;
|
||||||
@ -31,13 +34,13 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
glfwWindowHint(GLFW_RESIZABLE, false);
|
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);
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
// glad: load all OpenGL function pointers
|
// glad: load all OpenGL function pointers
|
||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
|
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
||||||
{
|
|
||||||
std::cout << "Failed to initialize GLAD" << std::endl;
|
std::cout << "Failed to initialize GLAD" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -60,8 +63,7 @@ int main(int argc, char *argv[])
|
|||||||
float deltaTime = 0.0f;
|
float deltaTime = 0.0f;
|
||||||
float lastFrame = 0.0f;
|
float lastFrame = 0.0f;
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window)) {
|
||||||
{
|
|
||||||
// calculate delta time
|
// calculate delta time
|
||||||
// --------------------
|
// --------------------
|
||||||
float currentFrame = glfwGetTime();
|
float currentFrame = glfwGetTime();
|
||||||
@ -94,13 +96,13 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
// when a user presses the escape key, we set the WindowShouldClose property to true, closing the application
|
// 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)
|
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
if (key >= 0 && key < 1024)
|
if (key >= 0 && key < 1024) {
|
||||||
{
|
|
||||||
if (action == GLFW_PRESS)
|
if (action == GLFW_PRESS)
|
||||||
Breakout.Keys[key] = true;
|
Breakout.Keys[key] = true;
|
||||||
else if (action == GLFW_RELEASE)
|
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)
|
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.
|
// height will be significantly larger than specified on retina displays.
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // BREAKOUT_CPP
|
#endif
|
||||||
|
// BREAKOUT_CPP
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef GAME_CPP
|
#ifndef GAME_CPP
|
||||||
#define GAME_CPP
|
#define GAME_CPP
|
||||||
#include "./game.hpp"
|
#include "./game.hpp"
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_GAME_HPP_
|
#ifndef BREAKOUT_GAME_HPP_
|
||||||
#define BREAKOUT_GAME_HPP_
|
#define BREAKOUT_GAME_HPP_
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_RESOURCE_MANAGER_HPP_
|
#ifndef BREAKOUT_RESOURCE_MANAGER_HPP_
|
||||||
#define BREAKOUT_RESOURCE_MANAGER_HPP_
|
#define BREAKOUT_RESOURCE_MANAGER_HPP_
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
** This code is part of Breakout.
|
** This code is part of Breakout.
|
||||||
**
|
**
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_SHADER_CPP
|
#ifndef BREAKOUT_SHADER_CPP
|
||||||
#define BREAKOUT_SHADER_CPP
|
#define BREAKOUT_SHADER_CPP
|
||||||
#include "./shader.hpp"
|
#include "./shader.hpp"
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
|
|
||||||
#ifndef BREAKOUT_SHADER_HPP_
|
#ifndef BREAKOUT_SHADER_HPP_
|
||||||
#define BREAKOUT_SHADER_HPP_
|
#define BREAKOUT_SHADER_HPP_
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_TEXTURE_CPP_
|
#ifndef BREAKOUT_TEXTURE_CPP_
|
||||||
#define BREAKOUT_TEXTURE_CPP_
|
#define BREAKOUT_TEXTURE_CPP_
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright [2023] Krzysztof Rudnicki
|
||||||
#ifndef BREAKOUT_TEXTURE_HPP_
|
#ifndef BREAKOUT_TEXTURE_HPP_
|
||||||
#define BREAKOUT_TEXTURE_HPP_
|
#define BREAKOUT_TEXTURE_HPP_
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user