This commit is contained in:
Junkui Zhang 2025-08-04 19:07:20 +08:00
parent 87b4710dd0
commit fc5bcf0ad1
2 changed files with 6 additions and 2 deletions

View file

@ -207,7 +207,7 @@ impl DirectXRenderer {
fn present(&mut self) -> Result<()> {
unsafe {
let result = self.resources.swap_chain.Present(1, DXGI_PRESENT(0));
let result = self.resources.swap_chain.Present(0, DXGI_PRESENT(0));
// Presenting the swap chain can fail if the DirectX device was removed or reset.
if result == DXGI_ERROR_DEVICE_REMOVED || result == DXGI_ERROR_DEVICE_RESET {
let reason = self.devices.device.GetDeviceRemovedReason();

View file

@ -381,6 +381,7 @@ fn handle_keydown_msg(
) -> Option<isize> {
let mut lock = state_ptr.state.borrow_mut();
lock.keydown_time = Some(std::time::Instant::now());
println!("WM_KEYDOWN");
let Some(input) = handle_key_event(handle, wparam, lparam, &mut lock, |keystroke| {
PlatformInput::KeyDown(KeyDownEvent {
keystroke,
@ -1244,7 +1245,10 @@ fn draw_window(
let mut lock = state_ptr.state.borrow_mut();
if let Some(keydown_time) = lock.keydown_time.take() {
let elapsed = keydown_time.elapsed();
println!("Elapsed keydown time: {:.02} ms", elapsed.as_secs_f64() * 1000.0);
println!(
"Elapsed keydown time: {:.02} ms",
elapsed.as_secs_f64() * 1000.0
);
}
lock.callbacks.request_frame = Some(request_frame);
unsafe { ValidateRect(Some(handle), None).ok().log_err() };