Polish based on user testing (#19)
Read me fixes Open NFD in working directory Improve input routing Remove log spam
This commit is contained in:
parent
69037feaba
commit
70ba099709
6 changed files with 41 additions and 26 deletions
|
|
@ -236,7 +236,6 @@ void AppendHighlightSphere( b3Transform transform, float radius, HighlightKind k
|
|||
return;
|
||||
if ( s_sphere.count >= MAX_HIGHLIGHTS_PER_KIND )
|
||||
{
|
||||
fprintf( stderr, "[highlight/error] sphere overflow: dropping (cap=%d)\n", MAX_HIGHLIGHTS_PER_KIND );
|
||||
return;
|
||||
}
|
||||
mask_sphere_instance_t* inst = &s_sphere.cpu[s_sphere.count++];
|
||||
|
|
@ -251,7 +250,6 @@ void AppendHighlightCapsule( b3Transform transform, float halfLength, float radi
|
|||
return;
|
||||
if ( s_capsule.count >= MAX_HIGHLIGHTS_PER_KIND )
|
||||
{
|
||||
fprintf( stderr, "[highlight/error] capsule overflow: dropping (cap=%d)\n", MAX_HIGHLIGHTS_PER_KIND );
|
||||
return;
|
||||
}
|
||||
mask_capsule_instance_t* inst = &s_capsule.cpu[s_capsule.count++];
|
||||
|
|
@ -269,7 +267,6 @@ void AppendHighlightGeometry( MeshHandle handle, b3Transform transform, b3Vec3 s
|
|||
return;
|
||||
if ( s_hull.count >= MAX_HIGHLIGHTS_PER_KIND )
|
||||
{
|
||||
fprintf( stderr, "[highlight/error] hull overflow: dropping (cap=%d)\n", MAX_HIGHLIGHTS_PER_KIND );
|
||||
return;
|
||||
}
|
||||
MeshBuffers gb = { 0 };
|
||||
|
|
|
|||
|
|
@ -193,17 +193,18 @@ bool HandleEvent( const sapp_event* e )
|
|||
return false;
|
||||
}
|
||||
|
||||
bool handled = simgui_handle_event( e );
|
||||
// Always feed the event to ImGui so its input state stays current, but ignore the
|
||||
// return value. simgui_handle_event folds keyboard and mouse capture into one bool,
|
||||
// so a panel merely under the cursor would swallow the global shortcut keys.
|
||||
simgui_handle_event( e );
|
||||
const ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
if ( handled )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( e->type == SAPP_EVENTTYPE_KEY_DOWN || e->type == SAPP_EVENTTYPE_KEY_UP || e->type == SAPP_EVENTTYPE_CHAR )
|
||||
{
|
||||
return io.WantCaptureKeyboard;
|
||||
// Only swallow keys while a text field is being edited. A focused panel raises
|
||||
// WantCaptureKeyboard, which otherwise gates Pause and the other globals behind
|
||||
// clicking the 3D view first.
|
||||
return io.WantTextInput;
|
||||
}
|
||||
|
||||
if ( e->type == SAPP_EVENTTYPE_MOUSE_DOWN || e->type == SAPP_EVENTTYPE_MOUSE_UP || e->type == SAPP_EVENTTYPE_MOUSE_MOVE ||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "box3d/box3d.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <filesystem>
|
||||
#include <nfd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -1121,6 +1122,11 @@ void Sample::DrawMetrics()
|
|||
|
||||
void Sample::MouseDown( b3Vec2 p, int button, int modifiers )
|
||||
{
|
||||
if ( m_camera->m_thirdPerson )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( button == 0 && modifiers == 0 )
|
||||
{
|
||||
// Plain click selects the body under the cursor, any type. Empty space clears.
|
||||
|
|
@ -1345,7 +1351,11 @@ void OpenReplayFileDialog( SampleContext* context )
|
|||
NFD_Init();
|
||||
nfdu8char_t* outPath = nullptr;
|
||||
nfdu8filteritem_t filter[1] = { { "Box3D recording", "b3rec" } };
|
||||
if ( NFD_OpenDialogU8( &outPath, filter, 1, nullptr ) == NFD_OKAY )
|
||||
|
||||
// Start in the working directory, where recordings are saved by default.
|
||||
std::u8string cwd = std::filesystem::current_path().u8string();
|
||||
const nfdu8char_t* defaultPath = reinterpret_cast<const nfdu8char_t*>( cwd.c_str() );
|
||||
if ( NFD_OpenDialogU8( &outPath, filter, 1, defaultPath ) == NFD_OKAY )
|
||||
{
|
||||
snprintf( context->replayFile, sizeof( context->replayFile ), "%s", outPath );
|
||||
NFD_FreePathU8( outPath );
|
||||
|
|
@ -1597,7 +1607,7 @@ static void DrawMenuBar( SampleContext* context )
|
|||
{
|
||||
context->showUI = false;
|
||||
}
|
||||
if ( ImGui::MenuItem( "Frame Camera", "Home" ) )
|
||||
if ( ImGui::MenuItem( "Frame Camera" ) )
|
||||
{
|
||||
b3AABB aabb = b3World_GetBounds( context->sample->m_worldId );
|
||||
Camera& cam = context->camera;
|
||||
|
|
@ -2036,6 +2046,7 @@ void Sample::ToggleThirdPerson()
|
|||
{
|
||||
sapp_lock_mouse( true );
|
||||
m_camera->m_thirdPerson = true;
|
||||
ClearSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ public:
|
|||
m_camera->SetView( 45.0f, 10.0f, 5.0f, position );
|
||||
}
|
||||
|
||||
m_launchSpeedScale = 1.0f;
|
||||
m_launchSpeedScale = 2.0f;
|
||||
m_mover.Initialize( this, position );
|
||||
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue