Fix: line changing on signs, game launch on AMD gpus, mouse sensitivity

Feat: inv slots changing on keyboard
This commit is contained in:
InviseDivine
2026-03-06 22:48:59 +02:00
parent f82021117c
commit d0995643a5
5 changed files with 38 additions and 14 deletions

View File

@@ -697,12 +697,12 @@ void Minecraft::tickInput() {
if (isPressed) { if (isPressed) {
gui.handleKeyPressed(key); gui.handleKeyPressed(key);
#if defined(WIN32) || defined(RPI)//|| defined(_DEBUG) || defined(DEBUG) #if defined(WIN32) || defined(RPI) || defined (PLATFORM_DESKTOP)//|| defined(_DEBUG) || defined(DEBUG)
if (key >= '0' && key <= '9') { if (key >= '0' && key <= '9') {
int digit = key - '0'; int digit = key - '0';
int slot = digit - 1; int slot = digit - 1;
if (slot >= 0 && slot < gui.getNumSlots()-1) if (slot >= 0 && slot < gui.getNumSlots())
player->inventory->selectSlot(slot); player->inventory->selectSlot(slot);
#if defined(WIN32) #if defined(WIN32)
@@ -728,14 +728,8 @@ void Minecraft::tickInput() {
if (!screen && key == Keyboard::KEY_O || key == 250) { if (!screen && key == Keyboard::KEY_O || key == 250) {
releaseMouse(); releaseMouse();
} }
#endif
#if defined(WIN32)
if (key == Keyboard::KEY_F) {
options.isFlying = !options.isFlying;
player->noPhysics = options.isFlying;
}
if (key == Keyboard::KEY_T) { if (key == Keyboard::KEY_F5) {
options.thirdPersonView = !options.thirdPersonView; options.thirdPersonView = !options.thirdPersonView;
/* /*
ImprovedNoise noise; ImprovedNoise noise;
@@ -743,6 +737,21 @@ void Minecraft::tickInput() {
printf("%d\t%f\n", i, noise.grad2(i, 3, 8)); printf("%d\t%f\n", i, noise.grad2(i, 3, 8));
*/ */
} }
#endif
#if defined(WIN32)
if (key == Keyboard::KEY_F) {
options.isFlying = !options.isFlying;
player->noPhysics = options.isFlying;
}
// if (key == Keyboard::KEY_T) {
// options.thirdPersonView = !options.thirdPersonView;
// /*
// ImprovedNoise noise;
// for (int i = 0; i < 16; ++i)
// printf("%d\t%f\n", i, noise.grad2(i, 3, 8));
// */
// }
if (key == Keyboard::KEY_O) { if (key == Keyboard::KEY_O) {
useAmbientOcclusion = !useAmbientOcclusion; useAmbientOcclusion = !useAmbientOcclusion;

View File

@@ -115,10 +115,11 @@ void Options::initDefaultValues() {
keyMenuCancel.key = 4; keyMenuCancel.key = 4;
#endif #endif
#endif #endif
#if defined(PLATFORM_DESKTOP) || defined(RPI)
sensitivity *= 0.4f;
#endif
#if defined(RPI) #if defined(RPI)
username = "StevePi"; username = "StevePi";
sensitivity *= 0.4f;
useMouseForDigging = true; useMouseForDigging = true;
#endif #endif
} }

View File

@@ -425,13 +425,23 @@ void SelectWorldScreen::render( int xm, int ym, float a )
//Performance::watches.get("sws-worlds").start(); //Performance::watches.get("sws-worlds").start();
worldsList->setComponentSelected(bWorldView.selected); worldsList->setComponentSelected(bWorldView.selected);
// #ifdef PLATFORM_DESKTOP
// We should add scrolling with mouse wheel but currently i dont know how to implement it
if (_mouseHasBeenUp) if (_mouseHasBeenUp)
worldsList->render(xm, ym, a); worldsList->render(xm, ym, a);
else { else {
worldsList->render(0, 0, a); worldsList->render(0, 0, a);
_mouseHasBeenUp = !Mouse::getButtonState(MouseAction::ACTION_LEFT); _mouseHasBeenUp = !Mouse::getButtonState(MouseAction::ACTION_LEFT);
} }
// #else
// if (_mouseHasBeenUp)
// worldsList->render(xm, ym, a);
// else {
// worldsList->render(0, 0, a);
// _mouseHasBeenUp = !Mouse::getButtonState(MouseAction::ACTION_LEFT);
// }
// #endif
//Performance::watches.get("sws-worlds").stop(); //Performance::watches.get("sws-worlds").stop();
//Performance::watches.get("sws-screen").start(); //Performance::watches.get("sws-screen").start();

View File

@@ -16,6 +16,7 @@
#include "../../../../world/level/Level.h" #include "../../../../world/level/Level.h"
#include "../../../../world/item/DyePowderItem.h" #include "../../../../world/item/DyePowderItem.h"
#include "../../../../world/item/crafting/Recipe.h" #include "../../../../world/item/crafting/Recipe.h"
#include "platform/input/Keyboard.h"
static NinePatchLayer* guiPaneFrame = NULL; static NinePatchLayer* guiPaneFrame = NULL;
@@ -420,7 +421,7 @@ void PaneCraftingScreen::clearCategoryItems()
void PaneCraftingScreen::keyPressed( int eventKey ) void PaneCraftingScreen::keyPressed( int eventKey )
{ {
if (eventKey == Keyboard::KEY_ESCAPE) { if (eventKey == Keyboard::KEY_ESCAPE || eventKey == Keyboard::KEY_E) {
minecraft->setScreen(NULL); minecraft->setScreen(NULL);
//minecraft->grabMouse(); //minecraft->grabMouse();
} else { } else {

View File

@@ -1,11 +1,13 @@
#ifndef MAIN_GLFW_H__ #ifndef MAIN_GLFW_H__
#define MAIN_GLFW_H__ #define MAIN_GLFW_H__
#include "App.h"
#include "GLFW/glfw3.h" #include "GLFW/glfw3.h"
#include "client/renderer/gles.h" #include "client/renderer/gles.h"
#include "SharedConstants.h" #include "SharedConstants.h"
#include <cstdio> #include <cstdio>
#include "platform/input/Keyboard.h"
#include "platform/input/Mouse.h" #include "platform/input/Mouse.h"
#include "platform/input/Multitouch.h" #include "platform/input/Multitouch.h"
#include "util/Mth.h" #include "util/Mth.h"
@@ -22,6 +24,7 @@ int transformKey(int glfwkey) {
case GLFW_KEY_ESCAPE: return Keyboard::KEY_ESCAPE; case GLFW_KEY_ESCAPE: return Keyboard::KEY_ESCAPE;
case GLFW_KEY_BACKSPACE: return Keyboard::KEY_BACKSPACE; case GLFW_KEY_BACKSPACE: return Keyboard::KEY_BACKSPACE;
case GLFW_KEY_LEFT_SHIFT: return Keyboard::KEY_LSHIFT; case GLFW_KEY_LEFT_SHIFT: return Keyboard::KEY_LSHIFT;
case GLFW_KEY_ENTER: return Keyboard::KEY_RETURN;
default: return glfwkey; default: return glfwkey;
} }
} }
@@ -105,8 +108,8 @@ int main(void) {
} }
glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API); glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_NATIVE_CONTEXT_API);
glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
GLFWwindow* window = glfwCreateWindow(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight(), "main", NULL, NULL); GLFWwindow* window = glfwCreateWindow(appContext.platform->getScreenWidth(), appContext.platform->getScreenHeight(), "main", NULL, NULL);