fix many things and make playable
This commit is contained in:
@@ -715,7 +715,7 @@ void Minecraft::tickInput() {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(RPI)
|
||||
#if defined(PLATFORM_DESKTOP)
|
||||
if (key == Keyboard::KEY_E) {
|
||||
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
||||
}
|
||||
@@ -831,7 +831,7 @@ void Minecraft::tickInput() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef RPI
|
||||
#ifndef PLATFORM_DESKTOP
|
||||
if (key == 82)
|
||||
pauseGame(false);
|
||||
#else
|
||||
@@ -1242,7 +1242,7 @@ void Minecraft::_reloadInput() {
|
||||
#ifndef STANDALONE_SERVER
|
||||
delete inputHolder;
|
||||
|
||||
if (useTouchscreen()) {
|
||||
if (useTouchscreen() && !PLATFORM_DESKTOP) {
|
||||
inputHolder = new TouchInputHolder(this, &options);
|
||||
} else {
|
||||
#if defined(ANDROID) || defined(__APPLE__)
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include <SDL/SDL.h>
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_GLFW
|
||||
#include <GLFW/glfw3.h>
|
||||
#endif
|
||||
|
||||
MouseHandler::MouseHandler( ITurnInput* turnInput )
|
||||
: _turnInput(turnInput)
|
||||
{}
|
||||
@@ -29,6 +33,10 @@ void MouseHandler::grab() {
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
SDL_ShowCursor(0);
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_GLFW
|
||||
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MouseHandler::release() {
|
||||
@@ -37,6 +45,10 @@ void MouseHandler::release() {
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
SDL_ShowCursor(1);
|
||||
#endif
|
||||
|
||||
#ifdef PLATFORM_GLFW
|
||||
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MouseHandler::poll() {
|
||||
|
||||
@@ -66,7 +66,11 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
||||
//minecraft->gameRenderer->setupGuiScreen();
|
||||
Font* font = minecraft->font;
|
||||
|
||||
#ifdef PLATFORM_DESKTOP
|
||||
const bool isTouchInterface = false;
|
||||
#else
|
||||
const bool isTouchInterface = minecraft->useTouchscreen();
|
||||
#endif
|
||||
const int screenWidth = (int)(minecraft->width * InvGuiScale);
|
||||
const int screenHeight = (int)(minecraft->height * InvGuiScale);
|
||||
blitOffset = -90;
|
||||
@@ -391,7 +395,6 @@ void Gui::onConfigChanged( const Config& c ) {
|
||||
//LOGI("x,y: %f, %f\n", xx, yy);
|
||||
}
|
||||
rcFeedbackInner = t.end(true, rcFeedbackInner.vboId);
|
||||
|
||||
if (c.minecraft->useTouchscreen()) {
|
||||
// I'll bump this up to 6.
|
||||
int num = 6; // without "..." dots
|
||||
|
||||
@@ -401,7 +401,7 @@ void SelectWorldScreen::tick()
|
||||
minecraft->hostMultiplayer();
|
||||
minecraft->setScreen(new ProgressScreen());
|
||||
_hasStartedLevel = true;
|
||||
#elif defined(WIN32)
|
||||
#elif defined(PLATFORM_DESKTOP)
|
||||
std::string name = getUniqueLevelName("perf");
|
||||
minecraft->setScreen(new SimpleChooseLevelScreen(name));
|
||||
#else
|
||||
|
||||
@@ -152,7 +152,8 @@ void GameRenderer::render(float a) {
|
||||
|
||||
int xMouse = (int)(Mouse::getX() * Gui::InvGuiScale);
|
||||
int yMouse = (int)(Mouse::getY() * Gui::InvGuiScale);
|
||||
if (mc->useTouchscreen()) {
|
||||
#ifndef PLATFORM_DESKTOP
|
||||
if (mc->useTouchscreen()) {
|
||||
const int pid = Multitouch::getFirstActivePointerIdExThisUpdate();
|
||||
if (pid >= 0) {
|
||||
xMouse = (int)(Multitouch::getX(pid) * Gui::InvGuiScale);
|
||||
@@ -162,6 +163,7 @@ void GameRenderer::render(float a) {
|
||||
yMouse = -9999;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
TIMER_POP();
|
||||
|
||||
bool hasClearedColorBuffer = false;
|
||||
@@ -652,8 +654,11 @@ void GameRenderer::pick(float a) {
|
||||
|
||||
float range = mc->gameMode->getPickRange();
|
||||
bool isPicking = true;
|
||||
|
||||
#ifndef PLATFORM_DESKTOP
|
||||
bool freeform = mc->useTouchscreen() && !mc->options.isJoyTouchArea;
|
||||
#else
|
||||
bool freeform = false;
|
||||
#endif
|
||||
if (freeform) {
|
||||
isPicking = updateFreeformPickDirection(a, pickDirection);
|
||||
} else {
|
||||
|
||||
@@ -60,6 +60,8 @@ static void cursor_position_callback(GLFWwindow* window, double xpos, double ypo
|
||||
}
|
||||
|
||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) {
|
||||
if(action == GLFW_REPEAT) return;
|
||||
|
||||
double xpos, ypos;
|
||||
glfwGetCursorPos(window, &xpos, &ypos);
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
&m_threadID // pointer to receive thread ID
|
||||
);
|
||||
#endif
|
||||
#if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
#if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
mp_threadFunc = (pthread_fn)threadFunc;
|
||||
|
||||
pthread_attr_init(&m_attributes);
|
||||
pthread_attr_setdetachstate( &m_attributes, PTHREAD_CREATE_DETACHED );
|
||||
/*int error =*/ pthread_create(&m_thread, &m_attributes, mp_threadFunc,threadParam);
|
||||
/*int error =*/ pthread_create(&m_thread, &m_attributes, mp_threadFunc, threadParam);
|
||||
#endif
|
||||
#ifdef MACOSX
|
||||
mp_threadFunc = (TaskProc) threadFunc;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
typedef void *( * pthread_fn )( void * );
|
||||
|
||||
#if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
#if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef void *( * pthread_fn )( void * );
|
||||
DWORD m_threadID;
|
||||
HANDLE m_threadHandle;
|
||||
#endif
|
||||
#if defined(LINUX) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
#if defined(__linux__) || defined(ANDROID) || defined(__APPLE__) || defined(POSIX)
|
||||
pthread_fn mp_threadFunc;
|
||||
pthread_t m_thread;
|
||||
pthread_attr_t m_attributes;
|
||||
|
||||
Reference in New Issue
Block a user