Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide mouse sensitivity by window scale #148

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/plib/gnw/gnw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ int win_init(VideoOptions* video_options, int flags)
if (GNW_input_init(flags) == -1) {
return WINDOW_MANAGER_ERR_INITIALIZING_INPUT;
}
mouseSetWindowScale(video_options->scale);

GNW_intr_init();

Expand Down
9 changes: 8 additions & 1 deletion src/plib/gnw/mouse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ static char mouse_trans;
static int gMouseWheelX = 0;
static int gMouseWheelY = 0;

static int gWindowScale = 1;

// 0x4B4780
int GNW_mouse_init()
{
Expand Down Expand Up @@ -798,7 +800,7 @@ bool mouse_is_disabled()
void mouse_set_sensitivity(double value)
{
if (value > 0 && value < 2.0) {
mouse_sensitivity = value;
mouse_sensitivity = value / gWindowScale;
}
}

Expand Down Expand Up @@ -875,4 +877,9 @@ void convertMouseWheelToArrowKey(int* keyCodePtr)
}
}

void mouseSetWindowScale(int scale)
{
gWindowScale = scale;
}

} // namespace fallout
1 change: 1 addition & 0 deletions src/plib/gnw/mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void mouseGetPositionInWindow(int win, int* x, int* y);
bool mouseHitTestInWindow(int win, int left, int top, int right, int bottom);
void mouseGetWheel(int* x, int* y);
void convertMouseWheelToArrowKey(int* keyCodePtr);
void mouseSetWindowScale(int scale);

} // namespace fallout

Expand Down