You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a quick and dirty feature to make the hotbar scrollable.
Just add the following to /src/ui/hotbar.c
this function right before the hotbar_init function
staticvoidscrollCallback(GLFWwindow*window, doublexoffset, doubleyoffset){
// Y-offset is either 1 or -1 (scroll up or down)structUIHotbar*self= (structUIHotbar*)glfwGetWindowUserPointer(window);
// Scroll left if (yoffset==1){
if (self->index==0){
self->index=9;
}else{
self->index-=1;
}
// Scroll right
}elseif(yoffset==-1){
self->index+=1;
self->index=self->index % 10;
}
return;
}
I feel like this would be a valuable addition, but I made use of the WindowUserPointer in a way it is not supposed to be used which would just contribute unclear code which I don't want since this is a properly structured project.
I implemented it into my install of minecraft-weekend and the game is so much easier now, I think maybe you really could open a pull request, even though this is a bit hacky.
This is a quick and dirty feature to make the hotbar scrollable.
Just add the following to
/src/ui/hotbar.c
this function right before the
hotbar_init
functionin
hotbar_init
, afterself->index = 0;
As this solution is very hacky, I did not want to make this into a pull request but think this improves the game.
The text was updated successfully, but these errors were encountered: