fix compiler warnings
This commit is contained in:
@ -4,17 +4,6 @@ project(MassSprings)
|
|||||||
set(CMAKE_CXX_STANDARD 26)
|
set(CMAKE_CXX_STANDARD 26)
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wno-unused-parameter -Wunreachable-code")
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2 -ggdb") # -fsanitize=address already fails on InitWindow(), -fsanitize=undefined, -fsanitize=leak
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -march=native")
|
|
||||||
|
|
||||||
message("-- CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
|
||||||
message("-- CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
|
||||||
message("-- CMAKE_C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
|
|
||||||
message("-- CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
|
||||||
message("-- CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
||||||
message("-- CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
find_package(raylib REQUIRED)
|
find_package(raylib REQUIRED)
|
||||||
set(LIBS raylib)
|
set(LIBS raylib)
|
||||||
@ -43,6 +32,22 @@ if(NOT DEFINED DISABLE_TRACY)
|
|||||||
list(APPEND FLAGS TRACY)
|
list(APPEND FLAGS TRACY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
list(APPEND LIBS opengl32 gdi32 winmm)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set this after fetching tracy to hide tracy's warnings
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wno-unused-parameter -Wunreachable-code")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2 -ggdb") # -fsanitize=address already fails on InitWindow(), -fsanitize=undefined, -fsanitize=leak
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
|
||||||
|
|
||||||
|
message("-- CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||||
|
message("-- CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
||||||
|
message("-- CMAKE_C_FLAGS_RELEASE: ${CMAKE_C_FLAGS_RELEASE}")
|
||||||
|
message("-- CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
|
||||||
|
message("-- CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
|
message("-- CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
|
||||||
# Headers + Sources
|
# Headers + Sources
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
|||||||
@ -47,9 +47,9 @@ public:
|
|||||||
bool edited = false;
|
bool edited = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StateManager(ThreadedPhysics &_physics, const std::string &preset_file)
|
StateManager(ThreadedPhysics &_physics, const std::string &_preset_file)
|
||||||
: physics(_physics) {
|
: physics(_physics) {
|
||||||
ParsePresetFile(preset_file);
|
ParsePresetFile(_preset_file);
|
||||||
current_state = presets.at(current_preset);
|
current_state = presets.at(current_preset);
|
||||||
ClearGraph();
|
ClearGraph();
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/gui.cpp
18
src/gui.cpp
@ -253,13 +253,13 @@ auto Gui::DrawButton(Rectangle bounds, const std::string &label, Color color,
|
|||||||
SetDefaultStyle(style_default);
|
SetDefaultStyle(style_default);
|
||||||
SetComponentStyle(BUTTON, style_button);
|
SetComponentStyle(BUTTON, style_button);
|
||||||
|
|
||||||
const int state = GuiGetState();
|
const int _state = GuiGetState();
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(STATE_DISABLED);
|
GuiSetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
int pressed = GuiButton(bounds, label.data());
|
int pressed = GuiButton(bounds, label.data());
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(state);
|
GuiSetState(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore original styling
|
// Restore original styling
|
||||||
@ -296,14 +296,14 @@ auto Gui::DrawToggleSlider(Rectangle bounds, const std::string &off_label,
|
|||||||
SetComponentStyle(SLIDER, style_slider);
|
SetComponentStyle(SLIDER, style_slider);
|
||||||
SetComponentStyle(TOGGLE, style_toggle);
|
SetComponentStyle(TOGGLE, style_toggle);
|
||||||
|
|
||||||
const int state = GuiGetState();
|
const int _state = GuiGetState();
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(STATE_DISABLED);
|
GuiSetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
int pressed = GuiToggleSlider(
|
int pressed = GuiToggleSlider(
|
||||||
bounds, std::format("{};{}", off_label, on_label).data(), active);
|
bounds, std::format("{};{}", off_label, on_label).data(), active);
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(state);
|
GuiSetState(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore original styling
|
// Restore original styling
|
||||||
@ -343,13 +343,13 @@ auto Gui::DrawSpinner(Rectangle bounds, const std::string &label, int *value,
|
|||||||
SetComponentStyle(VALUEBOX, style_valuebox);
|
SetComponentStyle(VALUEBOX, style_valuebox);
|
||||||
SetComponentStyle(BUTTON, style_button);
|
SetComponentStyle(BUTTON, style_button);
|
||||||
|
|
||||||
const int state = GuiGetState();
|
const int _state = GuiGetState();
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(STATE_DISABLED);
|
GuiSetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
int pressed = GuiSpinner(bounds, "", label.data(), value, min, max, false);
|
int pressed = GuiSpinner(bounds, "", label.data(), value, min, max, false);
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(state);
|
GuiSetState(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore original styling
|
// Restore original styling
|
||||||
@ -382,13 +382,13 @@ auto Gui::DrawLabel(Rectangle bounds, const std::string &text, Color color,
|
|||||||
SetDefaultStyle(style_default);
|
SetDefaultStyle(style_default);
|
||||||
SetComponentStyle(LABEL, style_label);
|
SetComponentStyle(LABEL, style_label);
|
||||||
|
|
||||||
const int state = GuiGetState();
|
const int _state = GuiGetState();
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(STATE_DISABLED);
|
GuiSetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
int pressed = GuiLabel(bounds, text.data());
|
int pressed = GuiLabel(bounds, text.data());
|
||||||
if (!enabled || WindowOpen()) {
|
if (!enabled || WindowOpen()) {
|
||||||
GuiSetState(state);
|
GuiSetState(_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore original styling
|
// Restore original styling
|
||||||
@ -516,7 +516,7 @@ auto Gui::DrawCameraControls(Color color) const -> void {
|
|||||||
int projection = camera.projection == CAMERA_ORTHOGRAPHIC;
|
int projection = camera.projection == CAMERA_ORTHOGRAPHIC;
|
||||||
DrawMenuToggleSlider(0, 3, 1, 1, "Perspective (Alt)", "Orthographic (Alt)",
|
DrawMenuToggleSlider(0, 3, 1, 1, "Perspective (Alt)", "Orthographic (Alt)",
|
||||||
&projection, color);
|
&projection, color);
|
||||||
if (projection != camera.projection == CAMERA_ORTHOGRAPHIC) {
|
if (projection != (camera.projection == CAMERA_ORTHOGRAPHIC)) {
|
||||||
input.ToggleCameraProjection();
|
input.ToggleCameraProjection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user