mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Fix hotbar switch + mouse scroll not working, when hotbar switch has been rebinded.
This commit is contained in:
parent
31b0cde8aa
commit
cde8d2cfd1
@ -142,7 +142,7 @@ namespace ClassicalSharp.Gui.Widgets {
|
||||
|
||||
float deltaAcc;
|
||||
public override bool HandlesMouseScroll(float delta) {
|
||||
if (game.Input.AltDown) {
|
||||
if (game.Input.IsKeyDown(KeyBind.HotbarSwitching)) {
|
||||
int index = game.Inventory.Offset / Inventory.BlocksPerRow;
|
||||
game.Inventory.Offset = ScrolledIndex(delta, index, 1) * Inventory.BlocksPerRow;
|
||||
altHandled = true;
|
||||
|
@ -60,7 +60,7 @@ namespace ClassicalSharp.Map {
|
||||
/// <summary> Sets the block at the given world coordinates without bounds checking. </summary>
|
||||
public void SetBlock(int x, int y, int z, BlockID blockId) {
|
||||
int i = (y * Length + z) * Width + x;
|
||||
blocks1[i] = (BlockRaw)blockId;
|
||||
blocks1[i] = (BlockRaw)blockId;
|
||||
if (blocks1 == blocks2) return;
|
||||
blocks2[i] = (BlockRaw)(blockId >> 8);
|
||||
}
|
||||
|
@ -172,6 +172,10 @@ void ButtonWidget_Render(GuiElement* elem, Real64 delta) {
|
||||
Texture_RenderShaded(&widget->Texture, col);
|
||||
}
|
||||
|
||||
bool ButtonWidget_HandlesMouseDown(GuiElement* elem, Int32 x, Int32 y, MouseButton btn) {
|
||||
return ((ButtonWidget*)elem)->OnClick(x, y, btn);
|
||||
}
|
||||
|
||||
GuiElementVTABLE ButtonWidget_VTABLE;
|
||||
void ButtonWidget_Create(ButtonWidget* widget, STRING_PURE String* text, Int32 minWidth, FontDesc* font, Gui_MouseHandler onClick) {
|
||||
widget->VTABLE = &ButtonWidget_VTABLE;
|
||||
@ -185,7 +189,8 @@ void ButtonWidget_Create(ButtonWidget* widget, STRING_PURE String* text, Int32 m
|
||||
Elem_Init(widget);
|
||||
widget->MinWidth = minWidth; widget->MinHeight = 40;
|
||||
ButtonWidget_SetText(widget, text);
|
||||
widget->VTABLE->HandlesMouseDown = onClick;
|
||||
widget->OnClick = onClick;
|
||||
widget->VTABLE->HandlesMouseDown = ButtonWidget_HandlesMouseDown;
|
||||
}
|
||||
|
||||
void ButtonWidget_SetText(ButtonWidget* widget, STRING_PURE String* text) {
|
||||
|
@ -38,9 +38,10 @@ typedef struct ButtonWidget_ {
|
||||
FontDesc Font;
|
||||
|
||||
String OptName;
|
||||
Gui_MouseHandler OnClick;
|
||||
ButtonWidget_GetValue GetValue;
|
||||
ButtonWidget_SetValue SetValue;
|
||||
Int32 MinWidth, MinHeight, Metadata;
|
||||
Int32 MinWidth, MinHeight;
|
||||
} ButtonWidget;
|
||||
|
||||
void ButtonWidget_Create(ButtonWidget* widget, STRING_PURE String* text, Int32 minWidth, FontDesc* font, Gui_MouseHandler onClick);
|
||||
|
Loading…
x
Reference in New Issue
Block a user