Adds formatting config and formats project
This commit is contained in:
parent
6540ce8b7c
commit
ca64248ace
31
.clang-format
Normal file
31
.clang-format
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
BasedOnStyle: LLVM
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: Never
|
||||||
|
ColumnLimit: 120
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Inline
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
PointerAlignment: Left
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AlignOperands: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
SortIncludes: false
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentGotoLabels: false
|
||||||
|
IndentPPDirectives: None
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
SpacesBeforeTrailingComments: 1
|
10
src/main.cpp
10
src/main.cpp
@ -24,8 +24,7 @@ float vertices[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned int indices[] = {
|
unsigned int indices[] = {
|
||||||
0, 1, 3,
|
0, 1, 3, 1, 2, 3,
|
||||||
1, 2, 3
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wireframe = false;
|
bool wireframe = false;
|
||||||
@ -35,7 +34,6 @@ int main()
|
|||||||
GLFWwindow* window;
|
GLFWwindow* window;
|
||||||
setupGLFW(&window);
|
setupGLFW(&window);
|
||||||
|
|
||||||
|
|
||||||
Shader myShader("shaders/shader.vs", "shaders/shader.fs");
|
Shader myShader("shaders/shader.vs", "shaders/shader.fs");
|
||||||
|
|
||||||
texture_t tex;
|
texture_t tex;
|
||||||
@ -53,7 +51,6 @@ int main()
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
|
||||||
if (tex.data) {
|
if (tex.data) {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex.width, tex.height, 0, GL_RGB, GL_UNSIGNED_BYTE, tex.data);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex.width, tex.height, 0, GL_RGB, GL_UNSIGNED_BYTE, tex.data);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
@ -61,8 +58,6 @@ int main()
|
|||||||
std::cout << "Failed to load texture\n";
|
std::cout << "Failed to load texture\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
stbi_image_free(tex.data);
|
stbi_image_free(tex.data);
|
||||||
|
|
||||||
unsigned int VAO;
|
unsigned int VAO;
|
||||||
@ -96,7 +91,6 @@ int main()
|
|||||||
myShader.use();
|
myShader.use();
|
||||||
myShader.setInt("tex", 0);
|
myShader.setInt("tex", 0);
|
||||||
|
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!glfwWindowShouldClose(window)) {
|
||||||
// input
|
// input
|
||||||
processInput(window);
|
processInput(window);
|
||||||
@ -147,7 +141,6 @@ void setupGLFW(GLFWwindow** window)
|
|||||||
glfwSetFramebufferSizeCallback(*window, framebuffer_size_callback);
|
glfwSetFramebufferSizeCallback(*window, framebuffer_size_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
@ -161,5 +154,4 @@ void processInput(GLFWwindow* window)
|
|||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
if (glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS) // disables wireframe mode
|
if (glfwGetKey(window, GLFW_KEY_BACKSPACE) == GLFW_PRESS) // disables wireframe mode
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user