2022-08-29 21:01:55 +02:00
|
|
|
#ifndef CONSTANTS_HPP
|
2022-08-31 20:40:41 +02:00
|
|
|
#include <GLFW/glfw3.h>
|
2022-08-29 21:01:55 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
|
|
namespace constants
|
|
|
|
|
{
|
|
|
|
|
// best practice is to use inline constexpr std::string_view but glfwCreateWindow takes only char* as input
|
|
|
|
|
inline const char* MAIN_WINDOW_NAME { "Match" };
|
|
|
|
|
inline constexpr int MAIN_WINDOW_WIDTH { 800 };
|
|
|
|
|
inline constexpr int MAIN_WINDOW_HEIGHT { 600 };
|
2022-08-31 20:40:41 +02:00
|
|
|
inline constexpr struct {
|
|
|
|
|
GLfloat red = 1.0f;
|
|
|
|
|
GLfloat green = 0.0f;
|
|
|
|
|
GLfloat blue = 0.0f;
|
|
|
|
|
GLfloat alpha = 1.0f;
|
|
|
|
|
} RED;
|
|
|
|
|
|
|
|
|
|
inline constexpr struct {
|
|
|
|
|
GLfloat red = 1.0f;
|
|
|
|
|
GLfloat green = 1.0f;
|
|
|
|
|
GLfloat blue = 1.0f;
|
|
|
|
|
GLfloat alpha = 1.0f;
|
|
|
|
|
} WHITE;
|
|
|
|
|
|
|
|
|
|
inline constexpr struct {
|
|
|
|
|
GLfloat red = 0.2f;
|
|
|
|
|
GLfloat green = 0.3f;
|
|
|
|
|
GLfloat blue = 0.3f;
|
|
|
|
|
GLfloat alpha = 1.0f;
|
|
|
|
|
} LEARN_OPEN_GL_COLOR;
|
2022-08-29 21:01:55 +02:00
|
|
|
|
2022-09-01 20:08:15 +02:00
|
|
|
// we write vertex shader
|
|
|
|
|
// version of glsl (since ogl 3.3 same as ogl so we pick 330)
|
|
|
|
|
// in this shader we just forward input data to shader output
|
|
|
|
|
inline const char *vertexShaderSource { "#version 330 core\n"
|
|
|
|
|
"layout (location = 0) in vec3 aPos;\n"
|
|
|
|
|
"void main()\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
|
|
|
|
|
"}\0" } ;
|
|
|
|
|
|
|
|
|
|
// write fragment shader
|
|
|
|
|
// we set the color of each pixel to be orange
|
|
|
|
|
inline const char *fragmentShaderSource {
|
|
|
|
|
"#version 330 core\n"
|
|
|
|
|
"out vec4 FragColor;\n"
|
|
|
|
|
"void main()\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
"FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
|
|
|
|
|
"}\0"
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-29 21:01:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|