Immediate-Mode-UI / Immediate-Mode-UI/Nuklear

DX9 demo/d3d9nuklear_d3d9.h handle incorrectly resolution/window size

Open
#22 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C
Stars
11.4k
Forks
686
Avg merge
4d 1h
Merged PRs (30d)
3

Description

When the window size is different that the screen resolution and the window is maximixed this demo (DX9) handle incorrectly the resolution, for example the mouse hover is too far from where it should be, meaning you need to move the mouse to the left several centimeters or to the right to move the scroll bar. To replicate this compile the demo adding ShowWindow(wnd, SW_MAXIMIZE); in the main function and be sure the window width and height is different that the current screen resolution.
My guessing is that the function nk_d3d9_get_projection_matrix () is wrong, so the projection matrix is calculated incorrectly. Actually that function calculate the matrix in a no standard way, at least not in the normal way of normal D3D9 applications. Or is coded in a John Carmack's style, meaning hacking style.
I can't test D3d11 but I tested the gdi demo and it work correctly.

Contributor guide

Open the contributing guide

Research direction

Start with the DX9 demo in d3d9nuklear_d3d9.h and inspect nk_d3d9_get_projection_matrix. Reproduce the problem by adding ShowWindow(wnd, SW_MAXIMIZE) with a maximized window whose size differs from the screen resolution, then compare mouse and scrollbar positions with the GDI demo; done means input coordinates align correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.