mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
parent
701627fdbf
commit
684d154a6d
@ -489,7 +489,11 @@ pub const GLFWCallbacks = struct { // MARK: GLFWCallbacks
|
|||||||
@floatCast(y),
|
@floatCast(y),
|
||||||
};
|
};
|
||||||
if(grabbed and !ignoreDataAfterRecentGrab) {
|
if(grabbed and !ignoreDataAfterRecentGrab) {
|
||||||
deltas[deltaBufferPosition] += (newPos - currentPos)*@as(Vec2f, @splat(main.settings.mouseSensitivity));
|
var newDelta = (newPos - currentPos)*@as(Vec2f, @splat(main.settings.mouseSensitivity));
|
||||||
|
if(settings.invertMouseY) {
|
||||||
|
newDelta[1] *= -1;
|
||||||
|
}
|
||||||
|
deltas[deltaBufferPosition] += newDelta;
|
||||||
var averagedDelta: Vec2f = Vec2f{0, 0};
|
var averagedDelta: Vec2f = Vec2f{0, 0};
|
||||||
for(deltas) |delta| {
|
for(deltas) |delta| {
|
||||||
averagedDelta += delta;
|
averagedDelta += delta;
|
||||||
|
@ -7,6 +7,7 @@ const gui = @import("../gui.zig");
|
|||||||
const GuiComponent = gui.GuiComponent;
|
const GuiComponent = gui.GuiComponent;
|
||||||
const GuiWindow = gui.GuiWindow;
|
const GuiWindow = gui.GuiWindow;
|
||||||
const Button = @import("../components/Button.zig");
|
const Button = @import("../components/Button.zig");
|
||||||
|
const CheckBox = @import("../components/CheckBox.zig");
|
||||||
const HorizontalList = @import("../components/HorizontalList.zig");
|
const HorizontalList = @import("../components/HorizontalList.zig");
|
||||||
const Label = @import("../components/Label.zig");
|
const Label = @import("../components/Label.zig");
|
||||||
const VerticalList = @import("../components/VerticalList.zig");
|
const VerticalList = @import("../components/VerticalList.zig");
|
||||||
@ -56,6 +57,11 @@ fn updateSensitivity(sensitivity: f32) void {
|
|||||||
main.settings.save();
|
main.settings.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn invertMouseYCallback(newValue: bool) void {
|
||||||
|
main.settings.invertMouseY = newValue;
|
||||||
|
main.settings.save();
|
||||||
|
}
|
||||||
|
|
||||||
fn updateDeadzone(deadzone: f32) void {
|
fn updateDeadzone(deadzone: f32) void {
|
||||||
main.settings.controllerAxisDeadzone = deadzone;
|
main.settings.controllerAxisDeadzone = deadzone;
|
||||||
}
|
}
|
||||||
@ -89,6 +95,8 @@ pub fn onOpen() void {
|
|||||||
const list = VerticalList.init(.{padding, 16 + padding}, 364, 8);
|
const list = VerticalList.init(.{padding, 16 + padding}, 364, 8);
|
||||||
list.add(Button.initText(.{0, 0}, 128, if(editingKeyboard) "Gamepad" else "Keyboard", .{.callback = &toggleKeyboard}));
|
list.add(Button.initText(.{0, 0}, 128, if(editingKeyboard) "Gamepad" else "Keyboard", .{.callback = &toggleKeyboard}));
|
||||||
list.add(ContinuousSlider.init(.{0, 0}, 256, 0, 5, if(editingKeyboard) main.settings.mouseSensitivity else main.settings.controllerSensitivity, &updateSensitivity, &sensitivityFormatter));
|
list.add(ContinuousSlider.init(.{0, 0}, 256, 0, 5, if(editingKeyboard) main.settings.mouseSensitivity else main.settings.controllerSensitivity, &updateSensitivity, &sensitivityFormatter));
|
||||||
|
list.add(CheckBox.init(.{0, 0}, 256, "Invert mouse Y", main.settings.invertMouseY, &invertMouseYCallback));
|
||||||
|
|
||||||
if(!editingKeyboard) {
|
if(!editingKeyboard) {
|
||||||
list.add(ContinuousSlider.init(.{0, 0}, 256, 0, 5, main.settings.controllerAxisDeadzone, &updateDeadzone, &deadzoneFormatter));
|
list.add(ContinuousSlider.init(.{0, 0}, 256, 0, 5, main.settings.controllerAxisDeadzone, &updateDeadzone, &deadzoneFormatter));
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ pub var fov: f32 = 70;
|
|||||||
pub var mouseSensitivity: f32 = 1;
|
pub var mouseSensitivity: f32 = 1;
|
||||||
pub var controllerSensitivity: f32 = 1;
|
pub var controllerSensitivity: f32 = 1;
|
||||||
|
|
||||||
|
pub var invertMouseY: bool = false;
|
||||||
|
|
||||||
pub var renderDistance: u16 = 7;
|
pub var renderDistance: u16 = 7;
|
||||||
|
|
||||||
pub var highestLod: u3 = highestSupportedLod;
|
pub var highestLod: u3 = highestSupportedLod;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user