Skip to content

Commit

Permalink
Windows: fix build and warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosua20 committed Aug 11, 2023
1 parent 87fd7d9 commit e606c69
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/helpers/ImGuiStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void ImGui::configureStyle(){
ImGui::StyleColorsDark();
ImGuiStyle & style = ImGui::GetStyle();
// Colors.
const ImVec4 a( 0.9f, 0.7, 1.0f, 1.0f );
const ImVec4 a( 0.9f, 0.7f, 1.0f, 1.0f );
ImVec4* colors = style.Colors;
const ImVec4 textColor = ImVec4( 0.95f, 0.95f, 0.95f, 1.00f );
const ImVec4 bgColor = ImVec4(0.10f * a.x, 0.10f * a.y, 0.10f * a.z, 1.00f);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/ProgramUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ std::vector<GLuint> generate2DViewsOfArray(GLuint tex, unsigned int maxSize){
std::vector<GLuint> tex2Ds(l);
glGenTextures(l, tex2Ds.data());

for(unsigned int i = 0; i < l; ++i){
for(int i = 0; i < l; ++i){
glBindTexture(GL_TEXTURE_2D, tex2Ds[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
Expand Down
22 changes: 11 additions & 11 deletions src/helpers/ProgramUtilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ShaderProgram {
void uniform(const std::string& name, const T& val);

template<typename T>
void uniforms(const std::string& name, unsigned int count, const T* vals);
void uniforms(const std::string& name, size_t count, const T* vals);

private:

Expand Down Expand Up @@ -83,28 +83,28 @@ inline void ShaderProgram::uniform(const std::string& name, const glm::vec4& val
}

template<>
inline void ShaderProgram::uniforms(const std::string& name, unsigned int count, const int* vals){
glUniform1iv(_uniforms[name], count, vals);
inline void ShaderProgram::uniforms(const std::string& name, size_t count, const int* vals){
glUniform1iv(_uniforms[name], (unsigned int)count, vals);
}

template<>
inline void ShaderProgram::uniforms(const std::string& name, unsigned int count, const float* vals){
glUniform1fv(_uniforms[name], count, vals);
inline void ShaderProgram::uniforms(const std::string& name, size_t count, const float* vals){
glUniform1fv(_uniforms[name], (unsigned int)count, vals);
}

template<>
inline void ShaderProgram::uniforms(const std::string& name, unsigned int count, const glm::vec2* vals){
glUniform2fv(_uniforms[name], count, (GLfloat*)vals);
inline void ShaderProgram::uniforms(const std::string& name, size_t count, const glm::vec2* vals){
glUniform2fv(_uniforms[name], (unsigned int)count, (GLfloat*)vals);
}

template<>
inline void ShaderProgram::uniforms(const std::string& name, unsigned int count, const glm::vec3* vals){
glUniform3fv(_uniforms[name], count, (GLfloat*)vals);
inline void ShaderProgram::uniforms(const std::string& name, size_t count, const glm::vec3* vals){
glUniform3fv(_uniforms[name], (unsigned int)count, (GLfloat*)vals);
}

template<>
inline void ShaderProgram::uniforms(const std::string& name, unsigned int count, const glm::vec4* vals){
glUniform4fv(_uniforms[name], count, (GLfloat*)vals);
inline void ShaderProgram::uniforms(const std::string& name, size_t count, const glm::vec4* vals){
glUniform4fv(_uniforms[name], (unsigned int)count, (GLfloat*)vals);
}

// Texture loading.
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Recorder::~Recorder(){

void Recorder::record(const std::shared_ptr<Framebuffer> & frame){

const unsigned int displayCurrentFrame = _currentFrame + 1;
const unsigned int displayCurrentFrame = (unsigned int)_currentFrame + 1;
if((displayCurrentFrame == 1) || (displayCurrentFrame % 10 == 0)){
std::cout << "\r[EXPORT]: Processing frame " << displayCurrentFrame << "/" << _framesCount << "." << std::flush;
}
Expand All @@ -177,7 +177,7 @@ void Recorder::record(const std::shared_ptr<Framebuffer> & frame){
return;
}

const unsigned int buffIndex = _currentFrame % _savingThreads.size();
const unsigned int buffIndex = _currentFrame % (unsigned int)_savingThreads.size();
// Make sure the thread we want to work on is available.
if(_savingThreads[buffIndex].joinable())
_savingThreads[buffIndex].join();
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void drop_callback(GLFWwindow* window, int count, const char** paths){
Renderer *renderer = static_cast<Renderer*>(glfwGetWindowUserPointer(window));
bool loadedMIDI = false;
bool loadedConfig = false;
for(unsigned int i = 0; i < count; ++i){
for(int i = 0; i < count; ++i){
std::string path(paths[i]);
if(path.empty()){
continue;
Expand Down
28 changes: 14 additions & 14 deletions src/rendering/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ void Renderer::showSetEditor(){
// List of existing keys.
// Keep some room at the bottom for the "new key" section.
ImVec2 listSize = ImGui::GetContentRegionAvail();
listSize.y -= 1.5 * ImGui::GetTextLineHeightWithSpacing();
listSize.y -= 1.5f * ImGui::GetTextLineHeightWithSpacing();

if(ImGui::BeginTable("#List", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_ScrollX | ImGuiTableFlags_BordersH, listSize)){
const size_t rowCount = _state.setOptions.keys.size();
Expand All @@ -1392,7 +1392,7 @@ void Renderer::showSetEditor(){
SetOptions::KeyFrame& key = _state.setOptions.keys[row];

ImGui::TableNextColumn();
ImGui::PushID(row);
ImGui::PushID((unsigned int)row);

ImGuiPushItemWidth(colWidth);
if(ImGui::InputDouble("##Time", &key.time, 0, 0, "%.3fs")){
Expand Down Expand Up @@ -1443,17 +1443,17 @@ void Renderer::showSetEditor(){
newKey.time = (std::max)(0.0, newKey.time);
}
ImGui::PopItemWidth();
ImGuiSameLine(colWidth + 2 * offset);
ImGuiSameLine(int(colWidth + 2 * offset));
ImGuiPushItemWidth(colWidth);
ImGui::Combo("##Key", &newKey.key, midiKeysStrings, 128);
ImGui::PopItemWidth();

ImGuiSameLine(2 * colWidth + 3 * offset);
ImGuiSameLine(int(2 * colWidth + 3 * offset));
ImGuiPushItemWidth(colWidth);
ImGui::Combo("##Set", &newKey.set, kSetsComboString);
ImGui::PopItemWidth();

ImGuiSameLine(3 * colWidth + 4 * offset);
ImGuiSameLine(int(3 * colWidth + 4 * offset));
if(ImGui::Button("Add")){
auto insert = std::upper_bound(_state.setOptions.keys.begin(), _state.setOptions.keys.end(), newKey);
_state.setOptions.keys.insert(insert, newKey);
Expand Down Expand Up @@ -1521,7 +1521,7 @@ void Renderer::showParticlesEditor(){
const unsigned int colButtonWidth = 20;
const float offset = 8;
const unsigned int thumbSize = 24;
const unsigned int thumbDisplaySize = _guiScale * thumbSize;
const unsigned int thumbDisplaySize = (unsigned int)(_guiScale * thumbSize);

// For previewing.
static std::vector<GLuint> previewTextures;
Expand Down Expand Up @@ -1556,7 +1556,7 @@ void Renderer::showParticlesEditor(){
// List of existing keys.
// Keep some room at the bottom for the "new key" section.
ImVec2 listSize = ImGui::GetContentRegionAvail();
listSize.y -= 1.5 * ImGui::GetTextLineHeightWithSpacing();
listSize.y -= 1.5f * ImGui::GetTextLineHeightWithSpacing();

if(ImGui::BeginTable("#List", 3, ImGuiTableFlags_ScrollY | ImGuiTableFlags_ScrollX | ImGuiTableFlags_BordersH, listSize)){
const size_t rowCount = _state.particles.imagePaths.size();
Expand All @@ -1574,8 +1574,8 @@ void Renderer::showParticlesEditor(){
const std::string& path = _state.particles.imagePaths[row];

ImGui::TableNextColumn();
ImGui::PushID(row);
if(ImGui::Selectable("##rowSelector", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap, ImVec2(0, thumbDisplaySize))) {
ImGui::PushID((unsigned int)row);
if(ImGui::Selectable("##rowSelector", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap, ImVec2(0.f, thumbDisplaySize))) {
// Open directory in file browser.
sr_gui_open_in_explorer(path.c_str());
}
Expand All @@ -1584,7 +1584,7 @@ void Renderer::showParticlesEditor(){
}
if(row < previewTextures.size()){
ImGui::SameLine();
ImGui::Image((ImTextureID)(uint64_t)previewTextures[row], ImVec2(thumbDisplaySize,thumbDisplaySize), ImVec2(0,1), ImVec2(1,0));
ImGui::Image((ImTextureID)(uint64_t)previewTextures[row], ImVec2(thumbDisplaySize,thumbDisplaySize), ImVec2(0.f,1.f), ImVec2(1.f,0.f));
}
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
Expand Down Expand Up @@ -1647,7 +1647,7 @@ void Renderer::showParticlesEditor(){
if (_state.particles.tex != ResourcesManager::getTextureFor("blankarray")) {
glDeleteTextures(1, &_state.particles.tex);
}
glDeleteTextures(previewTextures.size(), previewTextures.data());
glDeleteTextures((GLsizei)previewTextures.size(), previewTextures.data());
previewTextures.clear();

if(_state.particles.imagePaths.empty()){
Expand All @@ -1668,8 +1668,8 @@ void Renderer::showParticlesEditor(){

bool Renderer::drawPedalImageSettings(GLuint tex, const glm::vec2& size, bool labelsAfter, bool flipUV, PathCollection& path, unsigned int index, glm::vec3& color){
bool refresh = false;
const ImVec2 startUV(flipUV ? 1 : 0,1);
const ImVec2 endUV(flipUV ? 0 : 1,0);
const ImVec2 startUV(flipUV ? 1.f : 0.f, 1.f);
const ImVec2 endUV(flipUV ? 0.f : 1.f, 0.f);

ImGui::BeginGroup();

Expand Down Expand Up @@ -1744,7 +1744,7 @@ void Renderer::refreshPedalTextures(State::PedalsState& pedals){
pedals.texTop = loadTexture(pedals.topImagePath[0], 1, false);
}
// Load the new ones if present.
const unsigned int newCount = pedals.sideImagePaths.size();
const unsigned int newCount = (unsigned int)pedals.sideImagePaths.size();
for(unsigned int i = 0; i < 2; ++i){
if(i < newCount){
pedals.texSides[i] = loadTexture(pedals.sideImagePaths[i], 1, false);
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/scene/MIDIScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void MIDIScene::drawPedals(float time, const glm::vec2 & invScreenSize, const St

glBindVertexArray(_vao);
if(state.merge){
const float active = glm::max(glm::max(actives[0], actives[1]), glm::max(actives[2], actives[3]));
const float active = (glm::max)((glm::max)(actives[0], actives[1]), (glm::max)(actives[2], actives[3]));
// We want to move the central pedal to the side
const glm::vec2 localShift = glm::vec2(horizSign, vertSign) * glm::vec2(sidesShiftX, 0.5f * expressionHeight);

Expand Down
2 changes: 1 addition & 1 deletion src/rendering/scene/MIDISceneLive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void MIDISceneLive::save(std::ofstream& file) const {
// Write all messages.
for(const MIDIFrame& frame : allMessages){
for(const libremidi::message& message : frame.messages){
writer.add_event(message.timestamp * unitsPerSecond, 0, message);
writer.add_event(int(message.timestamp * unitsPerSecond), 0, message);
}
}
writer.write(file);
Expand Down

0 comments on commit e606c69

Please sign in to comment.