mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-07 22:59:17 -05:00
Compare commits
2 Commits
2554dcba9b
...
3f6d67c61c
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f6d67c61c | |||
| 07033cff90 |
@ -115,9 +115,9 @@ int main(void)
|
|||||||
// without crossing perimeter, points must be in anticlockwise order
|
// without crossing perimeter, points must be in anticlockwise order
|
||||||
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
|
void DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointCount, Color tint)
|
||||||
{
|
{
|
||||||
|
rlSetTexture(texture.id);
|
||||||
rlBegin(RL_TRIANGLES);
|
rlBegin(RL_TRIANGLES);
|
||||||
|
|
||||||
rlSetTexture(texture.id);
|
|
||||||
|
|
||||||
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
rlColor4ub(tint.r, tint.g, tint.b, tint.a);
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
#include <android_native_app_glue.h> // Required for: android_app struct and activity management
|
#include <android_native_app_glue.h> // Required for: android_app struct and activity management
|
||||||
#include <android/window.h> // Required for: AWINDOW_FLAG_FULLSCREEN definition and others
|
#include <android/window.h> // Required for: AWINDOW_FLAG_FULLSCREEN definition and others
|
||||||
//#include <android/sensor.h> // Required for: Android sensors functions (accelerometer, gyroscope, light...)
|
//#include <android/sensor.h> // Required for: Android sensors functions (accelerometer, gyroscope, light...)
|
||||||
#include <jni.h> // Required for: JNIEnv and JavaVM [Used in OpenURL()]
|
#include <jni.h> // Required for: JNIEnv and JavaVM [Used in OpenURL() and GetCurrentMonitor()]
|
||||||
|
|
||||||
#include <EGL/egl.h> // Native platform windowing system interface
|
#include <EGL/egl.h> // Native platform windowing system interface
|
||||||
|
|
||||||
@ -446,8 +446,32 @@ int GetMonitorCount(void)
|
|||||||
// Get current monitor where window is placed
|
// Get current monitor where window is placed
|
||||||
int GetCurrentMonitor(void)
|
int GetCurrentMonitor(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "GetCurrentMonitor() not implemented on target platform");
|
int displayId = -1;
|
||||||
return 0;
|
JNIEnv* env = NULL;
|
||||||
|
JavaVM* vm = platform.app->activity->vm;
|
||||||
|
(*vm)->AttachCurrentThread(vm, &env, NULL);
|
||||||
|
|
||||||
|
jobject activity = platform.app->activity->clazz;
|
||||||
|
jclass activityClass = (*env)->GetObjectClass(env, activity);
|
||||||
|
|
||||||
|
jmethodID getDisplayMethod = (*env)->GetMethodID(env, activityClass, "getDisplay", "()Landroid/view/Display;");
|
||||||
|
|
||||||
|
jobject display = (*env)->CallObjectMethod(env, activity, getDisplayMethod);
|
||||||
|
|
||||||
|
if (display == NULL) {
|
||||||
|
TRACELOG(LOG_ERROR, "GetCurrentMonitor() couldn't get the display object");
|
||||||
|
} else {
|
||||||
|
jclass displayClass = (*env)->FindClass(env, "android/view/Display");
|
||||||
|
jmethodID getDisplayIdMethod = (*env)->GetMethodID(env, displayClass, "getDisplayId", "()I");
|
||||||
|
displayId = (int) (*env)->CallIntMethod(env, display, getDisplayIdMethod);
|
||||||
|
(*env)->DeleteLocalRef(env, displayClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
(*env)->DeleteLocalRef(env, activityClass);
|
||||||
|
(*env)->DeleteLocalRef(env, display);
|
||||||
|
|
||||||
|
(*vm)->DetachCurrentThread(vm);
|
||||||
|
return displayId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor position
|
// Get selected monitor position
|
||||||
|
|||||||
Reference in New Issue
Block a user