Skip to content

Commit

Permalink
platform fix, 0 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gameknife committed Aug 11, 2024
1 parent 8a2625d commit ebd5c99
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ add_library(${exe_name} SHARED
${src_files_vulkan_hybriddeferred}
${src_files_common_compute_pipeline}
${src_files_thirdparty_json11}
${src_files_editor}
${src_files}
GameActivitySources.cpp
)
Expand Down
2 changes: 1 addition & 1 deletion src/Editor/EditorCommand.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include <functional>

#include <unordered_map>
#include "Utilities/Exception.hpp"

enum class EEditorCommand {
Expand Down
2 changes: 0 additions & 2 deletions src/Editor/EditorContentBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void Editor::GUI::ShowContentBrowser()
}
else
{
auto element = entry.path().filename().string().c_str();
auto abspath = absolute(entry.path()).string();

ImGui::BeginGroup();
Expand Down Expand Up @@ -56,7 +55,6 @@ void Editor::GUI::ShowContentBrowser()


ImGui::PushItemWidth(ICON_SIZE);
ImVec2 textSize = ImGui::CalcTextSize(entry.path().filename().string().c_str());
ImGui::PushTextWrapPos(ImGui::GetCursorPosX() + ICON_SIZE);
ImGui::Text("%s", entry.path().filename().string().c_str());
ImGui::PopTextWrapPos();
Expand Down
5 changes: 2 additions & 3 deletions src/Editor/EditorProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void Editor::GUI::ShowProperties()
if (selected_obj != nullptr)
{
ImGui::PushFont(fontIcon_);
ImGui::Text(selected_obj->GetName().c_str());
ImGui::TextUnformatted(selected_obj->GetName().c_str());
ImGui::PopFont();
ImGui::Separator();
ImGui::NewLine();
Expand All @@ -25,8 +25,7 @@ void Editor::GUI::ShowProperties()
ImGui::Text(ICON_FA_LOCATION_ARROW " Transform");
ImGui::Separator();
auto mat4 = selected_obj->WorldTransform();

glm::mat4 transformation; // your transformation matrix.

glm::vec3 scale;
glm::quat rotation;
glm::vec3 translation;
Expand Down
4 changes: 2 additions & 2 deletions src/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ UserInterface::UserInterface(
});

viewportTextureId_ = ImGui_ImplVulkan_AddTexture( viewportImage.Sampler().Handle(), viewportImage.GetImageView().Handle(), VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
viewportSize_ = ImVec2(viewportImage.GetImage().Extent().width, viewportImage.GetImage().Extent().height );
viewportSize_ = ImVec2(static_cast<float>(viewportImage.GetImage().Extent().width), static_cast<float>(viewportImage.GetImage().Extent().height));

firstRun = true;

Expand Down Expand Up @@ -327,7 +327,7 @@ void UserInterface::Render(VkCommandBuffer commandBuffer, uint32_t imageIdx, con
ImGuiID id = DockSpaceUI();
ToolbarUI();
ImGuiDockNode* node = ImGui::DockBuilderGetCentralNode(id);
swapChain_.UpdateEditorViewport(node->Pos.x - viewport->Pos.x, node->Pos.y - viewport->Pos.y, node->Size.x, node->Size.y);
swapChain_.UpdateEditorViewport(Utilities::Math::floorToInt(node->Pos.x - viewport->Pos.x), Utilities::Math::floorToInt(node->Pos.y - viewport->Pos.y), Utilities::Math::ceilToInt(node->Size.x), Utilities::Math::ceilToInt(node->Size.y));
MainWindowGUI(*editorGUI_, scene, statistics, id, firstRun);
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/Utilities/FileHelper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Utilities
const std::string characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::random_device rd;
std::mt19937 generator(rd());
std::uniform_int_distribution<> distribution(0, characters.size() - 1);
std::uniform_int_distribution<> distribution(0, static_cast<int>(characters.size()) - 1);

std::string randomName;
for (size_t i = 0; i < length; ++i) {
Expand Down
10 changes: 10 additions & 0 deletions src/Utilities/Math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ namespace Utilities
{
return size % divider == 0 ? size / divider : size / divider + 1;
}

static int32_t floorToInt(float value)
{
return static_cast<int32_t>(std::floor(value));
}

static int32_t ceilToInt(float value)
{
return static_cast<int32_t>(std::ceil(value));
}
}

static std::string metricFormatter(double value, std::string unit, int kilo = 1000) //if pass data as (void*)"b" - show info like kb, Mb, Gb
Expand Down
10 changes: 5 additions & 5 deletions src/Vulkan/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ void Window::attemptDragWindow() {
glfwGetCursorPos(window_, &c_xpos, &c_ypos);
glfwGetWindowPos(window_, &w_xpos, &w_ypos);
if (
s_xpos >= 0 && s_xpos <= ((double)w_xsiz - CLOSE_AREA_WIDTH) &&
s_xpos >= 0 && s_xpos <= (static_cast<double>(w_xsiz) - CLOSE_AREA_WIDTH) &&
s_ypos >= 0 && s_ypos <= TITLE_AREA_HEIGHT) {
glfwSetWindowPos(window_, w_xpos + (c_xpos - s_xpos), w_ypos + (c_ypos - s_ypos));
glfwSetWindowPos(window_, w_xpos + static_cast<int>(c_xpos - s_xpos), w_ypos + static_cast<int>(c_ypos - s_ypos));
}
if (
s_xpos >= ((double)w_xsiz - 15) && s_xpos <= ((double)w_xsiz) &&
s_ypos >= ((double)w_ysiz - 15) && s_ypos <= ((double)w_ysiz)) {
glfwSetWindowSize(window_, w_xsiz + (c_xpos - s_xpos), w_ysiz + (c_ypos - s_ypos));
s_xpos >= (static_cast<double>(w_xsiz) - 15) && s_xpos <= (static_cast<double>(w_xsiz)) &&
s_ypos >= (static_cast<double>(w_ysiz) - 15) && s_ypos <= (static_cast<double>(w_ysiz))) {
glfwSetWindowSize(window_, w_xsiz + static_cast<int>(c_xpos - s_xpos), w_ysiz + static_cast<int>(c_ypos - s_ypos));
}
}
if (glfwGetMouseButton(window_, 0) == GLFW_RELEASE && dragState == 1) {
Expand Down
2 changes: 1 addition & 1 deletion vcpkg_android.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ IF EXIST vcpkg.android (
rem replace the triplets/arm64-android.cmake file with ours
copy /Y %PROJROOT%\android\custom-triplets\arm64-android.cmake %CD%\triplets\arm64-android.cmake

.\vcpkg.exe install ^
.\vcpkg.exe --recurse install ^
boost-exception:arm64-android ^
boost-program-options:arm64-android ^
boost-stacktrace:arm64-android ^
Expand Down

0 comments on commit ebd5c99

Please sign in to comment.