GCC warnings fix
This commit is contained in:
parent
5954369744
commit
5a6a5bbb05
@ -10,7 +10,11 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
|
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra
|
||||||
|
# additional warnings
|
||||||
|
-Wformat-nonliteral -Wcast-align
|
||||||
|
-Wpointer-arith -Winline -Wundef
|
||||||
|
-Wwrite-strings -Wno-unused-parameter)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|||||||
@ -20,19 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
HudRenderer::HudRenderer() {
|
HudRenderer::HudRenderer() {
|
||||||
// float vertices[] = {
|
|
||||||
// // x y
|
|
||||||
// -0.01f,-0.01f,
|
|
||||||
// 0.01f, 0.01f,
|
|
||||||
|
|
||||||
// -0.01f, 0.01f,
|
|
||||||
// 0.01f,-0.01f,
|
|
||||||
// };
|
|
||||||
// int attrs[] = {
|
|
||||||
// 2, 0 //null terminator
|
|
||||||
// };
|
|
||||||
// crosshair = new Mesh(vertices, 4, attrs);
|
|
||||||
|
|
||||||
batch = new Batch2D(1024);
|
batch = new Batch2D(1024);
|
||||||
uicamera = new Camera(glm::vec3(), Window::height / 1.0f);
|
uicamera = new Camera(glm::vec3(), Window::height / 1.0f);
|
||||||
uicamera->perspective = false;
|
uicamera->perspective = false;
|
||||||
@ -79,7 +66,6 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
|
|
||||||
// Chosen block preview
|
// Chosen block preview
|
||||||
Texture* blocks = assets->getTexture("block");
|
Texture* blocks = assets->getTexture("block");
|
||||||
Texture* sprite = assets->getTexture("slot");
|
|
||||||
|
|
||||||
batch->texture(nullptr);
|
batch->texture(nullptr);
|
||||||
batch->color = vec4(1.0f);
|
batch->color = vec4(1.0f);
|
||||||
@ -90,13 +76,6 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
batch->line(Window::width/2-5, Window::height/2-5, Window::width/2+5, Window::height/2+5, 0.9f, 0.9f, 0.9f, 1.0f);
|
batch->line(Window::width/2-5, Window::height/2-5, Window::width/2+5, Window::height/2+5, 0.9f, 0.9f, 0.9f, 1.0f);
|
||||||
batch->line(Window::width/2+5, Window::height/2-5, Window::width/2-5, Window::height/2+5, 0.9f, 0.9f, 0.9f, 1.0f);
|
batch->line(Window::width/2+5, Window::height/2-5, Window::width/2-5, Window::height/2+5, 0.9f, 0.9f, 0.9f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// batch->texture(sprite);
|
|
||||||
// batch->sprite(Window::width/2-32, uicamera->fov - 80, 64, 64, 16, 0, vec4(1.0f));
|
|
||||||
// batch->rect(Window::width/2-128-4, Window::height-80-4, 256+8, 64+8,
|
|
||||||
// 0.85f, 0.85f, 0.85f, 0.95f, 0.95f, 0.95f,
|
|
||||||
// 0.55f, 0.55f, 0.55f,
|
|
||||||
// 0.45f, 0.45f, 0.45f, 0.7f, 0.7f, 0.7f, 2);
|
|
||||||
batch->rect(Window::width/2-128-4, Window::height-80-4, 256+8, 64+8,
|
batch->rect(Window::width/2-128-4, Window::height-80-4, 256+8, 64+8,
|
||||||
0.95f, 0.95f, 0.95f, 0.85f, 0.85f, 0.85f,
|
0.95f, 0.95f, 0.95f, 0.85f, 0.85f, 0.85f,
|
||||||
0.7f, 0.7f, 0.7f,
|
0.7f, 0.7f, 0.7f,
|
||||||
@ -167,7 +146,6 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
for (uint i = 1; i < count; i++) {
|
for (uint i = 1; i < count; i++) {
|
||||||
x = xs + step * ((i-1) % (inv_w / step));
|
x = xs + step * ((i-1) % (inv_w / step));
|
||||||
y = ys + step * ((i-1) / (inv_w / step));
|
y = ys + step * ((i-1) / (inv_w / step));
|
||||||
// batch->rect(x-2, y-2, size+4, size+4);
|
|
||||||
batch->rect(x-2, y-2, size+4, size+4,
|
batch->rect(x-2, y-2, size+4, size+4,
|
||||||
0.45f, 0.45f, 0.45f, 0.55f, 0.55f, 0.55f,
|
0.45f, 0.45f, 0.45f, 0.55f, 0.55f, 0.55f,
|
||||||
0.7f, 0.7f, 0.7f,
|
0.7f, 0.7f, 0.7f,
|
||||||
@ -178,13 +156,6 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
0.65f, 0.65f, 0.65f, 0.65f, 0.65f, 0.65f, 2);
|
0.65f, 0.65f, 0.65f, 0.65f, 0.65f, 0.65f, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// batch->color = vec4(0.5f, 0.5f, 0.5f, 1.0f);
|
|
||||||
// for (unsigned i = 1; i < count; i++) {
|
|
||||||
// x = xs + step * ((i-1) % (inv_w / step));
|
|
||||||
// y = ys + step * ((i-1) / (inv_w / step));
|
|
||||||
// batch->rect(x, y, size, size);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//front
|
//front
|
||||||
batch->texture(blocks);
|
batch->texture(blocks);
|
||||||
for (uint i = 1; i < count; i++) {
|
for (uint i = 1; i < count; i++) {
|
||||||
@ -200,10 +171,8 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
if (Events::jclicked(GLFW_MOUSE_BUTTON_LEFT)) {
|
if (Events::jclicked(GLFW_MOUSE_BUTTON_LEFT)) {
|
||||||
player->choosenBlock = i;
|
player->choosenBlock = i;
|
||||||
}
|
}
|
||||||
// size = 50;
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// size = 48;
|
|
||||||
tint = vec4(1.0f);
|
tint = vec4(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,15 +183,4 @@ void HudRenderer::draw(Level* level, Assets* assets){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// batch->render();
|
|
||||||
|
|
||||||
if (Events::_cursor_locked && !level->player->debug){
|
|
||||||
// Shader* crosshairShader = assets->getShader("crosshair");
|
|
||||||
// crosshairShader->use();
|
|
||||||
// crosshairShader->uniform1f("u_ar", (float)Window::height / (float)Window::width);
|
|
||||||
// crosshairShader->uniform1f("u_scale", 1.0f / ((float)Window::height / 1000.0f));
|
|
||||||
// glLineWidth(2.0f);
|
|
||||||
// crosshair->draw(GL_LINES);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user