ecumene / couchcraft Goto Github PK
View Code? Open in Web Editor NEWController Support for Minecraft
License: MIT License
Controller Support for Minecraft
License: MIT License
Lots of things are in ControllerContext that shouldn't be there. ControllerContext should handle only input, and recording poll information. The GUI Mouse Control things can perhaps be moved to a separate class, and XboxControllerContext, PS4ControllerContext and so on should deal with them. This includes making a GuiControllerMouse that operates in GUIs, so ControllerContext doesn't have to.
Here's how the buttons move now
if(moveLeftTriggered) {
Vec2f closestMouseTarget = new Vec2f(-1, -1); // Totally Impossible, intended
for(Vec2f buttonTarget : allButtonPositionsOnScreen) {
if(buttonTarget.x < closestMouseTarget.x) { // Choose Left of It
Vec2f distance1 = new Vec2f(buttonTarget);
distance1.sub(currentMouseCoordinates);
Vec2f distance2 = new Vec2f(closestMouseTarget);
distance2.sub(currentMouseCoordinates);
if (distance1.length() < distance2.length()) // Which is closer, the new button or the old?
closestMouseTarget = buttonTarget;
}
}
}
This works, somewhat. But it really should be using that algorithm for a last resort. Above that code should be something that finds all buttons who's X values are the same, otherwise aligned. That way buttons are a little more predictable when moving left and right. This and some other features could produce better results with GuiButtonTargets.
The jump function will be removed in favour of the hover mechanic, because it poses too many issues. In Couchcraft 2.0, the GUI interaction will be better with hover but in the initial release it doesn't really need it.
This would allow the user to select which gamepad is for this client, which allows for things like a splitscreen experience where each game is in a different window, with different controllers selected.
This issue is for the code-functionality only, not the Gui for it. That will come after issue #5
For this issue to be resolved, a VM argument will describe which index to use as the controller
-couchcontrol 1
Config files need to be able to bind any axis or button, to any minecraft keybind and other useful events.
oh boy...
Some time in the future, all GUI interaction will have a Jump function, where the empty spaces in the gui is skipped via finding targets on the screen
In GuiInventory, Item slots need to be added to the list of things the Jump function can do.
This will have a line at the top to use your mouse and click on buttons then preform an action on the controller to bind axis and buttons to MC controls.
It'll also save to the config file, on exit.
Currently, mouse clicking works in every case, except for the GuiSlot class where it independently checks for Mouse.isButtonDown(0) (sigh)
To fix this, an ASM coremod must be written to replace the Mouse class with custom code to left and right click, and scroll.
This issue is to add a new way of interacting with the gui, by using the axis to control pointer movement in Guis.
The divide between "Hovering" movement and "Jumping" movement will be separated like so:
If the Gui is in the Jump Supported list, use jumping. Otherwise, use Hovering.
GuiScreens containing slots are not able to be interacted with. This is because GuiSlot uses its own code to check for Mouse Presses.
How to fix this:
Pseudo code:
public interface GuiCursorCallback {
public Vector2f guiCursorCallback(Vector2f previousCallback, GuiScreen currentScreen, CursorController cursor) {
if(currentScreen instanceof MyScreen) // Special code for a special screen
if(cursor.hoverMode) return ...; // Return special hover code
else return ...; // Special jump code
else return previousCallback; // Give back the old callback, nothing else to do...
}
}
This makes it easy for special Gui like the inventory screen to have custom interaction, like easier crafting or Gui specific button actions.
This would include recursively looking for Sliders, lists, buttons, checkboxes, fields, item stacks, inventory slots, new things that pop up from nowhere (looking at NEI), and so many other things. Each thing needs its own mouse movement (sliders need to be easy to slide and all).
If anyone has ideas for gui inputs that might need specific tweaking with mouse movement I'd love to add them to my list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.