From c37a8471c9918d5d3ce85e66c93583ccfed63077 Mon Sep 17 00:00:00 2001 From: redstrate <54911369+redstrate@users.noreply.github.com> Date: Mon, 15 Feb 2021 15:18:21 -0500 Subject: [PATCH] Add support for editor under GCC/Linux --- platforms/linux/main.cpp.in | 7 +++++++ tools/common/src/commoneditor.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/platforms/linux/main.cpp.in b/platforms/linux/main.cpp.in index b9600b8..1747de9 100755 --- a/platforms/linux/main.cpp.in +++ b/platforms/linux/main.cpp.in @@ -22,6 +22,8 @@ Display *dpy = nullptr; int mouse_x = -1, mouse_y = -1; bool mouse_down[2] = {false, false}; +int window_width = -1, window_height = -1; + xcb_connection_t* connection = nullptr; xcb_screen_t* screen = nullptr; @@ -101,6 +103,9 @@ int platform::open_window(const std::string_view title, const prism::Rectangle r xcb_map_window(connection, win.window); xcb_flush(connection); + window_width = rect.extent.width; + window_height = rect.extent.height; + engine->add_window((void*)&win, 0, rect.extent); app->initialize_render(); @@ -131,9 +136,11 @@ prism::Offset platform::get_window_position(const int index) { } prism::Extent platform::get_window_size(const int index) { + return {window_width, window_height}; } prism::Extent platform::get_window_drawable_size(const int index) { + return {window_width, window_height}; } bool platform::is_window_focused(const int index) { diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index 59fa3ab..1167a6a 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -845,7 +845,7 @@ GFXTexture* CommonEditor::get_mesh_preview(Mesh& mesh) { for(const auto& part : scene.get(mesh_obj).mesh->parts) { const auto find_biggest_component = [&biggest_component](const Vector3 vec) { for(auto& component : vec.data) { - if(std::fabsf(component) > biggest_component) + if(std::fabs(component) > biggest_component) biggest_component = component; } };