Files
PojavLauncher_iOS/Natives/environ.h
T
Eilionoir TunnicliffandDuy Tran Khanh 57ecfbf096 Use native input for controls (#524)
* WIP feature: native input

* Fixes: 1.13+, jar installer input
What's left: fix hotbar position

* Fix broken hotbar

---------

Co-authored-by: Duy Tran Khanh <[email protected]>
2023-04-09 13:33:30 +07:00

76 lines
2.4 KiB
C

//
// Created by maks on 24.09.2022.
//
#ifndef POJAVLAUNCHER_ENVIRON_H
#define POJAVLAUNCHER_ENVIRON_H
#include <stdatomic.h>
#include "jni.h"
typedef struct {
short type;
short i1;
short i2;
short i3;
short i4;
} GLFWInputEvent;
typedef void GLFW_invoke_Char_func(void* window, unsigned int codepoint);
typedef void GLFW_invoke_CharMods_func(void* window, unsigned int codepoint, int mods);
typedef void GLFW_invoke_CursorEnter_func(void* window, int entered);
typedef void GLFW_invoke_CursorPos_func(void* window, double xpos, double ypos);
typedef void GLFW_invoke_FramebufferSize_func(void* window, int width, int height);
typedef void GLFW_invoke_Key_func(void* window, int key, int scancode, int action, int mods);
typedef void GLFW_invoke_MouseButton_func(void* window, int button, int action, int mods);
typedef void GLFW_invoke_Scroll_func(void* window, double xoffset, double yoffset);
typedef void GLFW_invoke_WindowPos_func(void* window, int x, int y);
typedef void GLFW_invoke_WindowSize_func(void* window, int width, int height);
//struct pojav_environ_s {
//struct ANativeWindow* pojavWindow;
//render_window_t* mainWindowBundle;
int config_renderer;
//BOOL force_vsync;
atomic_size_t eventCounter;
GLFWInputEvent events[8000];
double cursorX, cursorY, cLastX, cLastY;
//jmethodID method_accessAndroidClipboard;
//jmethodID method_onGrabStateChanged;
jmethodID method_glfwSetWindowAttrib;
jmethodID method_internalWindowSizeChanged;
jclass bridgeClazz;
jclass vmGlfwClass;
jboolean isGrabbing;
jbyte* keyDownBuffer;
JavaVM* runtimeJavaVMPtr;
JNIEnv* runtimeJNIEnvPtr;
//JavaVM* dalvikJavaVMPtr;
//JNIEnv* dalvikJNIEnvPtr_ANDROID;
long showingWindow;
bool isInputReady, isCursorEntered, isUseStackQueueCall;
//int savedWidth, savedHeight;
int windowWidth, windowHeight;
int physicalWidth, physicalHeight;
#define ADD_CALLBACK_WWIN(NAME) \
GLFW_invoke_##NAME##_func* GLFW_invoke_##NAME;
ADD_CALLBACK_WWIN(Char);
ADD_CALLBACK_WWIN(CharMods);
ADD_CALLBACK_WWIN(CursorEnter);
ADD_CALLBACK_WWIN(CursorPos);
ADD_CALLBACK_WWIN(FramebufferSize);
ADD_CALLBACK_WWIN(Key);
ADD_CALLBACK_WWIN(MouseButton);
ADD_CALLBACK_WWIN(Scroll);
ADD_CALLBACK_WWIN(WindowPos);
ADD_CALLBACK_WWIN(WindowSize);
#undef ADD_CALLBACK_WWIN
//};
float resolutionScale;
BOOL virtualMouseEnabled;
BOOL isControlModifiable;
#endif //POJAVLAUNCHER_ENVIRON_H