mirror of
https://github.com/kuhyx/engineer-thesis-WUT.git
synced 2026-07-04 11:43:05 +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",
|
||||
"ms-vscode.cpptools-themes",
|
||||
"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": [
|
||||
{
|
||||
"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",
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_CPP
|
||||
#define BREAKOUT_CPP
|
||||
|
||||
#include "../dependencies/include/glad/glad.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "game.hpp"
|
||||
#include "resourceManager.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#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
|
||||
#endif
|
||||
// BREAKOUT_CPP
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef GAME_CPP
|
||||
#define GAME_CPP
|
||||
#include "./game.hpp"
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_GAME_HPP_
|
||||
#define BREAKOUT_GAME_HPP_
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_RESOURCE_MANAGER_HPP_
|
||||
#define BREAKOUT_RESOURCE_MANAGER_HPP_
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
/*******************************************************************
|
||||
** This code is part of Breakout.
|
||||
**
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_SHADER_CPP
|
||||
#define BREAKOUT_SHADER_CPP
|
||||
#include "./shader.hpp"
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_SHADER_HPP_
|
||||
#define BREAKOUT_SHADER_HPP_
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_TEXTURE_CPP_
|
||||
#define BREAKOUT_TEXTURE_CPP_
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// Copyright [2023] Krzysztof Rudnicki
|
||||
#ifndef BREAKOUT_TEXTURE_HPP_
|
||||
#define BREAKOUT_TEXTURE_HPP_
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user