Misc UI updates and fixes:

- Vertically center the server name for manually added servers
- Add padding for feature icons
- Use a popup for adding a new server
- Display pointers for both controllers
- Avoid jumps in scrolling when the focused controller changes
- Grab the GUI by the pointed position instead of the center
- Add battery level in lobby
- Use the correct width in the server list if there is a scrollbar
- Make sure the tooltip does not overflow on other layers
- Save the virtual keyboard layout in the config file
- Don't display the IP address for USB connections
- Allow receiving intents when WiVRn is already running
- Add recentering tip
This commit is contained in:
Guillaume Meunier
2024-11-01 14:13:58 +01:00
parent dca3254df9
commit e1ce484c27
20 changed files with 1191 additions and 692 deletions
+14 -3
View File
@@ -20,6 +20,7 @@
#include "wivrn_config.h"
#include "xr/hand_tracker.h"
#include "xr/space.h"
#include "xr/swapchain.h"
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -90,6 +91,7 @@ public:
struct viewport
{
// Position of this viewport in the world
xr::spaces space; // Must be world to allow the cursor to work
glm::vec3 position;
glm::quat orientation;
glm::vec2 size;
@@ -98,6 +100,10 @@ public:
glm::ivec2 vp_origin;
glm::ivec2 vp_size;
bool always_show_cursor = false; // Show the cursor in this viewport even if there is a modal popup elsewhere (eg. this is a virtual keyboard)
int z_index = 0;
ImVec2 vp_center() const
{
return ImVec2(vp_origin.x + int(vp_size.x / 2), vp_origin.y + int(vp_size.y / 2));
@@ -160,7 +166,6 @@ private:
void initialize_fonts();
std::vector<controller_state> read_controllers_state(XrTime display_time);
void compute_pointer_position(controller_state & state);
public:
imgui_context(
@@ -179,8 +184,10 @@ public:
return layers_;
}
viewport & layer(ImVec2 position);
void new_frame(XrTime display_time);
std::vector<XrCompositionLayerQuad> end_frame();
std::vector<std::pair<int, XrCompositionLayerQuad>> end_frame();
ImFont * large_font;
size_t get_focused_controller() const
@@ -188,7 +195,11 @@ public:
return focused_controller;
}
std::vector<std::pair<ImVec2, float>> ray_plane_intersection(const imgui_context::controller_state & in) const;
std::vector<std::pair<ImVec2, float>> ray_plane_intersection(const controller_state & in) const;
void compute_pointer_position(controller_state & state);
// Convert position from viewport coordinates to real-world
glm::vec3 rw_from_vp(const ImVec2 & position);
ImTextureID load_texture(const std::string & filename, vk::raii::Sampler && sampler);
ImTextureID load_texture(const std::string & filename);