Path: blob/v3_openjdk/app_pojavlauncher/src/main/jni/environ/environ.h
2128 views
//1// Created by maks on 24.09.2022.2//34#ifndef POJAVLAUNCHER_ENVIRON_H5#define POJAVLAUNCHER_ENVIRON_H67#include <ctxbridges/common.h>8#include <stdatomic.h>9#include <jni.h>1011/* How many events can be handled at the same time */12#define EVENT_WINDOW_SIZE 80001314typedef struct {15int type;16int i1;17int i2;18int i3;19int i4;20} GLFWInputEvent;2122typedef void GLFW_invoke_Char_func(void* window, unsigned int codepoint);23typedef void GLFW_invoke_CharMods_func(void* window, unsigned int codepoint, int mods);24typedef void GLFW_invoke_CursorEnter_func(void* window, int entered);25typedef void GLFW_invoke_CursorPos_func(void* window, double xpos, double ypos);26typedef void GLFW_invoke_Key_func(void* window, int key, int scancode, int action, int mods);27typedef void GLFW_invoke_MouseButton_func(void* window, int button, int action, int mods);28typedef void GLFW_invoke_Scroll_func(void* window, double xoffset, double yoffset);2930typedef struct {31unsigned char buttons [15];32float axes[6];33} GLFWgamepadstate;3435struct pojav_environ_s {36struct ANativeWindow* pojavWindow;37basic_render_window_t* mainWindowBundle;38int config_renderer;39bool force_vsync;40atomic_size_t eventCounter; // Count the number of events to be pumped out41GLFWInputEvent events[EVENT_WINDOW_SIZE];42size_t outEventIndex; // Point to the current event that has yet to be pumped out to MC43size_t outTargetIndex; // Point to the newt index to stop by44size_t inEventIndex; // Point to the next event that has to be filled45size_t inEventCount; // Count registered right before pumping OUT events. Used as a cache.46double cursorX, cursorY, cLastX, cLastY;47jmethodID method_accessAndroidClipboard;48jmethodID method_onGrabStateChanged;49jmethodID method_onDirectInputEnable;50jmethodID method_glftSetWindowAttrib;51jmethodID method_internalWindowSizeChanged;52jmethodID method_internalChangeMonitorSize;53jclass bridgeClazz;54jclass vmGlfwClass;55jboolean isGrabbing;56jbyte* keyDownBuffer;57jbyte* mouseDownBuffer;58JavaVM* runtimeJavaVMPtr;59JNIEnv* glfwThreadVmEnv;60JavaVM* dalvikJavaVMPtr;61long showingWindow;62bool isInputReady, isCursorEntered, isUseStackQueueCall, shouldUpdateMouse;63bool shouldUpdateMonitorSize, monitorSizeConsumed;64int savedWidth, savedHeight;65GLFWgamepadstate gamepadState;66#define ADD_CALLBACK_WWIN(NAME) \67GLFW_invoke_##NAME##_func* GLFW_invoke_##NAME;68ADD_CALLBACK_WWIN(Char);69ADD_CALLBACK_WWIN(CharMods);70ADD_CALLBACK_WWIN(CursorEnter);71ADD_CALLBACK_WWIN(CursorPos);72ADD_CALLBACK_WWIN(Key);73ADD_CALLBACK_WWIN(MouseButton);74ADD_CALLBACK_WWIN(Scroll);7576#undef ADD_CALLBACK_WWIN77};78extern struct pojav_environ_s *pojav_environ;7980#endif //POJAVLAUNCHER_ENVIRON_H818283