Compare commits

..

No commits in common. "2bb51035c2aaf1b7b83e38e9bb2fd7bd3bf4c04a" and "f20012c33f037bba14358c16afcdfab9b13b461e" have entirely different histories.

7 changed files with 13 additions and 55 deletions

View File

@ -16,7 +16,7 @@ public class EaglercraftVersion {
//Client name (Shadow)
public static final String projectForkName = new String(new byte[] {83, 104, 97, 100, 111, 119 });
//Build version (number + snapshot/official)
public static final String projectForkVersion = new String(new byte[] {52, 46, 53, 32, 115, 110, 97, 112, 115, 104, 111, 116, 45, 50, 52, 119, 50, 56, 97 });
public static final String projectForkVersion = new String(new byte[] {52, 46, 53, 32, 115, 110, 97, 112, 115, 104, 111, 116, 45, 50, 52, 119, 50, 55, 97 });
//Author name (PeytonPlayz585)
public static final String projectForkVendor = new String(new byte[] {80, 101, 121, 116, 111, 110, 80, 108, 97, 121, 122, 53, 56, 53 });

View File

@ -202,9 +202,8 @@ public class WorldRenderer {
* SLOW AND STUPID COMPANION FUNCTION TO 'func_181672_a'
*/
public void setVertexState(WorldRenderer.State state) {
int[] rawBuffer = state.getRawBuffer();
this.grow(rawBuffer.length);
PlatformBufferFunctions.put(this.intBuffer, 0, rawBuffer);
this.grow(state.getRawBuffer().length);
PlatformBufferFunctions.put(this.intBuffer, 0, state.getRawBuffer());
this.vertexCount = state.getVertexCount();
this.vertexFormat = state.getVertexFormat();
}

View File

@ -40,7 +40,7 @@ public class GuiButton extends Gui {
public int id;
public boolean enabled;
public boolean visible;
public boolean hovered;
protected boolean hovered;
public float fontScale = 1.0f;
public GuiButton(int buttonId, int x, int y, String buttonText) {

View File

@ -11,9 +11,7 @@ import org.teavm.jso.dom.html.HTMLImageElement;
import org.teavm.jso.gamepad.GamepadEvent;
import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.minecraft.client.Minecraft;
import org.teavm.jso.gamepad.Gamepad;
@ -29,8 +27,8 @@ public class Controller {
private static boolean left = false;
private static boolean right = false;
//Fixes 'slight' issues of stick drift people have been complaining about
private static double threshold = 0.3;
//Fixes 'slight' issues of stick drift people have been complaining about
private static double cameraThreshold = 4.0;
private static double cursorThreshold = 0.4;
@ -38,7 +36,6 @@ public class Controller {
private static ButtonState[] button = new ButtonState[30];
public static HTMLImageElement cursor;
public static boolean isActive = false;
public static final int getDX() {
if(dx < 0.0) {
@ -159,10 +156,6 @@ public class Controller {
}
}
if(getDX() > 0 || getDY() > 0 || getDX() < 0 || getDY() < 0) {
isActive = true;
}
forward = axes[1] < -threshold;
backwards = axes[1] > threshold;
left = axes[0] < -threshold;
@ -179,11 +172,9 @@ public class Controller {
if(button[i] == ButtonState.PRESSED) {
button[i] = ButtonState.HELD;
isActive = true;
} else {
if(!(button[i] == ButtonState.HELD)) {
button[i] = ButtonState.PRESSED;
isActive = true;
}
}
} else if(!gamePad.getButtons()[i].isPressed() && index == activeController) {
@ -198,10 +189,6 @@ public class Controller {
updateAxes(gamePad);
updateButtons(gamePad, index);
}
if(cursor != null && isButtonPressed(0) || isButtonDown(0)) {
Minecraft.getMinecraft().currentScreen.controllerClicked(Mouse.getX(), Mouse.getY());
}
}
public static void addCursor(int x, int y) {
@ -259,7 +246,6 @@ public class Controller {
@Override
public void handleEvent(GamepadEvent arg0) {
connectedControllers.add(arg0.getGamepad().getIndex());
isActive = true;
System.out.println("Controller connected!");
}
});
@ -271,7 +257,6 @@ public class Controller {
if(connectedControllers.contains(index)) {
connectedControllers.remove(index);
resetButtonStates();
isActive = false;
System.out.println("Controller disconnected!");
}
}

View File

@ -21,7 +21,6 @@ import org.teavm.jso.dom.html.HTMLElement;
import org.teavm.jso.webgl.WebGLFramebuffer;
import org.teavm.jso.webgl.WebGLRenderbuffer;
import net.PeytonPlayz585.shadow.input.Controller;
import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext;
@ -129,7 +128,6 @@ public class PlatformInput {
int b = evt.getButton();
buttonStates[b == 1 ? 2 : (b == 2 ? 1 : b)] = true;
mouseEvents.add(evt);
Controller.isActive = false;
}
});
canvas.addEventListener("mouseup", mouseup = new EventListener<MouseEvent>() {
@ -140,7 +138,6 @@ public class PlatformInput {
int b = evt.getButton();
buttonStates[b == 1 ? 2 : (b == 2 ? 1 : b)] = false;
mouseEvents.add(evt);
Controller.isActive = false;
}
});
canvas.addEventListener("mousemove", mousemove = new EventListener<MouseEvent>() {
@ -155,21 +152,18 @@ public class PlatformInput {
if(hasBeenActive()) {
mouseEvents.add(evt);
}
Controller.isActive = false;
}
});
canvas.addEventListener("mouseenter", mouseenter = new EventListener<MouseEvent>() {
@Override
public void handleEvent(MouseEvent evt) {
isMouseOverWindow = true;
Controller.isActive = false;
}
});
canvas.addEventListener("mouseleave", mouseleave = new EventListener<MouseEvent>() {
@Override
public void handleEvent(MouseEvent evt) {
isMouseOverWindow = false;
Controller.isActive = false;
}
});
win.addEventListener("keydown", keydown = new EventListener<KeyboardEvent>() {
@ -185,7 +179,6 @@ public class PlatformInput {
int ww = processFunctionKeys(w);
keyStates[KeyboardConstants.getEaglerKeyFromBrowser(ww, ww == w ? evt.getLocation() : 0)] = true;
keyEvents.add(evt);
Controller.isActive = false;
}
});
win.addEventListener("keyup", keyup = new EventListener<KeyboardEvent>() {
@ -204,7 +197,6 @@ public class PlatformInput {
}
}
keyEvents.add(evt);
Controller.isActive = false;
}
});
win.addEventListener("keypress", keypress = new EventListener<KeyboardEvent>() {
@ -212,7 +204,6 @@ public class PlatformInput {
public void handleEvent(KeyboardEvent evt) {
evt.preventDefault();
evt.stopPropagation();
Controller.isActive = false;
if(enableRepeatEvents && evt.isRepeat()) keyEvents.add(evt);
}
});
@ -223,7 +214,6 @@ public class PlatformInput {
evt.stopPropagation();
mouseEvents.add(evt);
mouseDWheel += evt.getDeltaY();
Controller.isActive = false;
}
});
win.addEventListener("blur", new EventListener<WheelEvent>() {
@ -236,14 +226,12 @@ public class PlatformInput {
for(int i = 0; i < keyStates.length; ++i) {
keyStates[i] = false;
}
Controller.isActive = false;
}
});
win.addEventListener("focus", new EventListener<WheelEvent>() {
@Override
public void handleEvent(WheelEvent evt) {
isWindowFocused = true;
Controller.isActive = false;
}
});
win.getDocument().addEventListener("pointerlockchange", pointerlock = new EventListener<WheelEvent>() {
@ -263,7 +251,6 @@ public class PlatformInput {
}, 60);
mouseDX = 0.0D;
mouseDY = 0.0D;
Controller.isActive = false;
}
});
@ -516,16 +503,10 @@ public class PlatformInput {
}
public static int mouseGetX() {
if(Controller.cursor != null) {
return Controller.cursor.getOffsetLeft();
}
return mouseX;
}
public static int mouseGetY() {
if(Controller.cursor != null) {
return canvas.getClientHeight() - Controller.cursor.getOffsetTop();
}
return mouseY;
}

View File

@ -1300,10 +1300,14 @@ public class Minecraft extends ModData implements IThreadListener {
Controller.tick();
if(this.currentScreen != null && Controller.isActive && Controller.cursor == null) {
Controller.addCursor(0, 0);
} else if(Controller.cursor != null) {
Controller.removeCursor();
if(this.currentScreen != null) {
if(Controller.cursor == null) {
Controller.addCursor(0, 0);
}
} else {
if(Controller.cursor != null) {
Controller.removeCursor();
}
}
if (this.rightClickDelayTimer > 0) {

View File

@ -426,17 +426,6 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback {
this.mc.thePlayer.sendChatMessage(msg);
}
public void controllerClicked(int x, int y) {
for (int i = 0; i < this.buttonList.size(); ++i) {
GuiButton guibutton = (GuiButton) this.buttonList.get(i);
if (guibutton.enabled && guibutton.visible && guibutton.hovered) {
this.selectedButton = guibutton;
guibutton.playPressSound(this.mc.getSoundHandler());
this.actionPerformed(guibutton);
}
}
}
/**+
* Called when the mouse is clicked. Args : mouseX, mouseY,
* clickedButton